Manipulation entities in a group through Ruby?
-
Hi!
Is it possible to move edges or faces in a group through Ruby??....
So far a have only succeeded with the .pushpull method.-RVS
-
You can get an array of the vertices of a face [or some edges etc] and move them using a vector transformation, in the form something like
vertices = face.vertices vector = Geom;;Vector3d.new(0,0,1) ### this is 'up' 1" vectors = [] vertices.length.times{vectors << vector} group.entities.transform_by_vectors(vertices, vectors) ### all of the face's vertices will move up 1"
-
@tig said:
You can get an array of the vertices of a face [or some edges etc] and move them using a vector transformation, in the form something like
vertices = face.vertices > vector = Geom;;Vector3d.new(0,0,1) > ### this is 'up' 1" > vectors = [] > vertices.length.times{vectors << vector} > group.entities.transform_by_vectors(vertices, vectors) > ### all of the face's vertices will move up 1"
Dear Tig
I would like to know that can your script apply on a face with arc or circle edges with round hole inside the face, please?
Thanks
Oscar -
http://rhin.crai.archi.fr/RubyLibraryDepot/plugin_details.php?id=412 has an example for making CHS and RHS sections where it draws the two loops and erases the inner one
If you are sure that you will only have 2 faces to check - e.g. a grouped set of geometry that is perhaps two concentric circles with faces; and you want to erase the inner 'disc' to leave a 'ring' then use something like this after you have added the edges/facesgroup.entities.each{|e| e.erase! if e.class==Sketchup;;Face and e.loops[1] } ### i.e. the ring has two loops but the inner circle only has one...
There are several ways to add faces to entities sets and also to check which is the inner face etc if an edge has two faces...
Advertisement