Could we add/place civil 3d "Alignment Station Offset Label" object?

Hi All,

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.

Thanks,
S

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.

StationOffsetLabel.dyn (27.6 KB)

4 Likes

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.

Hi @Cheer,

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

StationOffsetLabel.dwg (894.2 KB)
StationOffsetLabel.dyn (19.0 KB)

StationOffsetLabels

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])
10 Likes

@Cheer @SchnGrng check out Camber, my new package for Civil 3D. There are some nodes for creating Alignment labels.

2 Likes

Gold! :1st_place_medal:

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 ?

Thank You

Can you provide more info? Either upload the .dyn file or share some screenshots.

Hi Zachri,

Thank you for the quit turn around. Please see attached drawing and point data.

Thank you

image001.jpg

(Attachment C06 OBT Granite edge Pnts.csv is missing)

(Attachment C06 IBT Granite edge Pnts.csv is missing)

test point label style with STA OFFSET.dwg (1.25 MB)

@alamRAST2 please check your post and try again.


Here as you can see I select of alignment.

What problem are you actually observing? The screenshot is not clear. There appear to be several labels created.

Also, it looks like you are using the Python script. I recommend using the nodes from the Camber package as mentioned above.

Thanks

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

Processing: test point label style with STA OFFSET.dwg…
Processing: AL_StationOffsetLabel.dyn…

Thank you

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?

Right click on the node and check ‘is input’.

Not sure what you mean by the other question though.