Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to implement zoom in or out the current ModelSpace in AutoCAD like mouse wheel to zoom by using C# .NET API

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
jelly_oy
480 Views, 5 Replies

How to implement zoom in or out the current ModelSpace in AutoCAD like mouse wheel to zoom by using C# .NET API

I want to implement zoom in or out the current ModelSpace in AutoCAD2022 like using the mouse wheel to zoom in or out by using C# .NET API. I use the following code but it just can scale the modelspace to max display all entities. If I want to zoom

in or out the modelspace by custom specific scale, How can I achieve this. My code is below.

editor.Command("_.ZOOM", "_E");

 I would appreciate it if anyone could provide a simple example.

5 REPLIES 5
Message 2 of 6
tramber
in reply to: jelly_oy

Zoom works with :

absolute : n

relative : nx

absolute in paperspace viewports : nxp

 

zoom

3

 

zoom

3x

 

zoom

3xp

 

"_e" stands for "Extend" 

I guessthe answer is 

editor.Command("_.ZOOM", ".5x"); (out)

 

editor.Command("_.ZOOM", "2x"); (in)

Message 3 of 6
TheCADnoob
in reply to: jelly_oy

If you are sending the command (as it looks like) change E to a numeric value. 1 will zoom in by a factor of 1. to zoom out change it to a decimal .1 etc. 

 

You will likely need to adjust those values to something more appropriate to what you are trying to achieve.

CADnoob

EESignature

Message 4 of 6
jelly_oy
in reply to: tramber

hi, Dear friends, Thank you very much for providing various examples, I will try to approach my idea.

Message 5 of 6
jelly_oy
in reply to: TheCADnoob

hi my dear friends, Thank you very much for your reply and suggestion, I will try it by using decimal parameters.

Message 6 of 6
jelly_oy
in reply to: jelly_oy

I use the following two line codes to resolved my problem.

editor.Command("_.ZOOM", "_E");
editor.Command("_.ZOOM", ".2");

Thank you all for reply to my question.

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

Post to forums  

State of Sustainability Webinar


AutoCAD Inside the Factory