Help with .followme
-
Hi guys, I am making a plugin where I need to use
.followme
and I'm having bug splat with some curves, an attached two example curves that give me problems
curves
here a fragment of my codemodel = Sketchup.active_model sel = model.selection ent = model.entities selec = [] selec.clear sel.each{|ob| selec.push(ob) if ob.is_a?(Sketchup;;Edge)} if selec.size == 0 UI.messagebox "Please select a Curve" return end radio_tubo = 10.0.cm lados_tubo = 8 pts=[] pts.clear pts=selec[0].vertices.collect{|v| v.position} if Sketchup.version.to_f < 7.0 model.start_operation("Draw tube") else model.start_operation("Draw tube", true) end grupo = ent.add_group entities = grupo.entities normal_cir = (pts[0].vector_to pts[1]).normalize circle = entities.add_circle pts[0], normal_cir, radio_tubo, lados_tubo cara = entities.add_face circle cara.reverse!.followme selec #selec.each{|edge| edge.erase!} model.commit_operation qq="OK"
I try to test the plugin TubeAlongPath.rb with radius = 10 cm and also the bug occurs
plugin
I've noticed that with smaller r no problem (for example r = 2 cm)I do not know how to fix this, in advance thank you for your help
(google translator)
.
-
entities.add_circle
does NOT return aSketchup::Curve
object.
It returns anArray
ofSketchup::Edge
objects, that make up the curve.So line 27 should be:
edges = entities.add_circle( pts[0], normal_cir, radio_tubo, lados_tubo )
... and line 28:
cara = entities.add_face( edges[0].curve )
-
Thanks Dan, I modified my code.
My problem persists, someone can see the problem? -
Your problem in not so much your code but the curve itself, 320x0.42cm segments. Reducing the number of segments or scaling the curve up 100x worked without Bug Splat. Also reducing the circle size to 1cm worked as well. The 10cm circle is just to big for the curve.
-
Thanks for the reply sdmitch, give me a first clue
what worries me is that the user of the plugin do this and generate a bug splat on, I would like in this case simply do not tube, but do not understand how to calculate the minimum length allowed for this case -
It is probably more a function of the angle between segments than the length of the segments. In this case, the maximum radius is something between 4 and 5cm.
-
you sent me on the right track, thanks sdmitch
Advertisement