Get alignment names in document and export to excel - change - import back

I am very new to Dynamo,

I would like to get all the alignment names listed and then export them to excel, change the names of the alignments, import back in civil 3d and create new layers for each alignment.

I get it to work if there is only one alignment in the drawing, to change the name and create new layer, but not for a bunch of alignments

Could anybody help me, please

Thanks

Can you post the graphs you’re using now? Making things work for many items is usually just a matter of adjusting the lacing and list levels.


Thanks,

Herewith the graph which only works on the first alignment name, the others is not even worthwhile to add!!

Well that’s not much…

For getting the current names into Excel:

  1. Look into Civil section of the library, under selection. There is something there for getting all alignments in the document.
  2. Once you have all the alignments in the document in Dynamo, in the Alignments section of the library for the “Name” property.
  3. Chop that list into a sublists with only the name in it (List.Chop node with a length of 1).
  4. Write out to excel using the OpenXML write node (search OpenXML and you should only have two options).

Then open the file in excel. The current names should be in column A; you put your new name into column B.

For the renaming from the Excel:

  1. Look into the OpenXML node for importing the excel data.
  2. Transpose the lists of data so instead of being pairs you’ll get a list of original names and a list of new names
  3. Take the first list (the original names) and look in the Selection section of Civil 3D to find a node to get alignment by name from the document.
  4. Take the selected alignments and wire them into the CivilObject.SetName node, and use the new names from the second list from the transpose (step 2) as the new name.
  5. Use the same Object.SetLayer as before, but with the new names (again list 2 of step 2).
2 Likes