Add Profile Labels to Lines of Profile

I want to add Profile Labels to Lines of multiple Profiles in multiple Profile Views.
Specifically, I want to add the “Standard” Profile Tangent Label Style so that the gradients are displayed.
The result will be something like this:

A standard Civil 3D workflow:

  1. Select a Profile View
  2. Click Edit Profile Labels in the ribbon menu
  3. Select a Profile in the Profile View
  4. In Profile Labels window, choose Lines from the Type dropdown menu
  5. Choose Standard from the Profile Tangent Label Style dropdown menu
  6. Click on Add button
  7. Click Apply or OK

I have found the Profile Line Label Styles node in the Camber package, but I do not know how to apply it. It does not seem to work with CivilObject.SetStyle node, which is the workflow I use for setting the style of the Profile View.

Is there a node to set styles or add labels, or do I need to use a Python Script node?

Any help would be appreciated. Thanks!

Civil3D_ProfileLineAddLabel.dyn (8.7 KB)

Yep, that will be tricky as there is no node for that AFAIK. There are tons of labeling nodes OOTB and in Camber, but not for Profiles tho.

last time i used this with style names hardcoded in the script:

# Load the Python Standard and DesignScript Libraries
import sys
import clr

# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
from Autodesk.Civil.DatabaseServices.Styles import *

# Inputs
profileView = IN[0]
profiles = IN[1]
styleName = IN[2]

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
civDoc = CivilApplication.ActiveDocument

with adoc.LockDocument():
    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
            linestyle = civDoc.Styles.LabelStyles.ProfileLabelStyles.LineLabelStyles["UNI_árok description"]
            PVIstyle = civDoc.Styles.LabelStyles.ProfileLabelStyles.GradeBreakLabelStyles["UNI_A_árok_felirat_szelvény_magasság"]
            lineLabelStyle = t.GetObject(linestyle,OpenMode.ForWrite)
            lineLabelStyle = t.GetObject(PVIstyle,OpenMode.ForWrite)
            for profile in profiles:
                ProfileLineLabelGroup.Create(profileView.InternalObjectId,profile.InternalObjectId,linestyle)
            for profile in profiles:
                ProfilePVILabelGroup.Create(profileView.InternalObjectId,profile.InternalObjectId,PVIstyle)

            t.Commit()
            pass

# Assign your output to the OUT variable.
OUT = lineLabelStyle, lineLabelStyle
2 Likes

You’ll want to use the Label.SetLabelStyle node for setting label styles, not CivilObject.SetStyle.

2 Likes