In Revit, there’s a Dynamo node to save documents, but I couldn’t find a similar node in Civil 3D Dynamo. Does anyone know if there’s a node available with this function?
Same question for the closing a document.
In Revit, there’s a Dynamo node to save documents, but I couldn’t find a similar node in Civil 3D Dynamo. Does anyone know if there’s a node available with this function?
Same question for the closing a document.
Thanks that works! There is also a situation were i just want to close the DWG without saving the DWG. When i send the “close” command i get this pop-up. Is there a way to bypass this popup?
I am trying to create a Python node with doc.CloseAndDiscard()
# Load the Python Standard and DesignScript Libraries
import sys
import clr
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
def close_dwg_without_saving():
# Get the active document
doc = Application.DocumentManager.MdiActiveDocument
# Check if a document is open
if doc is not None:
# Close the current document without saving changes
doc.CloseAndDiscard()
I am not sure that Dynamo/civil 3D will be stable if you close the active document, as it is required to send/receive commands. This might crash your system on command if it works, so just be ready for that.
if you are working a “new file”…I.e., “Drawing1.dwg” which launches at the start of each session.
This file is unsaved. There is not a way to avoid that pop up while working with a drawing that has not been saved.
so you might need to save it somewhere as a junk file, then the close command would work.