How to return CivilObject (SectionView) in Dynamo for Civil 3D?

I am working with Dynamo for Civil 3D (Civil 3D 2025, Dynamo Core 3.0.x) and trying to create Section Views using a Python node.

I can successfully create SectionView using the Civil 3D API:

CivilSection.Create(name, sampleLineId, point)

However, I am having trouble returning the created SectionView as a CivilObject in Dynamo.

Currently:

  • The Python node creates the SectionView correctly in the drawing
  • But I cannot convert the ObjectId to a Dynamo CivilObject
  • If I output ObjectId → Dynamo crashes or downstream nodes do not work

My goal:

  • Return a valid CivilObject (SectionView)
  • So I can use it with nodes like:
    CivilObject.SetStyle

Questions:

  1. Is it possible to convert SectionView ObjectId → Dynamo CivilObject?
  2. If not, what is the recommended workflow to get a CivilObject output for SectionView?
  3. Should SectionView creation always be done using SectionView.BySampleLine node instead of Python?

Any guidance or examples would be greatly appreciated.

Thank you!

1 Like

:red_question_mark: Is it possible to convert SectionView ObjectId → Dynamo CivilObject?

It’s not possible

Civil 3D does not expose SectionView objects through the CivilObject API in a way that allows a direct cast or conversion. SectionViews simply aren’t wrapped as CivilObjects in the Dynamo environment.

-–

:red_question_mark: If not, what is the recommended workflow to get a CivilObject output for SectionView?

Close this dyn and use another one after using the sections

The practical workflow is:

- Use your current Dynamo graph to create or manipulate SectionViews.

- Save, close, and run a separate Dynamo graph that works with the resulting geometry or data after the SectionViews exist.

This avoids the limitation of not being able to treat SectionViews as CivilObjects.

-–

:red_question_mark: Should SectionView creation always be done using SectionView.BySampleLine instead of Python?

Just try

In practice, the node is more stable and predictable than Python for SectionView creation, but you can experiment. Python can work, but it’s more fragile because the API surface for SectionViews is limited.

1 Like

Dynamo is a .NET wrapper of the host application API, and all nodes are just .NET wrappers. So if Dynamo allows you to do something via nodes, you can most assuredly call the same nodes via other means and get the same result(s). The question is ‘what is the correct call’. Sadly Civil 3D is the only mature Dynamo integration which isn’t open source, so we can’t review what the changes might be. However if you provide a sample graph which does what you’re after (basically what @zieios recommends in his second answer), and are willing to spend some time poking at the exposed portions of the Dynamo for Civil 3D api you can likely start to identify what the methods needed might be.

1 Like

Apologies, as I am still a new member I’m currently unable to send files directly.

Instead, I have attached a screenshot of my Dynamo graph. Would you be able to take a look and advise if there is anything I should adjust or improve?

Thank you very much for your support.

For Section Views, it appears that conversion to a CivilObject can work only when the workflow is split into two steps:

  1. first output the SampleLine, and

  2. then run SectionView.BySampleLine in the next step.

If I try to do this in one continuous process, Civil 3D becomes unstable and may crash/close unexpectedly. So at the moment, the Section View workflow seems to require that intermediate SampleLine step for stability.

By contrast, the Profile View workflow is behaving normally. ProfileView.ByAlignment works correctly with CivilObject.SetStyle, and I have not seen the same instability there.

At this stage, I am not yet sure why Section Views behave differently from Profile Views. My current assumption is that there is a limitation or instability in the Civil 3D Dynamo wrapper/API specific to Section Views, rather than a general issue with the graph logic.

1 Like

Bumped you to a point you should be able to post minimal files. :slight_smile:

Try posting what you’d like to share in ~10 minutes. If it doesn’t work clear your cache and try again.

1 Like

Thanks for your support! I’ve found a solution — I moved it to the Handle for processing, and it’s now working successfully.