New to Dynamo and Python - Manipulating General Properties

Hello Everyone,

I am new to Dynamo and Python but I am diving into learning the software to automate a few things at work. I have made a proof of concept but I am having problems wrapping my head around custom/python nodes.

My first question is, what resources could you guys point me towards for learning the python code for Dynamo for C3D specifically. I have had a look at some other python blocks made by others and still understanding the syntax. I am also working through the Primer for Dynamo.

As far as the script that I am trying to write:

  1. Open CAD drawing that comes in from outside source with outside line work/types/styles. (solved)
  2. Delete all text and mtext objects. (Partially solved. Can easily delete text. Cant identify/select mtext objects yet)
  3. Call on pre-made spreadsheet to get layer associations from their layers to our layers and place into separate lists. (solved)
  4. Transform all object’s layers from theirs to ours from the lists (solved)
  5. Select all objects and change Color, Line Type, and Line Weight to ByLayer from the General Properties. (not solved)

I am wondering if there is a resource or example where I could learn how to interact with the General Properties of objects, and be able to call on new objects that are not in the Object.Type node. I’m pretty confident that if I can learn how to write the above issues then I can stumble through the others that I need.

Thanks for your help,

3 Likes

I would recommend looking at the Civil 3D .NET API Reference in conjunction with looking at Python scripts developed by other users. Try to take note of specific classes and methods they are using, understand the relationship between them, and try to understand the general workflow.

Once you understand how to get the native objects from C3D into Python (see here for an example), it’s just a matter of having a better understanding of the C3D API to really understand how you can manipulate the data.

@Paolo_Emilio_Serra1 has provided various Python snippets on the forum as well if you look through his post history.

6 Likes

This is absolutely the kind of stuff I was trying to find. Thank you!

I have also been following @Paolo_Emilio_Serra1 since I got my hands on Dynamo and trying to dissect his work. The .NET API Reference library should really help make sense of it.

Thanks again,

1 Like

This is not specific to Civil 3d, but check out the Community driven work here: https://github.com/Amoursol/dynamoPython - It comes from 10+ authors, and contains heavily annotated Python to explain exactly what is going on :slight_smile:

It has a bunch of generic Dynamo stuff, and some RevitAPI things… If you wrap your head around the Civil 3d API then this could provide some useful learning material!

The code is 100% copy/pastable into Python to play with inside Dynamo - and looks as below:

Simply navigate to the sub-folder your wish, find something your curious about, and copy/paste it in :slight_smile:

Note: That snippet was from here - https://github.com/Amoursol/dynamoPython/blob/master/concepts/listChunking.py

8 Likes

Perfect, the more stuff for me to sink my teeth into the better.
Thanks solamour!

1 Like