Discrepancy between welded Curves and "valid" Curves

Discrepancy between welded Curves and “valid” Curves

Consider a loop of edges with an additional singleton edge sharing one of the loops vertices (fig a).

When “Welding” the set of edges (via the Ruby API), the loop of edges is identified as a single polyline and become a Sketchup::Curve. I consider this behaviour “correct”.

The singleton edge also becomes a Sketchup::Curve. I consider this behaviour “incorrect” (but not egregious). (fig b)

a

The set of edges & curves is reselected, then validated using Sketchup’s internal validation function (Windows > Model Info > Statistics > Fix Problems). The “loop curve” is identified as have “bad connectivity”. I presume this is because the Curve terminus vertices coincide with each other and a vertex of another Object (?). I consider this behaviour “incorrect” as the polyline is not violated at any “mid-vertex”.

The result after validation is that the loop curve is split into disassociated edges and the Curve object is lost.

I am currently writing a Ruby extension that is reliant on identifying loops of this nature as valid polylines. I can “re-welding” all edges immediately before processing to avoid Sketchup’s validate check but obviously it adds unnecessary processing time. More importantly, any generated curves of this nature will be “broken” when validation runs. Subverting the user’s expectations.

Is the above behaviour is as intended? if so, what propose does it serve? Is there any work-arounds or a way to flag the curve as valid before validation occurs?

Thanks in advance!

Code used to investigate the issue:-

  model      = Sketchup.active_model
  edges      = model.selection.grep(Sketchup::Edge)
 
  puts "num_of_SU_Edges:             " + edges.size.to_s
 
  model.active_entities.weld( edges )  

  curve_edges , single_edges = edges.partition{ |edge| edge.curve }
  curves = curve_edges.group_by{ |edge| edge.curve }

  puts "num_of_SU_Edges (singles):   " + single_edges.size.to_s
  puts "num_of_SU_Edges (in curves): " + curve_edges.size.to_s
  puts "num_of_SU_Curves:            " + curves.size.to_s 
  
  puts "SU_Curves:-"
  curves.each{ |curve|  
    hash = { OBJ: curve[0].inspect, ID: curve[0].entityID.to_s, num_of_Edges: curve[0].edges.size }
    puts hash
    } 

Please report bugs in the official API issue tracker at:

This may be already logged, see:

Thanks Dan, I was not aware of the tracker.

Seems SU are in no rush to fix this :confused:

“The welding hand giveth and the validating hand taketh away”

1 Like