maahee Posted yesterday at 10:58 AM Posted yesterday at 10:58 AM (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 yesterday at 01:04 PM Posted yesterday at 01:04 PM (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 yesterday at 04:51 PM by Lee Mac 1 1 Quote
Lee Mac Posted yesterday at 04:52 PM Posted yesterday at 04:52 PM (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 yesterday at 04:53 PM by Lee Mac 1 Quote
maahee Posted 15 hours ago Author Posted 15 hours ago (edited) ;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq mtext (vla-AddMText mspace (vlax-3d-point pt) 0.0 ; width (0 for default) (strcat "%<\\AcObjProp.16.2 Object(%<\\_ObjId " (itoa (vla-get-ObjectID entity)) ">%).Area \\f \"%lu2%pr2%ps\">%") ) ) ;; Set properties (vla-put-Layer mtext "mtext") (vla-put-Height mtext 0.3) (vla-put-AttachmentPoint mtext 5) ; Middle-center (vla-put-InsertionPoint mtext (vlax-3d-point pt)) (vla-put-StyleName mtext "Standard") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; I am replacing entmakex with vla-addmtext and have completed the task. I want to apply various text properties, such as bold, underline, color, style, height, etc.............................thank........................... Edited 15 hours ago by maahee Quote
Koz Posted 11 hours ago Posted 11 hours ago Another simple way is to entmake the mtext with a plain content first, then apply entmod DXF1 with field expression for the mtext. 1 Quote
BIGAL Posted 58 minutes ago Posted 58 minutes ago Another By @Lee Mac Area.lsp look on his web site. https://www.lee-mac.com/arealabel.html 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.