Hello,
i’m constructing triangles with ruby and try to plot them within
Sketchup. In most cases, this works. But sometimes, an error occurs:
“Points are not planar”, which is quite strange for a triangle…
model = Sketchup.active_model
entities = model.active_entities
k = 0
for i in 1..3 do
x = arr[k]
y = arr[k+1]
z = arr[k+2]
pts << Geom::Point3d.new([x,y,z])
k += 3
end
pts << pts.first()
begin
face = entities.add_face(pts)
rescue
puts $!.message
puts pts
end
arr is an array with the triangle coordinates (the coordinates come from
an external data source, but thats not the problem)
An example output for an error is
Points are not planar
(0,08255m, 0,003858m, 0,11049m)
(0,083007m, 0,004218m, 0,11049m)
(0,082855m, 0,004111m, 0,11049m)
(0,08255m, 0,003858m, 0,11049m)
The last and the first point are the same, but thats correct (a face is
constructed by a closed line).
o you have any ideas where I can find the error?