Script won't find face
-
I have this one scripts,
UI.menu("PlugIns").add_item("Draw Riser") { draw_riser } def draw_riser prompts = ["length", "Run","height","Rise","Total Rises","Riser Thickness"] defaults = [36.0,10.0,1.0,7.75,7,0.5] input = UI.inputbox prompts, defaults, "Risers." a,b,c,d,e,f=input ent = Sketchup.active_model.entities #---------Clear All #Sketchup.active_model.entities.clear! #----------------Make 1st Riser ent.add_line [0,0,d-c+0.1875], [0,0,0] ent.add_line [0,-0.5,d-c+0.1875], [0,-0.5,0] ent.add_line [0,0,0], [0,-0.5,0] ent.add_line [0,0,d-c+0.1875], [0,-0.5,d-c+0.1875] #edg.find_faces; face=edg.faces[0] #face.pushpull a ##group5 = ent.add_group face.all_connected #----------------Make rest of Risers ent.add_line [0,b,2*d-c+0.1875], [0,b,d-c] ent.add_line [0,-0.5+b,2*d-c+0.1875], [0,-0.5+b,d-c] ent.add_line [0,b,d-c], [0,-0.5+b,d-c] ent.add_line [0,b,2*d-c+0.1875], [0,-0.5+b,2*d-c+0.1875] # edg.find_faces; face=edg.faces[0] #face.pushpull a #group3 = ent.add_group face.all_connected #for i in 1..e-2 # group5 = group4.copy # tran = Geom;;Transformation.translation [0, b*i, d*i] #group5.transform! tran #end endIm having issues getting the code to make the faces and then pushpull.
My idea is to make the 1st riser a group on it's own, then make the second riser a group and copy it up.
Thanks
-
Do not add the edges to the model entities, they will intersect with the model.
-
Create an empty group, and immediately add a cpoint into it (to keep SU garbage collection from deleting it.)
-
then add the edges to the group's entities collection
-
then do find_faces on the edges inside the group and the face should added to the group's entities.
-
then do the push pull
-
delete the temp cpoint
-
then copy the group
-
-
To expand that point...
ent = Sketchup.active_model.entities **group = ent.add_group() ent = group.entities**Add the two 'BOLD' lines after the
ent =
Then everything is inside 'group', which you can 'name' etc as you wish... -
Thank you,
That worked.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement