Jump to content

Changing the font File


Olhado_

Recommended Posts

We like everyone to use the same font style, so we created the program below. However, there are a few cases MText especially, where the style and font might be in out of sink and so the font does not change.

 

Is there a way to change the font file, by itself?

 


(defun C:UpdateAllText ( / acadobject acaddocument styleROMANS ssAllText ssCount entText oldText newText)
; Set initial variables
(setq acadobject (vlax-get-Acad-Object))
(setq acaddocument (vla-get-activedocument acadobject))

; Set "Style-Romans" - If Not already created
(setq styleROMANS (vla-add (vla-get-textstyles acaddocument) "Style-Romans")) 
(vla-put-fontfile styleROMANS "Romans.shx") 
(vla-put-height styleROMANS 0.000) 
(vla-put-obliqueangle styleROMANS 0.0) 
(vla-put-width styleROMANS 1.0)


(if (setq ssAllText (ssget "x" '((-4 . "<OR") (0 . "TEXT") (0 . "MTEXT") (-4 . "OR>"))))  ; Get only specific entity 
(progn
(setq ssCount (sslength ssAllText)) 
(while (setq entText (ssname ssAllText 0))
(setq oldText (entget entText)) 
(setq newText (subst (cons 7 "Style-Romans")(assoc 7 oldText) oldText)) 
(entmod newText)        
(ssdel entText ssAllText)      
)))   

(command "Regen")       
(princ)
)           

 

 

I tried using the vlax-put-property command; but I am not sure if there is a property name and if yes what it is. I tried some of the obvious combinations.

 

(vlax-put-property (vlax-ename->vla-object entText)
'fontfile "Romans.shx")

 

I also tried the vla-put-textfont command.

 

 (vla-put-textfont (vlax-ename->vla-object entText) "Romans.shx")

 

 

1) Is what I am trying to do, even possible?

 

2) General Question with vlax-put-property:

Can you simply relate the "property" part of vlax-put-property command to the label on the property palette?

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