Virtual entities or model
-
I was wondering if it was possible to create a "virtual" entities or model variable where I can make lines and faces without affecting the model I'm working on. The reason for this is that I want to create a cube like this:
def cubecomp(x,y,z) orig = Geom;;Point3d.new 0,0,0 pts = [] pts[0] = orig pts[1] = orig + x pts[3] = orig + y pts[2] = pts[1] + x + y cubeface = entities.add_face pts cubeface.pushpull - z.length, true cube = cubeface.all_connected
The potential problem I'm afraid of is that if one of the vertices of the cube is on an edge that is already in the model, I will select it with the all_connected method. What I would like to do is something like virtualEntities = Entities.new and use this to build the cube. Later, I want to copy this cube to several different locations.
Does anyone know if something like this is possible or if there is a safe work around?
-
This might be better in the Ruby sections...
In the meanwhile... It won't work as show ascubeface = entities.add_face(pts)
doesn't haveentities
defined.
The reference 'entities' could bemodel.entities
ormodel.active_entities
BUT as you surmised it could result in a clash with preexisting geometry...
It's best in these circumstances to add the new geometry into a new group so it remaining unconnected to other stuff you can always explode the group afterwards if you must have the contents in a particular entities set - or make a component definition etc.
To add a group use
ents=model.active_entities group=ents.add_group() gents=group.entities
then add things to 'gents'...
cubeface=gents.add_face(pts)
etc etc You have references to 'group' and 'gents'... just as you started with 'model' and 'active_entities'...
The geometry inside 'group' is separated from the rest of the model unless you usegroup.explode
... -
Sweet. Thanks a lot TIG, that should work.
Advertisement