Is it possible to automatic add/place Civil 3D “Alignment Station Offset Label” object based on the given AutoCAD Block?
for example, I have AutoCAD block place (random) along alignment. and I would like to add “Alignment Station Offset Label” to show setout information e.g. station, offset, northing, easting, elevation.
I was working on this awhile ago but didn’t quite get it polished. The script attached is definitely an example of bad programming practices, but it does work in it’s current state. Maybe you can take it further and perfect it.
Hello, is there way to modify your script, to specify which alignment offset label, Dynamo is drawing ?
For example, in my workspace I have many different label styles and as I understand your script is taking last used one.
Thanks for bringing this up again. It’s been awhile since I posted that example, and I’ve learned some better techniques since then. Here is a better approach using the API instead of calling the command line function. You can specify the label style and marker style.
IN[0] = alignment
IN[1] = station/offset label style name
IN[2] = marker style name
IN[3] = list of insertion points
import clr
clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
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 Autodesk.Civil.DatabaseServices.Styles import *
adoc = Application.DocumentManager.MdiActiveDocument
civdoc = CivilApplication.ActiveDocument
alignment = IN[0]
labelStyleName = IN[1]
markerStyleName = IN[2]
point = IN[3]
def create_align_staoff_label(alignment,labelStyleName,markerStyleName,points):
global adoc
global civdoc
output = []
if not isinstance(points, list):
points = [points]
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
alignmentId = alignment.InternalObjectId
obj = t.GetObject(alignmentId, OpenMode.ForRead)
if isinstance(obj, Alignment):
# Get label style ID
labelStyleId = civdoc.Styles.LabelStyles.AlignmentLabelStyles.StationOffsetLabelStyles[labelStyleName]
# Get marker style ID
markerStyleId = civdoc.Styles.MarkerStyles[markerStyleName]
# Create Point2d from ProtoGeometry point
for point in points:
location = Point2d(point.X,point.Y)
# Create label
label = StationOffsetLabel.Create(alignmentId,labelStyleId,markerStyleId,location)
output.append(t.GetObject(label,OpenMode.ForRead))
t.Commit()
return output
OUT = create_align_staoff_label(IN[0],IN[1],IN[2],IN[3])
Hi @zachri.jensen ,
After I load the StationOffsetLabel.dyn to the system , when select the alignment, nothing happen to my points, what steps did I missing ?
Hi Mzjensen,
I am new to the Dynamo, I try to label station and off by point group, I did use the camber package that you recommend, But at last the label still not show at drawing attached my .dyn file can you help me out
I’m not able to download the files, but from the screenshot I can tell that there are a few missing inputs for the last node. Plug the alignment into the ‘alignment’ port, and then choose a label style and marker style using these nodes.
Thank you very much for this one.
I’m new in dynamo world and I have question…
How to add inputs to show in dynamo player?
And how to change your script to use alignment station offset label styles and marker styles to have list in dynamo player?