Jump to content

Recommended Posts

Posted

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

Posted

Would you please ask the question again, stating exactly what you want.

Posted

Thanks Kerry,

 

I would like to get the current text height that included within my text style list .

 

Regards,

 

Tharwat

Posted

current textheight is (getvar "TEXTSIZE")

but,

it will depend on the last style used.

Posted

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,

Posted

In the textStyle definition look at

DXF 40

Fixed text height; 0 if not fixed

 

DXF 42

Last height used

Posted

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

Posted

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.

Posted

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

Posted

Try it !!!

Open a new drawing and run my code icon3.gif

Posted
Did I get it well ? Please tell me.

 

Did you get what ??

Posted

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

Posted

Kerry, You are GREAT.

 

I feel speachless. You are doing a very special kind of lisp techniqe .

 

Best regards,

 

Tharwat

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