Lots of ways to do this. Best will depend on your specific use case. Got a simplified dataset (one line that fails and one that works) and current graph to reproduce the issue?
Test 1.dwg (484.6 KB)
EXGround_Test.dyn (88.5 KB)
So the Test 1 dwg is referenced into a blank drawing then dynamo run in the blank drawing.
Have the workspace scaling at medium and the featurelines are incorrect, change it to small and they are correct.
As a plus - if you could let me know how to style the featurelines so they arent all water (my default) based on their site that would also be appreciated. - As mentioned I dont have the latest versions of the packages that can easily do this so trying to use 2024 packages.
Thanks
Unrelated to the previous work, but I’d be doing you a disservice if I don’t address this.
I don’t recommend drawing a line at 2024 anymore. It made sense for a year or so in some cases when the 2025 products first came out. However now 2024 is in the last 15 months of support so any effort to make this work will need to be updated for new builds very soon. Effectively you’re going to have to go thought he pain of updating all the stuff over the course of this year, so you might as well start now. If the lack of access to the packages is the issue you need to reach out to the person blocking access and explain the situation; they’re then on the hook for either (a) giving you access to the package manager, (b) providing the updated packages, (c) not having the automations you’re building, or (d) owning the risk of continued use of unsupported software. If they are concerned enough about infosec to block package access entirely they won’t chose D; if they want automations they won’t chose c; and so the likely outcome is B, but the ideal is A.
I understand. 100% appreciate it. However…
I don’t see any of this in vain - I am learning. Whether it is out of date in 5 minutes to 5 years I am building my knowledge and familiarity with dynamo if that changes then it changes and I adapt (albeit it slowly, asking lots of questions and making mistakes)
In reality it isn’t as simple as updating to new software; we have to have the software packaged ($$$ + time) then tested ($$$ + time) then rolled out. To put into perspective the last time we updated I think from 2022 to 2024 it took 6 months total. Based on this the company are unable to update every year.
I am one of a few very small cogs in the company doing what I do and although I make it known of the issues I “play with the cards I am dealt”; the cold hard truth is that I do not need dynamo to produce my work; yes it might make small efficiencies here and there but I can live without it. I am pursuing it because I personally can see the value and understand that this is where the industry is progressing; however if I can make those small inefficiencies into larger ones things might change. If I can prove the concept (with what I have now) it is easier to sell later when new tools come out. (Paving the way - if you pardon the civil engineering pun)
I should also say to avoid any mis understanding we wont stop at 2024, we will update; it is just unlikely to be every year.
Regardless thank you for your advise and help
Glad you understand. And I know you can’t ‘move the world’, but if the people doing deployments for you aren’t aware of the timeline (they need to set the labor budget for the year now, if not already) they may need a reminder. Don’t be combative, but let them know they’re running out of time to get that deployment up to date. They also should be aware that 2025, 2026, and 2027 all have .NET changes, so the idea of ‘leaving it for every other year’ is going to cause things to build up to more difficult testing/deployment. This is a strategy shift for all core products as we mvoed from .NET framework (.NET 4) to .NET core (.NET 8 in 2025 and 2026, and .NET 10 in 2027). Also worth noting that .NET core typically has a 2 year support cycle, which means updates may have to happen mid-support span. I’ll let you read the tea-leaves on that.
Will all that’s out of the way…
Fortunately what I provide on the forum is always done with an eye to helping people learn and grow. Towards that end the Python below should help you learn, indicate where you might want to expand things, and explains what is being done on each line. It also runs in the supported default CPython3 engine which should work in all versions until the 2027 product line, at which point it will migrate to the PythonNET engine likely with no issues. Hopefully this helps you along on your computational design journey. Just paste it into the Python editor and you should be off to the races. ![]()
Convert AutoCAD Polyline3d to Dynamo PolyCurve
########################################
############## Properties ##############
########################################
__author__ = 'Jacob Small'
__version__ = '0.1.0'
__description__ = "Converts a AutoCAD PolyLine3d to a Dynamo polycurve where possible, informing the user where not."
__Civil3DBuilds__ = "2026, 2024"
__DynamoBuilds__ = "2.19, 3.6"
__ReleaseNotes__ = "Not tested completely; test thuroughly before implementing in production."
__Dependancies__ = "None"
__Copyright__ = "2026, Autodesk Inc."
__License__ = "Apache 2"
########################################
### Configure the Python environment ###
########################################
# Load the Python Standard and DesignScript Libraries
import sys, clr, traceback
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd') #add the AutoCAD library to the CLR
clr.AddReference('AcCoreMgd') #add the AutoCAD core library to the CLR
clr.AddReference('AcDbMgd') #add the AutoCAD database library to the CLR
clr.AddReference('AecBaseMgd') #add the AutoCAD AEC base to the CLR
clr.AddReference('AecPropDataMgd') #add the AutoCAD AEC properties to the CLR
clr.AddReference('AeccDbMgd') #add the AutoCAD AEC database to the CLR
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import * #imports the entirety of the AutoCAD runtime namespace
from Autodesk.AutoCAD.ApplicationServices import * #imports the entirety of the AutoCAD application services namespace
from Autodesk.AutoCAD.EditorInput import * #imports the entirety of the AutoCAD editor input namespace
from Autodesk.AutoCAD.DatabaseServices import * #imports the entirety of the AutoCAD database services namespace
from Autodesk.AutoCAD.Geometry import * #imports the entirety of the AutoCAD Geometry namespace
# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import * #imports the entirety of the Civil 3D application services namespace
from Autodesk.Civil.DatabaseServices import * #imports the entirety of the Civil3d database services namespace
# import the Dynamo geometry library
clr.AddReference('ProtoGeometry') #add the Dynamo geometry library to the CLR
from Autodesk.DesignScript import Geometry as DG #add the Dynamo geometry class using the alias DG, to ensure no overlap between class calls to the AutoCAD library and the Dynamo library
#########################################
###### Global variables and inputs ######
#########################################
adoc = Application.DocumentManager.MdiActiveDocument
elems = IN[0] #get the elements from the Dynamo environment
if not isinstance(elems, list): elems = [elems] #ensure elems is a list
OUT = [] #set OUT to an empty list which we'll add to as we iterate over the content of elems and then return to the Dynamo environment
#########################################
############ Code goes here #############
#########################################
with adoc.LockDocument(): #lock the document to prevent corruption and keep thing stable as we make API calls
with adoc.Database as db: #get the database
with db.TransactionManager.StartTransaction() as t: #start a transaction so we can interact with the database
for elem in elems: #for each element in the list of elements
obj = t.GetObject(elem.InternalObjectId, OpenMode.ForRead) #get the AutoCAD object from the object ID associated with the Dynamo reference
if obj.__class__ == Polyline3d: #if the object's class is a Polyline 3d perform the offset stuff below
geometryEntity = obj.GetGeCurve() #get the gometry curve
if geometryEntity.__class__ == CompositeCurve3d: #if the geometry curve is a composite curve 3d (which it should be)
acadCurves = geometryEntity.GetCurves() #get the curves from the geometry
netCurves = [] #set netCurves to an empty list
for crv in acadCurves: #for each curve in acadCurves
if crv.__class__ == LineSegment3d: #if the curve is a linesegment 3d
start = crv.StartPoint #get the start point as an AutoCAD point
start = DG.Point.ByCoordinates(start.X,start.Y,start.Z) #convert the autocad point to a Dynamo point
end = crv.EndPoint #get the start point as an AutoCAD point
end = DG.Point.ByCoordinates(end.X,end.Y,end.Z) #convert the autocad point to a Dynamo point
line = DG.Line.ByStartPointEndPoint(start,end) #build a Dynamo line from the start to the end
netCurves.append(line) #append the line to the list of netcurves
try: #try to make a polycurve - using a try here as there are things you can do with a compositeCurve3d which you can't do with a PolyCurve, such as spliting the curve into branches, reverting back over the curve, etc.
polyCurve = DG.PolyCurve.ByJoinedCurves(netCurves,0,False,0) #try to build a polycurve from the various lines
except: #if that fails
polyCurve = traceback.format_exc() #let the user know why
OUT.append(polyCurve) #append the polycurve to the OUT list
else: #otherwise let the user know there is a problem with the composite curve which hasn't been accounted for
OUT.append("PolyCurve3d's geometry isn't composite curve 3d which means you'll need to implement another geometry conversion method around line 64.") #append the informational message to the OUT list
else: #otherwise let the user know there is a problem with the selection
OUT.append("Object isn't a polycurve3d which means you'll need to use different selection or implement another geometry extraction method around line 66.") #append the informational message to the OUT list
t.Commit() #committing the transaction is faster than aborting
pass #passing things along just incase there is stuff underway in the 'with' statement
Thank you @jacob.small - I will let the deployment team know.
Also larger thank you to the python code and explaining each line!