Rotate 3d text Civil3d

Hi all,

I am trying to rotate Text elements (chainige labels) along an alignment, so they stand vertical instead of horizontal, based on Lawrence Hooker script.

Sample test:
image

I´ve tried some approaches that don´t work:
Setting a new normal with SetParameterValueByName (Civil3dToolkit) there is no change.

Using Object.Transform, the elements that are not in the origin, make unexpected movements.


I guess one posible solution could be displacing all elements to the origin, rotate them and displace them again to their location. I will work on this and comment if I am succesful, but I would like to know if there is a more direct solution.

Thanks if advance!

You need to use an AutoCAD Vector3d object for this instead of a Dynamo vector.

TextRotate

import clr

clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('ProtoGeometry')

from Autodesk.AutoCAD.Geometry import *
from Autodesk.DesignScript.Geometry import *

vec = IN[0]

OUT = Vector3d(vec.X,vec.Y,vec.Z)
3 Likes

Hi Jensen, thank you for your answer.

I though that changing the normal wouldn´t change the position. But it does.
I actually wanted to rotate the Text elements without moving them. In other words, rotating them aroung their own center (or their own base). The movement is my main problem here.

I anyway tried building the Text elements at the origin, then rotating as you did above (it works), and then setting them to their correct position. However, something very strange happens with this last step:
ObjectExtensions.GetParameterByName gives me the desired position, whereas inside C3D, the value is completely different.

Thanks again for your help.

I tried the same idea with the Object.Transform node and it works.

Here the solution (left part is in the link of the original post):


1 Like