As shown in the figure, there are three connected edges. I obtained the positions of their endpoints in sequence, resulting in four coordinate points labeled as pts. When I used edges = Sketchup.active_model.active_entities.add_curve(pts), no curve was generated. However, if I delete the original edges first and then generate the curve, it works without any issues. On the other hand, when using Sketchup’s default tool, weld_edges, a complete curve can be obtained without needing to delete the original edges. How is this achieved?
Just thinking: in the first case the curve has been created over the edges and broken into separate edges. So what you see is new edges coinciding with existing edges. They all merge.
Deleting the edges first > running the code > gives you the desired curve.
The third option I do not dare to explain.
Is the result one curve at that location as expected. For two completely coinciding curves in the same context is not 'SketchUp alike". Maybe work in different contexts (one in a group)
My TIG-weld does this, but the new native tools really supersedes it..
It’s available from the SketchUcation PluginStore, it is not encrypted, and the RB file in its subfolder explains how it collects the selected edges vertices and sorts them into a useful set, then adds a temporary group, creates the curve from those vertex points and final explodes the group, thereby overwriting the existing selected edges or curve parts with the new curve.
The curves are generated, but since there was an existing geometries (edges) SU forced to merge the new edges of curve to the existing edges. So you only see the end result which are the merged geometries. As you realized:
The #weld method takes a set of edges and find all possible chains of edges and connect them with a Curve.
If you already determined the edges:
model = Sketchup.active_model
entities = model.active_entities
curves = entities.weld(edges)
… otherwise as a general method for the active entities, will create all the possible curves in the active context:
model = Sketchup.active_model
entities = model.active_entities
edges = entities.grep(Sketchup::Edge)
curves = entities.weld(edges)
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
