-
Thanks for PyRx. From a user perspective I would like to be able to execute a command, then pick a point on a filtered entity and an mleader is created with info related to the entity and the point picked. Later I would like to edit the entity and the mleader should move accordingly and update the field information within. When carrying out any edit/erase operations on the mleader everything else should stay intact. Of course when closing/opening the file all functionality should likewise stay in working order. It might be a lot of example to ask, but currently its too distant for me. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
I added a sample to make an associated leader, I had to make some adjustments for BricsCAD, so it should work next build Bricsys and I have very different opinions with regards to fields, I think they are amazing, they don’t feel the need to put in the effort into finishing the API. I have written many evaluators for AutoCAD, SQLField, ExcelField. I think the properties one I posted is super useful. There should be enough API wise for you to create one though |
Beta Was this translation helpful? Give feedback.
-
instead of a MLeader, a normal leader seems to work import traceback
from pyrx import Rx, Ge, Gi, Db, Ap, Ed
def makeTempMtext(db: Db.Database):
fld = Db.Field("%<\\AcVar Filename>%")
mt = Db.MText()
mtId = db.addToCurrentspace(mt)
mt.setField(fld)
mt.setLocation(Ge.Point3d(100, 100, 0))
fld.evaluate()
return mtId
def makeLeaderField(db: Db.Database):
mtid = makeTempMtext(db)
leader = Db.Leader()
lid = db.addToModelspace(leader)
leader.appendVertex(Ge.Point3d(50, 0, 0))
leader.appendVertex(Ge.Point3d(100, 100, 0))
leader.attachAnnotation(mtid)
return lid
def makeLine(db: Db.Database):
line = Db.Line(Ge.Point3d(0, 0, 0), Ge.Point3d(100, 0, 0))
return db.addToModelspace(line)
@Ap.Command()
def doit() -> None:
try:
db = Db.curDb()
lid = makeLeaderField(db)
lineid = makeLine(db)
oref = Db.OsnapPointRef(Ge.Point3d(50, 0, 0))
oref.setOsnapType(Db.OsnapType.kOsnapMid)
oref.setIdPath(lineid, Db.SubentType.kEdgeSubentType, 0)
dimAssoc = Db.DimAssoc()
dimAssoc.setDimObjId(lid)
dimAssoc.setPointRef(Db.DimAssocPointType.kLeaderPoint, oref)
dimAssoc.post(lid)
except Exception as err:
traceback.print_exception(err) |
Beta Was this translation helpful? Give feedback.
instead of a MLeader, a normal leader seems to work