Normal parameter in BlockReference.Create

I’m a bit confused with the normal parameter in the BlockReference.Create Node.

Along a polycurve I collected CoordinateSystems. At the origins I place block references and I use the ZAxis as the normal, to rotate the block in the Z direction.

The blocks are placed but with a slight angle as expected. If I compare the ZAxis of the CoordinateSystems of the placed BlockReferences with the original used ZAxis of the polycurve CoordinateSystems, then there is a difference, as shown below:

Do I miss something?

I think the differences in the Z-axis is because the polyline has a slope in the Z-direction. Therefore, the z-axis in the coordinate systems along the polyline will not match the original z-axis which was set as the normal to the block references.

I am not sure I do understand this. I feed the Z-Axis of the Coordinate Systems along the polycurve which has a slope, as a Normal parameter to the block references. Then I expect the same Z-Axis in the properties of the block reference after placement. I can’t explain the difference.

I agree with @Haaba, the difference likely lies before these nodes. Use an export as image (camera looking button in the upper right corner of the workspace) after zooming to this, and expanding the previews of all nodes which feed into the nodes on screen. Post the resulting image here.

@Anton_Huizinga can you confirm if you are using the latest version? there was an issue in the previous release that did not allow for blocks with a normal different from the global Z axis.

1 Like

I had to use two monitors to show the full grid in readable format :slight_smile:

image

The placed blocks does have a different normal, not the global Z-Axis. So I think it is not a version problem.

FYI: the image export exports the entire canvas, not just the visible ones. :slight_smile:

Hi!

When you chose “CoordinateSystem.ZAxis”-node, you will only get the z-component of coordinate systems. This will be a vector that points straight up, as the global z-axis, since you don’t have components of x- and y-vectors. The block references will therefore have the z-axis as the normal vector, which is straight up.

The coordinate systems along the polyline will be oriented dependent of the slope of the polyline. When the polycurve has a vertical geometry, the z-axis along the polycurve will be oriented regarding the slope of the polycurve, which will differ from the vertical normal vector of the blocks.

Hope this was of help! :slight_smile:

Have to have a better look on this, if I prepare a test document with a single line, other weird things happen. If I calculate the angle between the X-Axis and the global X-Axis, I get the same value as the angle in XY plane of the line, but if I use that as rotation angle, the blocks are not correctly aligned if I add a normal. So, the ZAxis of a Coordinate System can’t be used as a normal of a block? Will try a few things and come back later!

Well, some new tests. I have a single line in Civil 3D and these are the properties:

image

The angle in XY is 20.66 and a slope angle of 45. I want to align blocks along this line. The block is a box and this is the desired result in 4 viewports:

So, if I give the block a rotation of 20.66 in the Node BlockReference.Create, the blocks are rotated correctly. I calculate the angle of the line between the X-Axis of the Coordinate Systems along this line and a global X-Axis (and needs a correction of 90 degrees because of the design of the block):

In Civil 3D it is like this:

From above the blocks are perfectly aligned to the line as seen in viewport 1.

Now I need a normal to rotate the block in the Z direction perpendicular to the line. If I check the Z-Axis of the desired result, I get this vector:

image

And it is (not incidentally) the same value of the Z-Axis of the collected Coordinate Systems:

image

So, I want to use this value to feed the Normal Parameter of the BlockReference.Create Node which needs a vector. But, the result in Civil 3D is this:

The rotation in XY plane is not 20.66 anymore (seen in viewport 1) and the extrusion (Z-Axis) is not related to any probability:

image

It is not the same as the feeded Z-Axis and also not a global Z-Axis.

Is it a bug? Or do I feed something other than the Z-Axis (maybe the Normal Parameter is not the Z-Axis)? And why is the rotation changing? Questions…

Example drawing and script added:

ZAXIS.dwg (926.1 KB)
ZAXIS.dyn (133.5 KB)

Strange things going on with normal vectors in Block References indeed @Anton_Huizinga. I tried to get my head around this one but these are my 2 cents:

The Extrusion direction relative to UCS of a Block Reference is a strange thing. It only shows up as a property (AutoCAD LIST command) when the current UCS is set to WORLD but not when setting a user UCS:

The Rotation of your example Block References are not 20.66 degrees but 90 degrees, which also seems strange as end-result:

It seems the normal vector of a Block Reference in Dynamo is having difficulties when also adjusting for rotations, in XY planes.

Then I came up with a possible workaround and that is using Dynamo geometry to reach the same goal. Below the adjusted script also attached. This actually works using the same coordinatesystem settings:

ZAXIS_.dyn (100.1 KB)

1 Like

Thanks @John.DeLeeuw, it is a solid (haha) workaround to create solids instead of blocks. It is effective when the solids are not complex but I rather use blocks (complex curbs) that I can align along a Feature Line or so.

The angle presentation in the List command changes from 20.66 to 90 as soon as the normal is set, without a deviating normal it is 20.66. Indeed weird behavior of AutoCAD.

Thanks for your script, will keep it for solid creation jobs. But I hope someone from Autodesk (@JacobSmall or @Paolo_Emilio_Serra1) can explain the behavior of the BlockReference.Create Node or puts this issue on the bug list :slight_smile:

1 Like

I’ll flag this with the development team (if I haven’t already :wink: ).

Agree, this should be researched further.

In the meantime, you might also want to check out this Autodesk webinar by @Paolo_Emilio_Serra1 ,with regards to Dynamo and Site Development, in which he also shows complex curbs and I think he also used a Solid workaround for them :laughing:

I will have a look! Thanks!

@JacobSmall: :+1:

Hi @Anton_Huizinga, as @Paolo_Emilio_Serra1 has pointed out, our first release of Dynamo for Civil 3D actually can get the exact normal as you want, but the result will be terrible.

Or if we talk with code, our previous code is setting BlockReference.Position/Normal/Rotation properties directly, so you can get the exact result, but seems AutoCAD handles these stuff strangely that cause the above block transforms. Then we took some suggested code from Paolo and it seems working much better.

@Anton_Huizinga Seems I can do some further improvement. Need some time to figure out what autocad does behind…

Hi @Anton_Huizinga. Is this what you need?

If yes, you can actually use the new node, BlockReference.ByCoordinateSystem() without any rotation to get it. The normals are also kept. With CoordinateSystem, we can avoid the tedious work to deal with normal/position/rotation, as it contains the clear Origin/X/Y/Z which can be used directly as block transform.
If you want to change the ‘brick’ from vertical to horizontal, the rotation angle will then be 90 degrees.

ZAXIS_ByCoordinateSystem.dyn (78.0 KB)

2 Likes