import sys
import clr
clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry')
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
from System.Collections.Generic import Dictionary
adoc = Application.DocumentManager.MdiActiveDocument
cdoc = CivilApplication.ActiveDocument
from Autodesk.DesignScript.Geometry import *
def get_sample_line_info(sampleLines):
global adoc
global cdoc
output = []
if not sampleLines:
return
if not isinstance(sampleLines, list):
sampleLines = [sampleLines]
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
#bt = t.GetObject(db.BlockTableId, OpenMode.ForRead)
#btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
for sampleLine in sampleLines:
vals = []
bt = t.GetObject(db.BlockTableId, OpenMode.ForRead)
btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
sampleLineId = sampleLine.InternalObjectId
obj = t.GetObject(sampleLineId, OpenMode.ForWrite)
obj.ReverseCurve()
output.append('Success')
#if isinstance(obj, SampleLine):
#output.append(obj)
t.Commit()
return output
OUT = get_sample_line_info(IN[0])
@mzjensen Is there an order the polylines need to be created? How does dynamo know that the bottom polyline will be C-Street and the top polyline will be A-Street and not the other way around?
In this particular example there isnât a method of sorting the Polylines. The example was more intended to be illustrative of how to create multiple Alignments. You could certainly add some type of sorting routine (e.g. sort the curve start points by increasing X and/or Y values) to follow whatever naming convention you need.
If there is no sorting applied, then the objects will be selected in Dynamo in the order they were created. In other words, the most recently-created object will be at the bottom of the list.
Thanks @mzjensen
In order to re-use the multiple alignment script, it will be better to draw the polyline, then fill up blanks on the Excel spreadsheet, right? Otherwise, I can sort the curve start points by increasing X and/or Y values) to follow whatever naming convention I need, but the script will be only for a particular projectâŠ
Pulling the information from an Excel spreadsheet may not be needed in your particular case. It depends on the workflow youâd like to have. Again, the purpose of this graph was to illustrate a general concept. Like you said, determining a naming convention for the alignments is likely a project-specific task. If you want to give the user control of the order, one idea would be to use the Select Objects node from the Civil 3D Toolkit and tell the user to select the polylines in the order that they want.
@mzjensen This is excellent thank you so much for your help. I was able to use your script and add a little bit of my own. I can generate alignments, existing ground profiles, and profile views in one run, with the idea of using the script in multiple projects. Thanks for sharing your knowledge.
Hello people, Someone could help me with this node? In my case i am extracting a polyline from corridor feature line. After that a want to create an alignment for each polyline extracted. What I do not understand is that sometimes the node works and sometimes do not, even with the same inputs, in this last case the node only gives me null values without an error message. @mzjensen
Mod_Dre-SUP_Corredor_Polyline2.dyn (475.8 KB)
@KairoFilipe that node is from the Civil 3D Toolkit, so there might be information in the log file. Look in your user temp folder (the file name says âCivil 3D Toolkitâ in it) and see if there is any relevant info.
Hi, CreaciĂłn de mĂșltiples alineamientos a partir de polilĂneas en Dynamo para Civil 3D - YouTube I hope it can work for you too.
could you help me when I use this script to make multiple alignments in civil 3d 2022.2 is ok
but in civil3d2021.3.2 some alignments donât match with its polyline such in picture>>> Thanks in advance @mzjensen
Hi
Can you attached example drawing
Thank you flatten is the right way but can I do it with dynamo
TRY
USE SendCommand