Edge length question
-
cface=codef.entities.add_face(@pt) orig_ents = codef.entities.to_a cface.pushpull(-1*@c2depth) if @edge == "Round" fin_ents = codef.entities.to_a added_ents = fin_ents - orig_ents added_ents.each {|e| e.smooth="true" if e.is_a?(Sketchup;;Edge) } added_ents.each {|e| e.soft="true" if e.is_a?(Sketchup;;Edge) } end #if Round
I am using the code to smooth the edges of a Mortise however I don't want to smooth the bottom edges. I have tried several ways to add the test "e.length == @c2depth" but have been unsucessful. Any ideas how to do this??
Keith
-
When you make the new face immediately set
normal=cface.normal
then after you pushpull it to make the hole [and it's 'gone'] and you've checked it's 'round' and you've got the new geoemtry, you can smooth only those new edges that are parallel to the 'normal' thus:
added_ents.each{|e|(e.smooth=true;e.soft=true) if e.is_a?(Sketchup::Edge) and e.line[1].parallel?(normal)}
Note how you can combine the smooth/soft setting into the one test, which halves the processing time.
Note too that it's=true
/=false
boolean NOT strings="true"
/="false"
[which would both returntrue
because they have a value] -
Thanks TIG That was exactly what I needed!!!
Keith
11
Advertisement