Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Automatic placement of assembly and subassembly points at stations by csv

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Thomas.nowakNUQZB
642 Views, 2 Replies

Automatic placement of assembly and subassembly points at stations by csv

Hello, first post!

 

I am toying around with the idea of creating a script that would use a csv file to automatically create an assembly at every station specified, with a subassembly template placed and then its points modified based on the x,y point coordinates in the csv.

 

The structure of the csv file would be: ({Station} > {{Point ID}, {X}, {Y}}), so at station 1000, there would be 24 unique point rows, each with an X,Y specification, then the next station, with 24 more rows, and so on, to modify the subassembly template.

 

This would be my first serious attempt at coding my own script file, so I would like to inquire if what I'm asking is even doable. I have created pseudo-code to better explain what my goal is (yes, haha, my pseudo is also unbearable):

Sub_template = Subassembly.import(subassembly.pkt) 	\\get my subassembly template file

Prop_table = Loadfile(properties.csv)		\\import table of values
Prop_table.columns = {Station},{Point_No},{X_from_origin},{Y_from_origin}	\\what each column contains

Dim My_align as alignment.select		\\select alignment

for each Station in Prop_table			\\for every station,
	My_align.Station.CreateAssembly		\\Create an assembly
	Sub_template.place(0,0)		\\Place the subassembly template at the origin
	for each Point_No where Station == Station.current	\\replace the x and y values for every point respectively
		Subassembly.Point_No.X = Station.Point_No.X_from_origin	\\until all points have been changed based on the csv
		Subassembly.Point_No.Y = Station.Point_No.Y_from_origin
	next
next

for each Station in Prop_table		\\Merge all regions to create a continuous corridor
	Station.Assembly.Merge.ToNext   \\(this is a moonshot, but it would also be great if this could be done)
next
		

The result of this pseudo-code would be to have a corridor with tens of assemblies, each with modified points.

 

Has anyone attempted something similar to this before? I have tried researching the C3D developer's guide but I get stuck on modifying the points of my subassembly based on the coordinates that I specify in my csv. So far, the only way I have been successful in changing subassembly points is by selecting the assembly, then modifying the parameters. 

2 REPLIES 2
Message 2 of 3

Answered my own question: Got it working in Dynamo! Thanks Dynamo team!

 

https://knowledge.autodesk.com/support/civil-3d/learn-explore/caas/CloudHelp/cloudhelp/2020/ENU/Civi...

Message 3 of 3
Anonymous
in reply to: Thomas.nowakNUQZB

The above link appears to be broken. Can you re-post?

Thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report