model = Sketchup.active_model
entities = model.entities
dpoint_1=[-3.989142.m, 3.877123.m, -0.m]
dpoint_2=[-3.989142.m, -3.647636.m, -0.m]
curve_array=[[-3.989142.m, 3.877123.m, -0.m],[-4.457867.m, 3.358428.m, -0.m],[-4.853319.m, 2.781918.m, -0.m],
[-5.16845.m, 2.157867.m, -0.m],[-5.397644.m, 1.4974.m, -0.m],[-5.536815.m, 0.812289.m, -0.m],
[-5.583482.m, 0.114744.m, -0.m],[-5.536815.m, -0.582801.m, -0.m],[-5.397644.m, -1.267913.m, -0.m],
[-5.16845.m, -1.92838.m, -0.m],[-4.853319.m, -2.55243.m, -0.m],[-4.457867.m, -3.128941.m, -0.m],[-3.989142.m, -3.647636.m, -0.m]]
curve_center=[-0.347015.m, 0.114744.m, -0.m]
center= [-5.583482.m, 0.114744.m, -0.m]
offset1_vec =center.vector_to dpoint_1
offset2_vec =center.vector_to dpoint_2
offset1 = center.offset offset1_vec,(0.2.m)
offset2 = center.offset offset2_vec,(0.2.m)
line1_vector = center.vector_to curve_center
line2_vector = center.vector_to curve_center
line1 = [offset1,line1_vector]
line2 = [offset2,line2_vector]
entities.add_curve(curve_array)
entities.add_cline(offset1,line1_vector)
entities.add_cline(offset2,line2_vector)
curve_array_length =(curve_array.length)-1
curve_array_length.times do |point|
line = [curve_array.at(point),curve_array.at(point +1) ]
pt1 = Geom.intersect_line_line(line, line1)
pt2 = Geom.intersect_line_line(line, line2)
puts "pt1;#{pt1}"
puts "pt2;#{pt1}"
end
Hi Guys
Just wondering why the above code sample returns an intersection with each code block iteration.
If it was working correctly it should return 2 point3d's instead every line comparison is showing up as an intersection?
I am sure there must be something basic that I have missed.
Some times another set of eyes works wonders.
Cheers Brett