Hi,
it’s annoying that the new version doesn’t provide backward compatibility. I have scripts created based on Civil3DToolkit. The nodes I used are no longer available, and no replacement is provided, for example DocumentExtension.GetDocumentStyles. I used it to create custom lists with the Data-Shapes package because the built-in lists are insufficient. I think Dynamo from Civil 2025.2 is a change for the worse, and I don’t understand why there is no backward compatibility provided. Now I have to change all the scripts I created, which is frustrating.
2 Likes
There was a post about this package a while ago, there may be OOTB nodes that could easily be replaced.
Future of Civil 3D Toolkit and Camber Packages - Civil 3D - Dynamo
A post was split to a new topic: Pick Point node values seem incorrect
Did you ever find a replacement for the missing DocumentExtension.GetDocumentStyles node?
I created a Python script with ChatGPT’s help
# Load the Python Standard and DesignScript Libraries
import sys
import clr
# referencje Civil 3D API
clr.AddReference("AcMgd")
clr.AddReference("AcDbMgd")
clr.AddReference("AeccDbMgd")
from Autodesk.AutoCAD.ApplicationServices import Application
from Autodesk.AutoCAD.DatabaseServices import OpenMode
from Autodesk.Civil.ApplicationServices import CivilApplication
# === PARAMETR WEJŚCIOWY ===
# przykład w Dynamo: IN[0] = "CorridorStyles"
styleType = IN[0]
# aktywny dokument
doc = Application.DocumentManager.MdiActiveDocument
db = doc.Database
civilDoc = CivilApplication.ActiveDocument
style_names = []
error_msg = None
tr = db.TransactionManager.StartTransaction()
try:
# pobranie głównego obiektu StylesRoot
stylesRoot = civilDoc.Styles
# obsługa zagnieżdżonych właściwości, np. LabelSetStyles.AlignmentLabelSetStyles
parts = styleType.split(".")
current = stylesRoot
for p in parts:
if hasattr(current, p):
current = getattr(current, p)
else:
error_msg = "Nie znaleziono właściwości: " + p
current = None
break
if current is not None:
# jeśli kolekcja ma StyleId (ObjectIdCollection), iteruj
try:
for styleId in current:
style_obj = tr.GetObject(styleId, OpenMode.ForRead)
try:
name = style_obj.AcadObject.Name
except Exception:
try:
name = style_obj.Name
except Exception:
name = str(style_obj)
style_names.append(name)
except Exception as e_iter:
error_msg = "Błąd iteracji kolekcji: " + str(e_iter)
tr.Commit()
finally:
tr.Dispose()
# wynik
if error_msg:
OUT = "⚠️ " + error_msg
else:
OUT = style_names
1 Like
Thank you for sharing this code. I’d like to know what prompt you used for ChatGPT. Also, do you know how to apply the band set styles to the profiles after retrieving the style names?
