Construction line idiosyncrasy
-
According to the SU API, a ConstructionLine object has the following geometrical properties:
direction, position, start and end.
The start and end of infinite ConstructionLine objects are nil. Semi-infinite ConstructionLine objects have either a non nil end or a non nil start. Finite ConstructionLine objects have non nil start and end.These 4 properties are not independent and some odd results may surprise us.
ent = Sketchup.active_model.entities #<Sketchup;;Entities;0xa02542c> p = Geom;;Point3d.new(0,0,0) Point3d(0, 0, 0) dir = Geom;;Vector3d.new(1,1,0) Vector3d(1, 1, 0) ent.add_cline(p,dir) #<Sketchup;;ConstructionLine;0xa024f90> cl = ent.add_cline(p,dir) #<Sketchup;;ConstructionLine;0xa024e64> cl.end = Geom;;Point3d.new(100,100,0) Point3d(100, 100, 0) cl.start = Geom;;Point3d.new(0,0,0) Point3d(0, 0, 0) cl.end = Geom;;Point3d.new(200,0,0) Point3d(200, 0, 0) cl.end Point3d(100, 100, 0) cl.end = Geom;;Point3d.new(300,0,0) Point3d(300, 0, 0) cl.end Point3d(150, 150, 0)
It seems to me that the end method projects the input Point3d in the line before setting it. The same behaviour is observed for the start method.
If the input point of either the end method or the start method is not in the line of the construction line, we should change the line direction too.
cl.direction = Geom;;Vector3d.new(1,0,0) Vector3d(1, 0, 0) cl.end = Geom;;Point3d.new(300,0,0) Point3d(300, 0, 0) cl.end Point3d(300, 0, 0)
Advertisement