maahee Posted 9 hours ago Posted 9 hours ago (defun c:bm () ;code;;;;;;;; (setq s (car(entsel))) (if s (progn (setq ar (vlax-ename->vla-object s)) (setq area (vla-get-Area ar)) (setq p (getpoint "\nselect point")) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 p) (cons 40 0.3) (cons 71 5) (cons 1 (strcat "%<\\AcObjProp.16.2 Object(%<\\_ObjId " (itoa (vla-get-objectid ar)) ">%).Area \\f \"%lu2%pr2%ps\">%" ) ) (cons 7 "Standard") (cons 73 1) ) ) ) ; end progn ) ;code;;;;;;;; ) This part of the code displays the object area as: <\AcObjProp.16.2 Object(%<\_ObjId 2401165245680>%).Area \f "%lu2%pr2%ps" in AutoCAD model space. If you double-click on the text, it will show the object area. (example 100.00) Quote
Lee Mac Posted 7 hours ago Posted 7 hours ago (edited) If you wish to entmake a field, you need to also entmake the FIELD entity within the TEXT entry of the ACAD_FIELD dictionary found within the extension dictionary attached to the entity - this is theoretically possible, but a lot of work and wheel reinvention. Instead, if you either create the MText object using vla-addmtext or convert the MTEXT entity into a VLA object and set the textstring property to a field expression, the CAD platform will automatically parse the field expression and configure the corresponding dictionaries for you. Edited 3 hours ago by Lee Mac 1 1 Quote
Lee Mac Posted 3 hours ago Posted 3 hours ago (edited) But if you were curious as to what the entmake route looks like - consider the following thread: https://www.theswamp.org/index.php?topic=20446 Edited 3 hours ago by Lee Mac 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.