linking current dimstyle text size to mtext size

linking current dimstyle text size to mtext size

kenhuse
Contributor Contributor
2,014 Views
30 Replies
Message 1 of 31

linking current dimstyle text size to mtext size

kenhuse
Contributor
Contributor

I have a lisp routine that draws an arc curved leader.

I have added an mtext command at the end.

To start with I would like to have the mtext size match that of the current dimstyle text size.

I should add that within my style dialog box the text size is currently set to 0.00.

Thanks for your help.

 

0 Likes
Accepted solutions (3)
2,015 Views
30 Replies
Replies (30)
Message 21 of 31

Kent1Cooper
Consultant
Consultant

@kenhuse wrote:

.....

Here's a drawing to experiment with. Thanks!


That drawing has apparently had its DIMSCALE System Variable setting changed.  If it's supposed to set the Dimension Style to SIMP1 on selection of one of those pieces of Text circled in hmsilva's image, I just set that as the current Style, and drew another Dimension.  The Text part came out twice as big as those, because I found the DIMSCALE value is 2.  Those Dimensions already in the drawing were apparently drawn with a DIMSCALE value of 1, but that's been changed since.  When I set DIMSCALE [back] to 1, my routine worked to set the Style to SIMP1 on selection of one of those Text objects.

Kent Cooper, AIA
0 Likes
Message 22 of 31

kenhuse
Contributor
Contributor

Good Morning Again Henrique,

I've done an analysis. I went through the dimstyles most often used, changed all the text height to .13.

I also went through each dimstyle and checked to see that under the fit tab, the "use overall scale" weren't rounded off and carried the last repeating digit out at least a half dozen times.

I then went and created text for each scale, sized according to the not rounded off number.

Then I did the most current version of the "demo" lisp.

I had success with: 3"=1', 1"=1', 3/4"=1',1/2"=1', 1/4"=1', 1/8"=1', 1/16"=1', 1"=10', 1"=20', and 1"=40 !!!

However, the routine returned "It was not possible to set current a dimension style from the selected text..." when I used it on: 6"=1', 1 1/2"=1', 3/8"=1', 3/16"=1', and 1"=30'.

I double checked to see that the "use overall scale" on the fit tab was correct on the ones that didn't work. The "use overall scale" for the ones that didn't work are as follows: .1666666666666 for 6"=1', .666666666666 for 1 1/2"=1', 2.6666666666 for 3/8"=1', 5.3333333 for 3/16"=1', and 30 for 1"=30'.

I don't see much of a pattern there.

For the ones that did work, the "use overall scale" were whole numbers except for 3"=1' which is .04333333, and 3/4"=1' which is 1.3333333.

I also looked at the various text sizes for the ones that worked versus the ones the worked and didn't see any pattern there either.

The mystery continues. Thanks again for your time and expertise, Ken

0 Likes
Message 23 of 31

kenhuse
Contributor
Contributor

Good Morning Kent,

I just sent this message to Henrique. I used his most current demo.lsp. ............

I apologize for not having tried the experiment with your .lsp, and will now to see what happens. I'll get back to you on that. However, for the time being here's what happened with Henrique's .lsp.

 

I've done an analysis. I went through the dimstyles most often used, changed all the text height to .13.

I also went through each dimstyle and checked to see that under the fit tab, the "use overall scale" weren't rounded off and carried the last repeating digit out at least a half dozen times.

I then went and created text for each scale, sized according to the not rounded off number.

Then I did the most current version of the "demo" lisp.

I had success with: 3"=1', 1"=1', 3/4"=1',1/2"=1', 1/4"=1', 1/8"=1', 1/16"=1', 1"=10', 1"=20', and 1"=40 !!!

However, the routine returned "It was not possible to set current a dimension style from the selected text..." when I used it on: 6"=1', 1 1/2"=1', 3/8"=1', 3/16"=1', and 1"=30'.

I double checked to see that the "use overall scale" on the fit tab was correct on the ones that didn't work. The "use overall scale" for the ones that didn't work are as follows: .1666666666666 for 6"=1', .666666666666 for 1 1/2"=1', 2.6666666666 for 3/8"=1', 5.3333333 for 3/16"=1', and 30 for 1"=30'.

I don't see much of a pattern there.

For the ones that did work, the "use overall scale" were whole numbers except for 3"=1' which is .04333333, and 3/4"=1' which is 1.3333333.

I also looked at the various text sizes for the ones that worked versus the ones the worked and didn't see any pattern there either.

The mystery continues. Thanks again for your time and expertise Kent, Ken

0 Likes
Message 24 of 31

hmsilva
Mentor
Mentor
Accepted solution

Hi Ken,

could you please test the attached code.

 

Henrique

EESignature

Message 25 of 31

kenhuse
Contributor
Contributor

You're a god! It worked on every one! I'm so stoked. This is really cool.

I don't know how to do kudos. It's probably obvious however I'm new to this sort of collaboration and haven't solved the kodos mystery yet.

You deserve one from me for sure.  Thanks so much! Please tell me how to do kudos too, thanks!

 

0 Likes
Message 26 of 31

kenhuse
Contributor
Contributor
Accepted solution

Hi again Kent,

Henrique sent me another .lsp and it now works on all the dimension styles! Thanks again for your input. Very much appreciated!, Ken

0 Likes
Message 27 of 31

hmsilva
Mentor
Mentor

@kenhuse wrote:

You're a god! It worked on every one! I'm so stoked. This is really cool.

I don't know how to do kudos. It's probably obvious however I'm new to this sort of collaboration and haven't solved the kodos mystery yet.

You deserve one from me for sure.  Thanks so much! Please tell me how to do kudos too, thanks!

 


You're welcome, Ken!
Glad I could help 🙂

 

For the Kudos >>> How do I give Kudos?  and this @philip.s article Getting Started Guide 

 

Henrique

EESignature

0 Likes
Message 28 of 31

kenhuse
Contributor
Contributor

Hello Henrique,

Hope you had a nice weekend.

I hesitate to ask, but am unable to resist, would you mind another tweak on the code?

The .lsp worked well in the "laboratory" but had mixed results in the "field".

The problem has to do with our dimstyle system where certain "use overall scale of" figures are rounded off.

I can circumvent this problem by modifying the dimstyles in each drawing and or resizing the text to the not rounded off figures.

Sorry to say, this is a big time consuming pain which renders the .lsp you created not very useful.

I'm not sure how this tweak could be accomplished. The .lsp fails on the repeating decimal text sizes.

It seems a shame to accept this shortcoming after all the brilliant work you've done.

It's possible that by limiting the number of decimal places (that the .lsp looks for) to 3 will solve the problem.

The repeating decimals in our dimstyle text sizes are variable. Not so great.

If I don't ever hear from you again, I won't hold it against you nor will I be overly surprised.

One way or another, I really appreciate all you've done and feel badly asking for more from your reserve of knowledge, especially since the need results from a inconsistency in our dimstyle system. Thanks again, Ken

 

0 Likes
Message 29 of 31

hmsilva
Mentor
Mentor
Accepted solution

Hi Ken,

just, change

(equal ht (nth 3 x) 1e-6)

to

 

(equal ht (nth 3 x) 1e-3)

 

Hope this helps,
Henrique

EESignature

Message 30 of 31

kenhuse
Contributor
Contributor

Henrique!, Success!!!!! Amazing! Thanks so much! Perfect!

I hope you have a nice week and that your expertise brings you what you most desire!, Ken

0 Likes
Message 31 of 31

hmsilva
Mentor
Mentor

You're welcome, Ken.
Glad I could help. 🙂

Henrique

EESignature

0 Likes