Jump to content

Recommended Posts

Posted

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....

Posted

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

Posted

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)

Posted
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)

 

I agree - vla-AddMText is a ton simpler in this case :)

Posted

Lets see... driveway= 90'x10'x2' deep snow @15 PCF

It's about 13.5 tons simpler.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...