Using entities.add_curve(points_array)
will return a continuous selectable curve…
If you add this curve to a surface it remains a continuous selectable curve…
if you add a ‘surface’ to the curve it becomes a series of disconnected edges, but each edge still reports as being a curve…
this occurs for surfaces formed from the curve to a centre point or between two curves…
the gif shows a demo from the script attached…
I have tried many ways of grouping, moving, exploding in different sequences, but they all result exactly the same as this one…
I looked at many welding scripts, but they either fail to work, are buggy or spend a lot of effort ‘looking’ for an edge array…
As already have original point arrays, is there a way to remedy this splitting of the curses highlighted in the gif…
the test script…
# script to aid in disscussion of welding surface edges...
model = Sketchup.active_model
sel = model.selection
ents = model.active_entities
view = model.active_view
mats = model.materials
# cylindrical sine wave pair on a unit radius with 24 sides...
wave = [[1.0, 0.0, 0.0], [0.9659258262890683, 0.25881904510252074, 0.050799999999999984], [0.8660254037844387, 0.49999999999999994, 0.08798818102449896], [0.7071067811865476, 0.7071067811865475, 0.1016], [0.5000000000000001, 0.8660254037844386, 0.08798818102449898], [0.25881904510252096, 0.9659258262890682, 0.05080000000000003], [6.123233995736766e-17, 1.0, 1.2442411479337108e-17], [-0.25881904510252063, 0.9659258262890683, -0.05079999999999998], [-0.4999999999999998, 0.8660254037844388, -0.08798818102449893], [-0.7071067811865475, 0.7071067811865476, -0.1016], [-0.8660254037844385, 0.5000000000000003, -0.087988181024499], [-0.9659258262890682, 0.258819045102521, -0.050800000000000047], [-1.0, 1.2246467991473532e-16, -2.4884822958674216e-17], [-0.9659258262890684, -0.25881904510252035, 0.05079999999999989], [-0.8660254037844388, -0.4999999999999998, 0.08798818102449892], [-0.7071067811865479, -0.7071067811865471, 0.1016], [-0.5000000000000004, -0.8660254037844384, 0.08798818102449903], [-0.25881904510252146, -0.9659258262890681, 0.05080000000000014], [-1.8369701987210297e-16, -1.0, 3.267705224142925e-17], [0.2588190451025203, -0.9659258262890684, -0.050799999999999915], [0.4999999999999993, -0.866025403784439, -0.08798818102449889], [0.7071067811865475, -0.7071067811865477, -0.1016], [0.8660254037844384, -0.5000000000000004, -0.08798818102449901], [0.9659258262890681, -0.2588190451025215, -0.05080000000000014], [1.0, 0.0, -0.0]]
rev_wave = wave.reverse
#
outer_wave = []
rev_wave.each{|pt| outer_wave << [pt[0], pt[1], pt[2] + 0.1]}
#
inner_wave = []
outer_wave.each{|pt| inner_wave << [pt[0] * 0.5, pt[1] * 0.5, pt[2]]}
# single undo
model.start_operation('Wave', false, false, false)
# add colors to watch the order of construction...
mat_names = []
mats.each{|n| mat_names << n.name}
mats.add('inner').color = 'skyblue' unless mat_names.include?('inner')
mats.add('outer').color = 'seashell' unless mat_names.include?('outer')
# Make the empty 'wave' group.
wave_grp = ents.add_group()
# Make array to hold entities...
wave_ents = wave_grp.entities
# Add outer points to inner points for the radial pairs...
radial = outer_wave.zip(inner_wave)
radial_edges = radial.each {|pr|
e = wave_ents.add_edges(pr)
e[0].soft="true"
e[0].smooth="true"
# for watching only
sel.add(e)
view.refresh
}
sel.clear
# Add outer points to offset inner points for the diagonal pairs...
diagonal = outer_wave.zip(inner_wave[0..-2].unshift(inner_wave[-1]))
diagonal_edges = diagonal.each {|pr|
e = wave_ents.add_edges(pr)
e[0].soft="true"
e[0].smooth="true"
e[0].casts_shadows = false
# for watching only
sel.add(e)
view.refresh
}
sel.clear
# Add the inner 'curve' and face created between curve, radial and diagonal edges...
inner_edges = wave_ents.add_curve(inner_wave)
i = 0
inner_edges.each {|e|
e.find_faces
f = e.faces[0]
i += 1
# for watching only
f.material = 'inner'
sel.add(f)
view.refresh
}
sel.clear
#
outer_edges = wave_ents.add_curve(outer_wave)
i = 0
outer_edges.each {|e|
e.find_faces
f = e.faces[0]
i += 1
# for watching only
f.material = 'outer'
sel.add(f)
view.refresh
}
sel.clear
sel.add(inner_edges, outer_edges)
model.commit_operation
and here a gif of the curve to centre-point surface…
john