maahee Posted Wednesday at 10:58 AM Posted Wednesday 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 Wednesday at 01:04 PM Posted Wednesday 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 Wednesday at 04:51 PM by Lee Mac 1 1 Quote
Lee Mac Posted Wednesday at 04:52 PM Posted Wednesday 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 Wednesday at 04:53 PM by Lee Mac 1 Quote
maahee Posted yesterday at 08:35 AM Author Posted yesterday at 08:35 AM (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 yesterday at 08:41 AM by maahee Quote
Koz Posted yesterday at 12:37 PM Posted yesterday at 12:37 PM 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 20 hours ago Posted 20 hours ago Another By @Lee Mac Area.lsp look on his web site. https://www.lee-mac.com/arealabel.html 1 Quote
Koz Posted 10 hours ago Posted 10 hours ago 19 hours ago, Koz said: Another simple way is to entmake the mtext with a plain content first, then apply entmod DXF1 with field expression for the mtext. I made mistake, this works only for text. As for mtext, should be: entmakex with plain content and then vla-put-Textstring with the field expression. 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.