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

Zoom to nearest scale.

22 REPLIES 22
Reply
Message 1 of 23
Anonymous
519 Views, 22 Replies

Zoom to nearest scale.

Please help if you can. Here is what I am looking for:

When I am in paperspace and I zoom in on something I want to be able to type a command and then the viewport zoom to the nearest scale.

I am also looking for a way to update my text height based on the vpscale. Type a command and select the text and your done.

Any help would be greatly appreciated. Thank you!!!
22 REPLIES 22
Message 2 of 23
Anonymous
in reply to: Anonymous

Come on people, please!!!
Message 3 of 23
Anonymous
in reply to: Anonymous

Do you know how to write lisp routines? Make a list of the scales you use, then check the vp scale against the ones in your list. Find the closest one, and zoom to that, then get a variable to scale the text height by, and select the text then.

That is how I would do it, I think.
Tim
Message 4 of 23
Anonymous
in reply to: Anonymous

I don't know too much about lisp routines, just thought someone might have something I could work with. Thanx for the reply.
Message 5 of 23
Anonymous
in reply to: Anonymous

Hi cafers

Here is a little lisp that seems to do the trick for viewport scale.
I have made some assumptions regarding possible scales.
You can adjust the scales or add or remove scales as you need. Ask me if you need and I will tell you where to do this. It shoul dbe metric or imperial sensitive but relies on the system var "measurement" for this!

command is C:VPSC
Cut and paste the code to your acaddoc.lsp
OR
save the file in your support directory and add
(load "vpscale.lsp") to your acaddoc.lsp

Let me know how it goes.

I will do something with the text height shortly...

Regards
S
Message 6 of 23
Anonymous
in reply to: Anonymous

Wow, awesome Sherm. Thanx a lot, I will have a look at this and let you know how it goes! Thanx again!!!
Message 7 of 23
Anonymous
in reply to: Anonymous

I have added a command c:cth to change the text height.
It will only work in a PS viewport and I am not very good with the whole imperial thing so at the moment it defaults to 2.3mm (which you can change) BUT you can enter an imperial distance. When I get more time I might make it smarter. Or if someone else wants to have a go.
Also if you pick MTEXT it reformats the text automatically but if you select multiple lines of DTEXT it won't. that requires a lot more lisp processing that I don't have time to add right now.
Anotherthing to watch out for is with leaders: if the leader and MTEXT are not associative then the relative position of the leaer and text might change (just more lisp required)

If anyone else can do better I won't be offended 😉

Good luck
S
Message 8 of 23
Anonymous
in reply to: Anonymous

Thank you so much for the vpscale lisp...it works great. I do have one question though. I notice that when you use it, it tends to zoom to the closet scale below instead of the closest scale overall. For example, I zoom in on a drawing that I want at 1/16" scale but I am too far out for it to be 1/16". Type vpsc and it scales it down to 1/32" scale instead of zooming in to 1/16". Is there any easy way to make this work?? I hope I am making sense.
Message 9 of 23
Anonymous
in reply to: Anonymous

Try this....
Message 10 of 23
Anonymous
in reply to: Anonymous

Thanx, that works better. I don't want to bother you more but....now it will only zoom and not out to the closest scale. Is there any way for it to do both?? I feel like I am asking a lot from you so if you done with this thats cool.
Message 11 of 23
Anonymous
in reply to: Anonymous

Is this better?.....
Message 12 of 23
Anonymous
in reply to: Anonymous

Thats awesome!!! Thanx Sherm.
Message 13 of 23
Anonymous
in reply to: Anonymous

Hey!! Just wondering if there is any way to change the update text height command so that it will also update the dimension text at the same time. I tried to get this to work from the one command but have not had any luck...think you can help??
Message 14 of 23
Anonymous
in reply to: Anonymous

Have been away!
I will have a look into it but very busy so give me some time...

Unless someone else can beat me to it...
Message 15 of 23
Anonymous
in reply to: Anonymous

What about this....

c:cth will also do dimensions...
Message 16 of 23
Anonymous
in reply to: Anonymous

I can't seem to get it to work. Does not do anything for my dims. I just want to somehow add this command:

(defun c:update()
(command "dimstyle" "apply")
(princ)
)

Within the CTH command. Or is that what you did?? Or is that even possible?? You got to forgive me, I am Lisp challenged. Thanx!!!
Message 17 of 23
Anonymous
in reply to: Anonymous

I probably need a bit more information about how your dims are set up.
I may have incorrectly assumed yours are the same as mine.

The dimension text height can be defined in two ways:
1. Set the text height for the dimension text style to 0 and set the sysvar "dimtxt" to the required height.

2. set the text height for the dimension text style to something greater than 0 (dimtxt has no effect)

Which way do you have it?

Perhaps some more info about your dim and text styles would help.

Regards
S
Message 18 of 23
Anonymous
in reply to: Anonymous

I think we are using option 2. It automatically adjusts my dimensions to suit my viewport, sometimes I need to update it though so it would be nice to do that while I update the text height. I just have that box checked that says "Scale dimensions to layout (paperspace)" for my current dimstyle. It works fine, just want to add that update command so I don't have to update the text with CTH and the use the update command for the dims. Hope that helps.
Message 19 of 23
Anonymous
in reply to: Anonymous

Hmmm...
Sorry but I have never done dims that way!
So I am not 100% sure what I need to do...

If you type in a new text height using c:cth then do you want the text height for your dimension text style to be changed to the new height and then the selected dimensions updated?

I am guessing the lisp will need to:
1. check the text style for each dimension
2. change the text height for that text style
3. update the dimension

Does that sound right to you? How are you setting the text height for your dims now (before c:cth)?
Message 20 of 23
Anonymous
in reply to: Anonymous

It changes it automatically. Maybe it's not the best way to do it. I just want to combine the update command that comes with my express tools into that CTH command. That update command I wrote previously does the job, just want to paste that in your CTH command but don't know where to put it.

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

Post to forums  

Autodesk Design & Make Report

”Boost