Error when running Dynamo script via Civil 3D 2020 Batch Save Utility

Please help.

When the dynamo script runs via Batch Save Utility, it will save failed. (The log is showing “save failed(errorno:-1073741571)”)

However, the dynamo script can be successfully run via the Civil 3D dynamo platform. I guess Python may be the issue when using Batch Save Utility?

Below is the Python used inside the Dynamo script for getting the information from the pressure pipe network:

import sys
import clr

Add Assemblies for AutoCAD and Civil 3D APIs

clr.AddReference(‘acmgd’)
clr.AddReference(‘acdbmgd’)
clr.AddReference(‘accoremgd’)
clr.AddReference(‘AecBaseMgd’)
clr.AddReference(‘AecPropDataMgd’)
clr.AddReference(‘AeccDbMgd’)
clr.AddReference(‘AeccPressurePipesMgd’)
clr.AddReference(‘acdbmgdbrep’)
clr.AddReference(‘System.Windows.Forms’)
clr.AddReference(‘Civil3DNodes’)

Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class

import Autodesk.AutoCAD.ApplicationServices.Application as acapp

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 for Civil 3D

from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

adoc = acapp.DocumentManager.MdiActiveDocument
ed = adoc.Editor
civdoc = CivilApplication.ActiveDocument

PROFILE_VIEWS = IN[0]

def move_labels(PROFILE_VIEWS):
if not hasattr(PROFILE_VIEWS, “iter”):
PROFILE_VIEWS = [PROFILE_VIEWS]

error_report = None
all_resp = []
all_resf = []
all_resa = []

try:
    with adoc.LockDocument():
        with adoc.Database as db:
            with db.TransactionManager.StartTransaction() as t:
                for PROFILE_VIEW in PROFILE_VIEWS:
                    sampleLineId = PROFILE_VIEW.InternalObjectId
                    objVIEW = t.GetObject(sampleLineId, OpenMode.ForWrite)

                    resp = []
                    resf = []
                    resa = []

                    for i in objVIEW.GetPipeIds():
                        objpp = t.GetObject(i, OpenMode.ForWrite)
                        resp.append(objpp.Name)

                    for i in objVIEW.GetFittingIds():
                        objpf = t.GetObject(i, OpenMode.ForWrite)
                        resf.append(objpf.Name)

                    for i in objVIEW.GetAppurtenanceIds():
                        objpa = t.GetObject(i, OpenMode.ForWrite)
                        resa.append(objpa.Name)

                    all_resp.append(resp)
                    all_resf.append(resf)
                    all_resa.append(resa)

                t.Commit()
except:
    import traceback
    error_report = traceback.format_exc()

if error_report is None:
    return [all_resp, all_resf, all_resa]
else:
    return error_report

OUT = move_labels(PROFILE_VIEWS)

Similar Case:


Test_Pressure Pipe Network.dyn (131.6 KB)

Hello,

I only have Civil 2025.1, these Nodes (from Packages Civil3DToolkit/ IronPython?) are a problem as far as I can see… Sorry can’t test in 2020 version.

Does your script for the Batch Save Utility look something like this picture below?

Good Luck, maybe someone can help you better!

@zachri.jensen Could you please check the issue?