Jump to content

Add one feature to a code snippet - Text Style


ILoveMadoka

Recommended Posts

This code works perfectly in what it does

 

 (if (setq A2 (ssget "_X" '((0 . "TEXT,MTEXT"))))
    (foreach ent (mapcar 'cadr (ssnamex A2)) 
      (vla-put-layer (vlax-ename->vla-object ent) "TEXT")
      (vla-put-color (vlax-ename->vla-object ent) "256")
      (vla-put-lineweight (vlax-ename->vla-object ent) "-1")
      (vla-put-linetype (vlax-ename->vla-object ent) "ByLayer")
    )
  )

 

I want to add a line to also change the text style.

 

I thought it would be as simple as this

 

 (vla-put-stylename (vlax-ename->vla-object ent) "MyPredefinedTextStyle")

 

but that does not work.

 

I've tried a couple of these

 

vla-put-activetextstyle
vla-put-fontfile
vla-put-stylename
vla-put-textfont
vla-put-textfontstyle
vla-put-textstyle
vla-put-textstylename

 

(but not all) so I thought I'd ask.

Am I close or way off base?

 

 

Link to comment
Share on other sites

that's it make sure its not on a locked/forzen layer. might not work if text is inside a block.

 

(vla-put-stylename (vlax-ename->vla-object ent) "standard")

 

also make sure you spelling the named style right.

Edited by mhupp
Link to comment
Share on other sites

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