Jump to content

Text Style height & (getvar 'textsize)


Tharwat

Recommended Posts

Hi,

 

I wonder how to get the Text Style height as long as the (getvar 'textsize) is

different than that.

(entmakex 
      (list (cons 0 "TEXT")
               (cons 10  pt)
                 (cons 40 ([color="red"]text style height[/color]))
                   (cons 1  strings)))

 

Thanks

Link to comment
Share on other sites

You know , the problem is that when modifying the Height of Text Style, it's not going to be changed in (getvar 'textsize) as well.

 

So sometimes I change the Height of Text Style to 200 and the (getvar 'textsize) is kept as 0.2 , and when it's used in Lisp that

would be so small. and if I depend on the Text Style, it could disappointed if it is 0.00 .

 

Any idea ?

 

Thanks,

Link to comment
Share on other sites

That's right if I select an entity and get the text height of it.

 

This would be disappointing if the drawing texts' heights are 200. Because the System Variable do not change unless somebody do.

(entmakex 
      (list (cons 0 "TEXT")
               (cons 10  pt)
                 (cons 40 (getvar 'textsize))
                   (cons 1  strings)))

 

This would be also disappointed if the texts' heights are 0.2.

(entmakex 
      (list (cons 0 "TEXT")
               (cons 10  pt)
                 (cons 40 200)
                   (cons 1  strings)))

 

That's why I wonder which text height I have to keep in my daily Lisp specially when drawing are in different scales !

 

Regards

Link to comment
Share on other sites

Personally I'd use this.

 

(setq ots           (vla-get-activetextstyle
                     (vla-get-activedocument (vlax-get-acad-object))
                   )
     CurrentHeight (vla-get-height ots)
     LastHeight    (vla-get-lastheight ots)
)

 

 

but make sure you understand it before using it.

A little trial and error and reading should fix that.

Link to comment
Share on other sites

Thanks Kerry,

 

That must be professional way that I should gather all my strengths to get it understood. :)

 

And what I got right now in a hint, is that codes would get the height of last object in a drawing has

been created, so depending on that object height , the running Lisp would implement in the current drawing. Is that right?

 

Beside that, also you have current text height would be considered as well.

 

I think the error that you indicated to is that in a new drawing when there is no texts heights implemented yet ...... Hope that be right?

 

Thank you once again Kerry,

 

Tharwat

Link to comment
Share on other sites

I just tried this in a new drawing

The result was as expected.

 



(vl-load-com)
(setq ots           (vla-get-activetextstyle
                     (vla-get-activedocument (vlax-get-acad-object))
                   )
     CurrentHeight (vla-get-height ots)
     LastHeight    (vla-get-lastheight ots)
)
(alert (strcat "TEXTSTYLE : "      (getvar 'TEXTSTYLE)
              "\n TEXTSIZE : "    (vl-prin1-to-string (getvar 'TEXTSIZE))
              "\n CurrentHeight : "   (vl-prin1-to-string CurrentHeight)
              "\n LastHeight : "      (vl-prin1-to-string LastHeight)
      )
)

TEXTSIZE in a new drawing.jpg

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