.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Get pixel size in current view

1 REPLY 1
SOLVED
Reply
Message 1 of 2
F32
Explorer
1150 Views, 1 Reply

Get pixel size in current view

How can I get the pixel size in current view?

i.e., how many meters a pixel's width in the current view stands for

Tags (2)
1 REPLY 1
Message 2 of 2
Matti72
in reply to: F32

Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
			Editor ed = doc.Editor;

			Point2d screenSize = (Point2d)Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("SCREENSIZE");

			System.Drawing.Point upperLeft = new System.Drawing.Point(0, 0);
			System.Drawing.Point lowerRight = new System.Drawing.Point((int)screenSize.X,(int)screenSize.Y);

			Point3d upperLeftWorld = ed.PointToWorld(upperLeft, 0);
			Point3d lowerRightWorld = ed.PointToWorld(lowerRight, 0);

 The variable Scrrensize gives you the size of the current view in Pixel.

The PointToWorld Function gives you the "bounding box" of the screen in World Coordinates.

 

With this data you should be able to calculate everything you want 🙂

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost