I’m working on a tool to draw cubes and turn them into components. Once I add the component instance, if I go into the model and right click my component and “Change Axes”, I see that the components axes are attached to the models origin instead of the component itself.
I’ve tested the sample hellocube example and turned it’s result into a component just to ensure it wasn’t some other bug in my custom tool.
group = model.active_entities.add_group
entities = group.entities
points = [
Geom::Point3d.new(1, 1, 1),
Geom::Point3d.new(2, 1, 1),
Geom::Point3d.new(2, 2, 1),
Geom::Point3d.new(1, 2, 1)
]
face = entities.add_face(points)
face.pushpull(-1)
group.to_component
My goal is to have the origin set at the first point, and Z axis in the chosen direction. My cube tool can be drawn at any angle, so I want to set the Z axis to be set to the vector I pushpulled my cube. I already have my vector, I just don’t now how to force my components origin to be where the component was initially created and set the Z axis to my vector.
Screenshot showing the components axis are attached to the models origin.