Hello Everyone,
I am trying to come up with a solution for a problem that I can easily deploy over varying cases in the future. I made a post, with photos and a dummy DWG on the Civil3D Autodesk forums HERE that should help.
Basically, I want to be able to define 2 (or 3) fixed points on a block. The blocks will always look like the one in my sample file and screen shots (it’s meant to be steel pipe welded together), but can vary in length and arcs. After defining the two constrained points, I want to be able to select a polyline / arc / spline etc… and be able to move the block along the path and have the block rotate to facilitate these two constraint points being fixed to the path.
Hopefully I explained it well enough. I tried doing this with parametric constraints first but I cannot seem to get it working properly.
That is 100% exactly what I meant great work!
Can you upload your dyn file so that we can investigate what went wrong in it? It’s much easier then
1 Like
Hi Patrick,
Thank you for the reply. I admittedly do not have a dyn file worth showing at this point. I’ve been trying to add 2 point parameters to my block and then select them within dynamo nodes to transform them along the selected path. At least that’s how I’ve been approaching the problem but at this stage it’s more reading the node descriptions and trying to piece together a plan
Well, I understand you, but the standard approach at the forum is that user will get better respond if user add some pictures or file that shows what they have made or tried. This because everything is based on the communities goodwill and hard work to learn Dynamo all by them self and on their spare time.
So if you have anything it will help us to help you.
This is what I have so far. So far the only thing that works is the slider to select the point along the polyline.
I am currently trying to extract the local constraint points and convert them to world coordinates. I’ve used the Point.ByCoordinates node and extracted the local X and Y of the points I’d like constrained to the polyline. Issue is I don’t fully understand how to now get these into world coordinates and then use those coordinates to transform the blockreference along the polyline
EDIT. Ok I believe I have my two constained points in a world coordinate system now. Watch nodes in the image depicting local vs world coordinates
1 Like
The first thing I would recommend is to make some changes to the block definition. Currently the insertion point is very far away from the geometry, and it has an atypical rotation. Something like the below will make it much easier to work with.
With that setup, then you can draw a circle centered at the first rotation point that passes through the second point. Intersect that circle with the path curve, and you have the two points that you need to define the rotation of the block reference.
Hope that helps!
BlockRotate.dyn (47.4 KB)
TemplateRotate.dwg (901.5 KB)
4 Likes
Thank you!
Yes I did notice the insertion point was very far away as well. I did change the insertion point to make it easier.
Just for my own learning, would the method I was trying to do work as well? Basically what I was trying to do is the following:
- Get the local coordinates for the two points I want to be fixed to the polyline
- Transform their location to world coordinates
- Using the Curve.PointAtParameter + Geometry.ClosestPointTo, find the point on the polyline that is closest to the given point
- Create a New Coordinate System for Each Constrained Point. I was struggling here.
Ultimately I was trying to use the two points from the block, find their corresponding location on the polyline, and transform it accordingly to the param slider I attached to my Curve.PointatParameter node
Quite possibly! Unfortunately I won’t have time to dig into your approach, but as with most things, there are lots of potential solutions. Definitely give it a go and see if you can find ways to adapt/improve
1 Like
Appreciate the reply.
I am getting an error though when I try to apply your method to a real world scenario. I initially encountered the error that told me to turn up my geometry sampling to extra large (the polyline is about 3 kilometers in length)
After doing that I get the error " Warning: Object.get_Geometry operation failed. Unable to create Line. Points are likely coincident" on the Object.Geometry node right after selecting the polyline.
EDIT: It’s very odd, if I copy the polyline in question over to a fresh drawing it works fine.
The best practice is to leave the geometry scaling set to Medium even though the warning indicates otherwise. It is only a warning (not an error) and the graph should run fine.
No timeline for a fix at the moment.
1 Like