Dear friends,
s_grp = Sketchup.active_model.active_entities.add_group
@pt = [0, 0, 0]
x = 10
pts = [[1.94894, 1.22513, 0], [0.87372, 0.14991, 0], [0.82338, 0.10577, 0], [0.76772, 0.06857, 0], [0.70768, 0.03896, 0], [0.64428, 0.01744, 0], [0.57862, 0.00438, 0], [0.5118, 0, 0], [0.445, 0.00438, 0], [0.434067, 0.00655667, 0], [0.3794, 0.01744, 0], [0.316, 0.03896, 0], [0.265917, 0.063635, 0], [0.2559, 0.06857, 0], [0.247957, 0.0738843, 0], [0.2003, 0.10577, 0], [0.1571, 0.143604, 0], [0.1499, 0.14991, 0], [0.1058, 0.20024, 0], [0.0686, 0.25591, 0], [0.039, 0.31595, 0], [0.0175, 0.37935, 0], [0.0044, 0.44501, 0], [0, 0.51181, 0], [0, x + 0.5118, 0], [0.0044, x + 0.5786, 0], [0.0175, x + 0.6443, 0], [0.039, x + 0.7077, 0], [0.0686, x + 0.7677, 0], [0.1058, x + 0.8234, 0], [0.1499, x + 0.8737, 0], [0.2003, x + 0.9178, 0], [0.2559, x + 0.955, 0], [0.316, x + 0.9847, 0], [0.3794, x + 1.0062, 0], [0.445, x + 1.0192, 0], [0.5118, x + 1.0236, 0], [x + 0.5118, x + 1.0236, 0], [x + 0.5786, x + 1.0192, 0], [x + 0.6442, x + 1.0062, 0], [x + 0.7076, x + 0.9847, 0], [x + 0.7677, x + 0.955, 0], [x + 0.8233, x + 0.9178, 0], [x + 0.8737, x + 0.8737, 0], [x + 0.9178, x + 0.8234, 0], [x + 0.955, x + 0.7677, 0], [x + 0.9846, x + 0.7077, 0], [x + 1.0061, x + 0.6443, 0], [x + 1.0192, x + 0.5786, 0], [x + 1.0236, x + 0.5118, 0], [x + 1.0236, 0.51181, 0], [x + 1.0192, 0.44501, 0], [x + 1.0061, 0.37935, 0], [x + 0.9846, 0.31595, 0], [x + 0.955, 0.25591, 0], [x + 0.9178, 0.20024, 0], [x + 0.8737, 0.14991, 0], [x + 0.8233, 0.10577, 0], [x + 0.7677, 0.06857, 0], [x + 0.7076, 0.03896, 0], [x + 0.6442, 0.01744, 0], [x + 0.5786, 0.00438, 0], [x + 0.5118, 0, 0], [0.5118, 0, 0], [0.445, 0.00438, 0], [0.434067, 0.00655667, 0], [0.3794, 0.01744, 0], [0.316, 0.03896, 0], [0.265917, 0.063635, 0], [0.2559, 0.06857, 0], [0.247957, 0.0738843, 0], [0.2003, 0.10577, 0], [0.1571, 0.143604, 0], [0.1499, 0.14991, 0], [0.1058, 0.20024, 0], [0.0686, 0.25591, 0], [0.039, 0.31595, 0], [0.0175, 0.37935, 0], [0.0044, 0.44501, 0], [0, 0.51181, 0], [0.00438, 0.57862, 0], [0.01744, 0.64428, 0], [0.03896, 0.70768, 0], [0.06857, 0.76772, 0], [0.10577, 0.82338, 0], [0.14991, 0.87372, 0], [1.22513, 1.94894, 0]]
ll = 0
dis = 0
for i in 0...pts.size
ll = ll + pts[i].distance(pts[i + 1]) if i != pts.size - 1
end
for i in 0...pts.size
pts[i].z = @pt.z + (0.5 / 2.54) - dis / ll * (1 / 2.54)
dis = dis + pts[i].distance(pts[i + 1]) if i != pts.size - 1
end
p ll
cp = pts.first
vector1 = pts[0].vector_to(pts[1])
edge1 = s_grp.entities.add_circle cp, vector1, (0.5 / 2.54)
edge1 = s_grp.entities.weld(edge1)
path1 = s_grp.entities.add_curve pts
face2 = s_grp.entities.add_face(edge1)
# face2.followme path1
Codes works well but if we add last line SU terminated!!! Any idea about this problem?