Zoom to a specific location in model space

Good day!
How to zoom to a specific location in model space by using Dynamo for Civil 3D?

Try this (done with CPython so Civil 3D 2022) :

Code:

import System
from System import *
from Autodesk.AutoCAD.ApplicationServices import *

output = "Error"
FirstCorner = IN[0]
LastCorner = IN[1]

command = "zoom\nW\n"+IN[0]+"\n"+IN[1]+"\n"
OUT = command
adoc = Application.DocumentManager.MdiActiveDocument
adoc.SendStringToExecute(command, True, False, False)


Forum_ZoomTo.dyn (34.9 KB)

5 Likes

all the dynamo nodes to get the point as string could have been included in the python node too, but anyway I went with doing it with dynamo

*edit - also I sent this quickly, started using variables and just realized that I didn’t used them on the command so yeah, no the best python code :sweat_smile:

Finally, robust way would be using the view class and not sending a command : Help

4 Likes

Thank you very much!

1 Like