0

How can I open a dwg file in autocad and scroll to a specific spot of dwg map by C# winform? Just give coordinates to app and automaticly show and zoom to that spot.

Nalsa
  • 13
  • 5

1 Answers1

1

You can do that by calling the SendStringToExecute(string) command within the Document object. For the string to send to the command line you can figure this out by just opening AutoCAD and entering in a test string. For example if I want to zoom to the point (5,2) I would enter the following into AutoCAD

Z
C
5,2
10

Where Z is the zoom command, C is the center option, 5,2 is the point and 10 is the magnification height. You can then combine this into a string to send to the command line to be executed. As for the data in the string, you can get this data from any means from the user (WinForms, WPF, Console). Note: the line breaks are important for AutoCAD as the signify an execute command action, you must keep them in the string that you send to execute.

Adam
  • 362
  • 4
  • 12