Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DXF code Annotative scale

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
1221 Views, 2 Replies

DXF code Annotative scale

OK- I have a routine that changes text/leader combinations to mleaders, which I'm trying to tweak to keep the text size of the original text/mtext object rather than rely on that of the mleader style. Problem is, dxf 40 returns the model height of the text/mtext, not the "annotative" paper space height. Can't seem to find a code for that. When applied to the new mleader object, ACAD seems to "think" that the model height of the text/mtext is the paper height of the mleader, so the text comes out really really big. So to be tricky, I finally tried multiplying the text model height by the annotation scale value, then applying that to the new mleader object as the height. Seems to be working so far. Here are some code snippets:

To force the text size to the correct annotative text size...

(setq
tsize (dxf 40 mtext2) ; get height of text
cscale (getvar "cannoscalevalue") ; get the current annotation scale (as a value)
tsize2 (* tsize cscale) ; set anno-friendly text height
)


Then to assign the height to the (newly created) mleader:

(vla-put-TextHeight obj tsize2)


Just thought this method might help out if anyone else comes across the problem of annotative text "growing" when working with LISP. Probably going to try and apply this to my Text Align command later this week, which does the same thing for some reason (don't know why- I thought that one just rotated the existing text, but we'll see).

I've also attached the full code if anyone wants to see it in action- thanks go to Lyle Hardin for the original version. I may work on getting it to keep the original text's style as well later this week, but that should be relatively easy compared to this. Right now it takes on the style defined in the MLEADER style, which may be more handy anyhow (especially when cleaning up out-of-house drawings). Have to think about that one.

By the way- sorry for the dxf code/vlisp method mixing- still kind of learning this stuff as I go, and can't always seem to find everything I need in one or the other...
2 REPLIES 2
Message 2 of 3
ebixler
in reply to: Anonymous

 
Message 3 of 3
Shneuph
in reply to: Anonymous

 


@Anonymous wrote:
... So to be tricky, I finally tried multiplying the text model height by the annotation scale value, then applying that to the new mleader object as the height. Seems to be working so far. Here are some code snippets:

To force the text size to the correct annotative text size...

(setq
tsize (dxf 40 mtext2) ; get height of text
cscale (getvar "cannoscalevalue") ; get the current annotation scale (as a value)
tsize2 (* tsize cscale) ; set anno-friendly text height
)

 

Instead of using the drawings current annotation scale you may consider using the scalefactor variable from the leader itself to adjust the size of the new mleader.  In case the drawings current annotation scale isn't the correct scale for the leader.

 

(vla-get-scalefactor (vlax-ename->vla-object (car leader)))

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost