I want to make an external skeleton as a line by drawing the corners of each group model in the current sketchup. The code I made for him is as follows
model = Sketchup.active_model
entities = model.active_entities
material = model.materials.add("purple")
material.color = Sketchup::Color.new(255, 0, 255)
groups = model.selection.grep(Sketchup::Group)
groups.each do |group|
edges = group.entities.grep(Sketchup::Edge)
edges.each do |edge|
start_point = edge.start.position.transform(group.transformation)
end_point = edge.end.position.transform(group.transformation)
entities.add_line(start_point, end_point).layer = model.layers.add("tag8")
entities.add_line(start_point, end_point).material = material
end
end
(Tags and materials can be ignored because they are codes created for distinction)
The problem with this code is that it does not take into account the intersect point.
Please understand with the explanation shown in the picture below
What I want is a combination of edges that connect the point and the point considering the intersect point.
I ask for your help.