# how to get vertex coordinate of polyhedra created by function polyhedra_utils.fillBox()

hello
i have created many polyhedra by function polyhedra_utils.fillBox, i want to know how to obtain the vertex coordinates of any polyhedron.

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
lip
Solved:
2019-07-30
Last query:
2019-07-30
2019-07-29
 Robert Caulk (rcaulk) said on 2019-07-29: #1
 lip (mr.xie) said on 2019-07-29: #2

thank you for your answer.i think it may work, but i have not tried it yet for i do not know what does the argument shape mean.I just want to get the vertex coordinates of one of the polyhedrons according to its id，not all the polyhedras.
by the way, if i want to get the volume of a polyhedra, is there any way to achieve that?

 Robert Caulk (rcaulk) said on 2019-07-29: #3

Did you try b.shape, where b is the polyhedra?

 lip (mr.xie) said on 2019-07-29: #4

dear Robert:
i have tried b.shape, and the problem solved. but i still have a problem of how to get the vertex of polyhedra for i do not know what does the argument shape mean, if i just want to get the vertex coordinates of one of the polyhedrons,can i achive that according to its id?

 Robert Caulk (rcaulk) said on 2019-07-29: #5

I think it would be easier to help you if you provided an MWE and the error [1].

 lip (mr.xie) said on 2019-07-29: #6

i am sorry for i did not make my question clear. my question is that:
if i created a polyhedra by function polyhedra_utils.polyhedra like that:
polyhedra_utils.polyhedra(material=m,size=(0.4,0.4,0.8),seed=1)
what should i do to get the vertex of the polyhedra?

 Robert Caulk (rcaulk) said on 2019-07-29: #7

To be honest, I do not know. I am just trying to guide you through the documentation. I'm happy to dive into it with you if you provide an MWE and an error.

I would try using b.shape as the argument of PrintPolyhedra if I were you.

 lip (mr.xie) said on 2019-07-30: #8

dear Robert:
i have tried function _polyhedra_utils.PrintPolyhedra

 Robert Caulk (rcaulk) said on 2019-07-30: #9

Hello Lip,

If the problem is solved, please mark the answer that solved it or indicate how it is solved so people in the future can (attempt to) benefit from this thread.

Thank you,

Robert

 Jan Stránský (honzik) said on 2019-07-30: #10

Hello,

> what does the argument shape mean

b.shape

> get the volume of a polyhedra

b.shape.GetVolume() [1]

> can i achive that according to its id?

b = O.bodies[id]

> how to obtain the vertex coordinates of any polyhedron.

transform the polyedron's local coordinates to globals using b.state.pos and b.state.ori:
###
vsLocal = b.shape.v # [2], vertices in Polyhedron's coordinate system
vsGlobal = [b.state.pos + b.state.ori*v for v in vsLocal] # vertices in global coordinate system
###

cheers
Jan