Coordinate System, invalid rotation values. Block Reference Instances

I am creating coordinate systems to orient block instances on different locations. I have tried to build the coordinate systems with different methods, civil3Dtoolkit & python, most of the time the orientations are not working, giving a warning about the block “Warning: The block requires uniform scaling”. If slightly rotate the coordinate system, the outcome is valid. in the images, the green lines are the block reference.

I have tried to normalize the vectors to build the coordinate system but is not working. Does anyone has any idea about why this is happening?

Cheers,

Can you attached example drawing & dyn file

I can’t upload files, but this is the portion to generate the coordinate system.

Inside the python component you can find the following:
rotation_angle = IN[0]

Fixed Values for Origin and Axes

origin_x = 0
origin_y = 0
origin_z = 0

Define Direction Vectors (unitized)

x_axis = Vector.ByCoordinates(1, 0, 0)
y_axis = Vector.ByCoordinates(0, 1, 0)
z_axis = Vector.ByCoordinates(0, 0, 1)

Rotate the X and Y axes around the Z-axis

x_axis = x_axis.Rotate(z_axis, rotation_angle)
y_axis = y_axis.Rotate(z_axis, rotation_angle)

Create the new coordinate system

new_coordinate_system = CoordinateSystem.ByOriginVectors(Point.ByCoordinates(origin_x, origin_y, origin_z), x_axis, y_axis, z_axis)

OUT = new_coordinate_system

Hola Amigo @Francisco.OrtizN86AJ buenas. Check well the structure of the Coordinate System is quite complex, I do not read phyton I can not help you with that, another node that does exactly the same but with separate imputs is BlockReference.Create I would not waste much time creating a phyton to make it work the one whit Coordinate System but I leave it to your criteria, I hope it helps!

Hi Gilberto, thanks for your feedback. I know this native component works under specific circumstances, but when I try to do something more complicated, it wont perform properly, that’s why I have tried different methods to create Coordinate Systems having no success so far.


In the image you can see how the coordinates system are created along the polycurve, but if I want to insert block instances on them, some are not valid.

Cheers,

What is the warning? Likely best to start there as if the OOTB node fails your Python code may fail the same way if the issue isn’t taken into account.

The warning is about the uniform scaling of the block, I checked already in the properties of the block. The funny thing is that the Coordinate System works in some orientations and not in others, the block to be inserted is the same. I have tried creating the coordinate system with different methods, native components, and custom components, yet the conditions where the coordinate system is valid or not are not clear. In the first image you can see how if the rotation of the element just 0.01 degree more, it will be valid. If the line is straight, it would not be an issue, the problem is when the line has different orientations, like in the previous screen shot.

Cheers,

Hi @Francisco.OrtizN86AJ,

Can you try changing the block definition to NOT have uniform scaling?

Can you provide a simple DWG with just a single curve to populate coordinate systems on, and the block to populate?

I’m wondering if this is a floating point error caused by converting from a Dynamo coordinate system to an AutoCAD coordinate system, where one of the axis has a length of 1.0000000000000000000000001 or something like that.

Uniform Scaling on and off gives the same outcome. I tried to simplify the block to a simple polygon but I am still getting the same outcome. I rotated the block in Civil3D model space to an invalid rotation value, on the model space of course there’s no issue with it, once I input that block into the script, and after extracting the coordinate system to use it as new orientation point, it turns out invalid as well. So based on that I can tell that there is something happening with the orientation.

You’ve got the best Dynamo for Civil 3D gurus in the world in the forum, many of whom are already active in this thread; however if we can’t reproduce your issue we can’t help you beyond guessing. Please post a DWG so that we can reproduce the problem.

I have manually bumped your trust level so you can post files, but if it still doesn’t work you can utilize a 3rd party service such as OneDrive, Dropbox, Google Drive, Box, etc…

2 Likes

Thank you so much @jacob.small, I attached the files with the script shared in the video, some orientations get valid output, other locations are not valid insertion points, with the warnings regarding the block scale.

Forum File.dwg (913.2 KB)
Coordinate system.dyn (32.0 KB)

1 Like

So it appears to be the floating point error I noted before.

Utilizing the AutoCAD API (via a zero touch node or Python) to generate a BlockReference.ByCoordinateSystemAtParameter node would be a good idea (this is a common use case as I understand), but that’s a bigger lift than I have time for at the moment.

In the interim you can utilize this graph:

Coordinate system.dyn (239.0 KB)

1 Like

Hi @Francisco.OrtizN86AJ

NOT have uniform scaling works for me:
BR_CoordinateSystem

2 Likes

Thank you again @jacob.small, this different approach did the job!

Thanks @Kulkul, I have no idea why i am getting this outcome, @jacob.small approach was successful.

1 Like