Smooth Line after push/pull
-
Hello,
When using the below code, how do I smooth the edges?` prompts = ["length", "Run","height","Rise","Total Rises"]
defaults = [36.0,10.0,1.0,7.75,7]
input = UI.inputbox prompts, defaults, "Tread."if input == false UI.messagebox("All Must Be Entered") else a,b,c,d,e=input #UI.messagebox("Tread input accepted!, #{input}!") end ent = Sketchup.active_model.entitiesfor i in 0..e-1
ent.add_line [0,(b+1)+ib,0+id-1],[0,(1.5+ib),0+id-1]
ent.add_line [0,1.5+ib,0+id-1],[0,1.5+ib,-d+(id)-1]
ent.add_line [0,1+ib,0+id-1],[0,1+ib,-d+(id)-1]
ent.add_line [0,1+ib,-d+(id)-1],[0,1.5+ib,-d+(id)-1]
ent.add_line [0,1+ib,-1+id],[0,0.5+ib,-1+id]
ent.add_arc [0,0.5+ib,-c/2.0+(id)],[0,0,-1],[-1,0,0],c/2.0,0,180.degrees,20
ent.add_line [0,0.5+ib,0+id],[0,b+(ib)+1,0+id]
edg=ent.add_line [0,b+1+ib,-c+id],[0,b+1+ib,0+id]
edg.find_faces; face=edg.faces[0]# #face = ent.add_face [0,0,0], [a,0,0], [a,b,0], [0,b,0] #face.reverse! face.pushpull -a # edg.soft="true" #group1 = ent.add_group face.all_connected end #group1_copy = group1.parent.entities.add_instance(group1.entities.parent, group.transformation)`Before Smooth
After Smooth
edg.soft="true" doesn't appear to do anything
Thanks -
@davesexcel said:
Hello,
When using the below code, how do I smooth the edges?` prompts = ["length", "Run","height","Rise","Total Rises"]
defaults = [36.0,10.0,1.0,7.75,7]
input = UI.inputbox prompts, defaults, "Tread."if input == false UI.messagebox("All Must Be Entered") else a,b,c,d,e=input #UI.messagebox("Tread input accepted!, #{input}!") end ent = Sketchup.active_model.entitiesfor i in 0..e-1
ent.add_line [0,(b+1)+ib,0+id-1],[0,(1.5+ib),0+id-1]
ent.add_line [0,1.5+ib,0+id-1],[0,1.5+ib,-d+(id)-1]
ent.add_line [0,1+ib,0+id-1],[0,1+ib,-d+(id)-1]
ent.add_line [0,1+ib,-d+(id)-1],[0,1.5+ib,-d+(id)-1]
ent.add_line [0,1+ib,-1+id],[0,0.5+ib,-1+id]
ent.add_arc [0,0.5+ib,-c/2.0+(id)],[0,0,-1],[-1,0,0],c/2.0,0,180.degrees,20
ent.add_line [0,0.5+ib,0+id],[0,b+(ib)+1,0+id]
edg=ent.add_line [0,b+1+ib,-c+id],[0,b+1+ib,0+id]
edg.find_faces; face=edg.faces[0]# #face = ent.add_face [0,0,0], [a,0,0], [a,b,0], [0,b,0] #face.reverse! face.pushpull -aedg.soft="true"
#group1 = ent.add_group face.all_connected
end
#group1_copy = group1.parent.entities.add_instance(group1.entities.parent, group.transformation)`
Before SmoothAfter Smooth
edg.soft="true" doesn't appear to do anything
Thanks#<----- where changes and additions were made
prompts = ["length", "Run","height","Rise","Total Rises"] defaults = [36.0,10.0,1.0,7.75,7] input = UI.inputbox prompts, defaults, "Tread." if input == false UI.messagebox("All Must Be Entered") else a,b,c,d,e=input #UI.messagebox("Tread input accepted!, #{input}!") end ent = Sketchup.active_model.entities for i in 0..e-1 ent.add_line [0,(b+1)+i*b,0+i*d-1],[0,(1.5+i*b),0+i*d-1] ent.add_line [0,1.5+i*b,0+i*d-1],[0,1.5+i*b,-d+(i*d)-1] ent.add_line [0,1+i*b,0+i*d-1],[0,1+i*b,-d+(i*d)-1] ent.add_line [0,1+i*b,-d+(i*d)-1],[0,1.5+i*b,-d+(i*d)-1] edg = ent.add_line [0,1+i*b,-1+i*d],[0,0.5+i*b,-1+i*d];vrt1=edg.end#<----- ent.add_arc [0,0.5+i*b,-c/2.0+(i*d)],[0,0,-1],[-1,0,0],c/2.0,0,180.degrees,20 edg = ent.add_line [0,0.5+i*b,0+i*d],[0,b+(i*b)+1,0+i*d];vrt2=edg.start#<----_ edg=ent.add_line [0,b+1+i*b,-c+i*d],[0,b+1+i*b,0+i*d] edg.find_faces; face=edg.faces[0] # #face = ent.add_face [0,0,0], [a,0,0], [a,b,0], [0,b,0] #face.reverse! face.pushpull -a edgs=vrt1.edges.reject!{|e| e.length<a};edgs[0].soft=true#<----- edgs=vrt2.edges.reject!{|e| e.length<a};edgs[0].soft=true#<----- # edg.soft="true" #group1 = ent.add_group face.all_connected end #group1_copy = group1.parent.entities.add_instance(group1.entities.parent, group.transformation) -
sdmitch
I am trying to learn from you code. How is the smoothing only applied to the edges created by the add arc? It needs some English description if you will!!
Keith
-
@ktkoh said:
sdmitch
I am trying to learn from you code. How is the smoothing only applied to the edges created by the add arc? It needs some English description if you will!!
Keith
I save the vertices, vrt1 and vrt2, at the beginning and end of the arc. Then I look at all the edges associated with those vertices and eliminate all that are not the proper length. This leaves me with a single edge that is softened.
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