Change Alignment Type From Center Line To Curb Return Using Object Parameters

Is there a reason this did not work? I selected an alignment. The ObjectExtensions.GetParameters node reveals that there is an “AlignmentType” parameter. When I run this script, it does not produce any errors but it also does not change the AlignmentType in CAD.

Hi @austin_perigee,

The reason that doesn’t work is because the object type for the AlignmentType property is not a string. That ObjectExtensions.GetParameters node is powerful because it lists all of the properties of a particular object, but the downside (or maybe just confusion) is that it just spits out the property values in whatever format they are under the hood. So even though the value looks like a text string that says “Centerline,” the actual object type is Autodesk.Civil.DatabaseServices.AlignmentType.Centerline, which is an enumeration.

The only way to set the property value is to give it the correct object type, which is why passing a string doesn’t do anything. In any other context you would get an error, but the ObjectExtensions.SetParameterValueByName just swallows any errors and returns the original object on both failure or success.

So, in summary, you’ll need to set the value using a Python script.

Gotcha. That makes sense. Is the object type I would like to set it to something like Autodesk.Civil.DatabaseServices.AlignmentType.CurbReturn in Python?


It appears that Autodesk.Civil.DatabaseServices.AlignmentType.CurbReturn is an actual Object Type. This code runs, but again does not change the alignment in CAD. Is there something in my code that I should fix? Thanks for your help

Sorry, Austin, I completely forgot that this property is actually read-only and can’t be changed. Same discussion from a year ago :wink:

1 Like

Got it. I was trying to find a back way of doing it, but it sounds like it’s not doable for now. Thank You though!

Correct. Dynamo is just an interface on top of the Civil 3D API. If there isn’t a mechanism available in the API to do it, then it can’t be done, whether by Dynamo or some other tool.

1 Like