Hi @dale,
there seems to be a bug in setting DefPoint1
and DefPoint2
of an AngularDimension
. If the new point is on a line which would not change the angle of the angular dimension, the DefPoint
is not set. Below image shows what i want to do. DefPoint1
(A) should be moved to point B without changing the angle of the dimension object.
I’ve found that i can trick it by first moving it away and then back (see commented out code):
def DoSomething():
dim_id = rs.GetObject("AngDim", rs.filter.annotation, True, False)
if not dim_id: return
ang_dim = rs.coercerhinoobject(dim_id, True)
pt = rs.GetPoint("DefPoint1")
if not pt: return
_, s, t = ang_dim.Geometry.Plane.ClosestParameter(pt)
# this fails
ang_dim.Geometry.DefPoint1 = Rhino.Geometry.Point2d(s, t)
# this works
#ang_dim.Geometry.DefPoint1 = Rhino.Geometry.Point2d(s+0.01, t+0.01)
#ang_dim.Geometry.DefPoint1 = Rhino.Geometry.Point2d(s-0.01, t-0.01)
ang_dim.CommitChanges()
DoSomething()
Here is the file: DefPointBug.3dm (38.6 KB)
Please note that i want to set these points before adding the AngularDimension
to the document. Above example is just for illustration of the bug.
EDIT: I’ve found AdjustFromPoints
which seems to allow to set DefPoint
properly, but it required conversion from 2d to 3d.
_
c.