How to set a ‘View Scale’ in Map 3D using API?

By Partha Sarkar

In AutoCAD Map 3D UI, we can easily change / set the View Scale by specifying a new / custom scale value using the dropdown button next to the "View Scale" as shown in the screenshot below –

ViewScale_01

 

You can achieve the same using Map 3D Platform API AcMapMap.SetViewScale(double scale). Here is a .NET code snippet which demonstrates the same :

// Get the Map Object
AcMapMap currentMap = AcMapMap.GetCurrentMap();
Double viewScale = currentMap.GetViewScale();
ed.WriteMessage("ViewScale Before Change : " + viewScale.ToString());
 
 
// set the ViewScale
viewScale = (viewScale / 100);
currentMap.SetViewScale(viewScale);
ed.WriteMessage("ViewScale After Change : " + viewScale.ToString());

 

And the result you would see after running in the above code snippet :

ViewScale_02

Hope this is useful to you!


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading