lpseifert Posted February 11, 2010 Posted February 11, 2010 I'm just curious as why entmake doesn't work but a command call to Mtext does This works properly, makes a field displaying the scale of a viewport (vl-load-com) (setq obj (vlax-ename->vla-object (car (entsel "Select Viewport: ")))) (setq fld-txt (strcat "%<\\AcObjProp.16.2 Object(%<\\_ObjId "(vl-princ-to-string(vla-get-Objectid Obj)) ">%).CustomScale \\f \"%sn\">%")) (setq ip (getpoint "Pick insert point: ")) (vl-cmdf "mtext" ip "w" "0" fld-txt "") This places a field displaying the literal string (truncated) (vl-load-com) (setq obj (vlax-ename->vla-object (car (entsel "Select Viewport: ")))) (setq fld-txt (strcat "%<\\AcObjProp.16.2 Object(%<\\_ObjId "(vl-princ-to-string(vla-get-Objectid Obj)) ">%).CustomScale \\f \"%sn\">%")) (setq ip (getpoint "Pick insert point: ")) (entmake (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 10 ip) (cons 1 fld-txt) )) Anyone know why? I'm trying to get away from using command calls. I just tried Mtedit (Dbl-clk) on the 'bad' field and it now displays properly. Go figure.... Quote
Lee Mac Posted February 11, 2010 Posted February 11, 2010 Hi Larry, The FIELD object is stored in a dictionary ("TEXT") which is stored in a dictionary ("ACAD_FIELD") which is stored in the extension dictionary of the text, mtext or attribute. So you'll have to entmake these dictionaries in the mtext extension dictionary, if you decide to proceed with entmake. For this reason, I would normally use vla-AddMText to create the field, or entmake it and use vla-put-TextString on the converted ename. That said, it can be done via entmake, as Tim shows here: http://www.theswamp.org/index.php?topic=20446.0 Hope this helps, Lee Quote
lpseifert Posted February 11, 2010 Author Posted February 11, 2010 Thanks Lee I had seen that thread at theSwamp, it seemed more involved than I wanted to get. Vla-AddMtext seems to work well; maybe I'll goof around with vla-put-TextString (hey... it beats shoveling snow) Quote
Lee Mac Posted February 11, 2010 Posted February 11, 2010 Thanks LeeI had seen that thread at theSwamp, it seemed more involved than I wanted to get. Vla-AddMtext seems to work well; maybe I'll goof around with vla-put-TextString (hey... it beats shoveling snow) I agree - vla-AddMText is a ton simpler in this case Quote
lpseifert Posted February 11, 2010 Author Posted February 11, 2010 Lets see... driveway= 90'x10'x2' deep snow @15 PCF It's about 13.5 tons simpler. 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.