Hello!
I’m looking for a Dynamo Graph that applies Station Offset Labels to COGO points in a drawing with multiple alignments. In my case (shown in Situation 1), I have three alignments and COGO points representing sanitary manholes.
I successfully created a graph using the Camber package to label COGO points when there’s only one alignment. However, with multiple alignments, my script only references a single alignment, which is the issue.
How can I modify my Dynamo graph to assign the correct station and offset based on the nearest alignment? The goal is for the graph to identify the closest alignment to each cluster of COGO points and apply the appropriate label. The desired outcome is shown in Situation 1.A.
Any guidance would be greatly appreciated!.
1 Like
Hi @e327815,
You can try to integrate this approach into your dynamo file to find the closest Alignment to each selected COGO Point:
To understand the logic behind what I did, follow this example:
The logic is simple:
- Select COGO Points
- Get All Alignments in the drawing (change the node if you want to select specific Alignments rather than getting all of the drawing’s alignments)
- Use Alignment.Geometry node to have the dynamo representation of an Alignment (Polycurve)
- Use Object.Geometry to get the coordinates of each COGO Point (you may find issues with this node if your “Geometry Scaling” in “Preferences” is not correct, so make sure you set it to the right scaling)
- The key node here is “Geometry.Distance To” in which you should connect the list of Alignments you have and the list of COGO points as inputs.
- Using proper lists levels here is important (L1 for the list of COGO points)
- Once you have the distances of all alignments from each Cogo point you will need to extract the minimum distance from that list (Again proper use of Lists levels is required)
- Once the minimum distance for each point is found, get the index of that element from the original list of distances (the same index represent the Alignment’s index that is the closest to that point)
- Once the index is known, Get the Alignment that has that same index from the Alignments list and BINGO ! Now you have the closest alignment to each point. From there you can use that information in labelling your points.
If this helped, please mark this answer as a solution to your inquiry so that other users can benefit from it. Thanks.
Hi @Aymne.Rzigui,
I implemented your logic into my script and was successful in creating a list which finds me the closest alignment of each point in my drawing.
But I am still trying to figure out how I can use these results as an input for the Camber Node “AlignmentStationOffsetLabel.ByPoint”. This Camber node will ultimately produce what I want (apply Station Offset Labels to Cogo Points in my DWG).
The issue I am running into is that this Camber node only accepts the following inputs/arguments: (1) Autodesk.Civil.DynamoNodes.Alignment, (2) Autodesk.DesignScript.Geometry.Point, (3) Camber.Civil.Styles.Labels.Alignment.AlignmentStationOffsetLabelStyle, (4) Camber.Civil.Styles.Objects.MarkerStyle.
The List.GetItemAtIndex Node in the logic we are implementing here only has an output type of “Autodesk.Civil.DynamoNodes.Alignment”
I feel like we are close but not quite there. Any other suggestions would by very much appreciated!