I am trying to use the grid primitive to generate seperate faces of a rectangular box of given (Length, Width, Height) dimensions in python.
I need to have absolutely a seperate object for each face of the 3D rectangle and I also need to control its mesh resolution. Essentially I intend to generate the 8 seperate faces of the rectangle (bottom, front, rear, top, etc…) and position them to place, using translations and rotations.
The problem is each generated rectangular grid seems to be centered around random points on the object itself. In other words, globally each new object is created at obj.loc=[0,0,0], however it is unclear what part of the object serves as a DATUM that coincides with the object location center? Where ever it is it seems to inconsistently change for different L,W,H and g values!
So I am not able to calculate the necessary translation/rotations correctly to build my box.
HERE ARE A FEW LINES OF THE PROCESS:
Let’s say my 3D rectangle will have [L, W, H] grid points and the grid spacing is g
# BASE (BOTTOM) me = Mesh.Primitives.Grid(L, W, g) obj=sc.objects.new(me,'Bottom') #FRONT me2 = Mesh.Primitives.Grid(W, H, g) obj2=sc.objects.new(me2,'Front') obj2.RotY += pi/2 #make the plane vertical obj2.LocX -= L*g * 0.5 obj2.LocY -= W*g * 0.5 obj2.LocZ+= H*g *0.5
Can someone please tell me where is the “CENTER” of the “Grid” primitive, which should be coincident with obj.loc=[0,0,0]? Does that change at any step of the above process? Why can’t I get the necessary translation values right?
Looking forward to your feedback!