Hi,
when I use the command "place text" (by origin method) the text orientation is ruled only by the activeangle (not by the view: if AA=0°, I see every the text from left to right...). In my commandEvents_dynamics code I'm not able to replicate this behaviour when I change view.
Private Sub IPrimitiveCommandEvents_Dynamics(Point As Point3d, ByVal View As View, ByVal DrawMode As MsdDrawingMode) rotMatrix = Matrix3dIdentity myStr1 = Format(Round(pt3Coord.Y, 3), "######0.000") myStr2 = Format(Round(pt3Coord.X, 3), "######0.000") Set tmpTxtElem = CreateTextNodeElement1(Nothing, Point, rotMatrix) tmpTxtElem.AddTextLine "N= " & myStr1 tmpTxtElem.AddTextLine "E= " & myStr2 tmpTxtElem.Redraw DrawMode
End Sub
I've tried also with view.rotation but with no success.
Thank you in advance for your replies.
Gianluca Gatto
Gianluca: Private Sub IPrimitiveCommandEvents_Dynamics(point As Point3d, ByVal oView As View, ByVal drawMode As MsdDrawingMode) Dim rotation As Matrix3d rotation = Matrix3dIdentity Set oTextElement = CreateTextNodeElement1 (Nothing, point, rotation)
Private Sub IPrimitiveCommandEvents_Dynamics(point As Point3d, ByVal oView As View, ByVal drawMode As MsdDrawingMode) Dim rotation As Matrix3d rotation = Matrix3dIdentity Set oTextElement = CreateTextNodeElement1 (Nothing, point, rotation)
Your code places the text element with no rotation — meaning no rotation with respect to the DGN model's coordinate system. If you are looking at a rotated view, then the text will appear to be rotated with respect to that view.
Is your question, "How do I place text aligned with a rotated view?" If so, you need to get the view rotation and invert it before applying to your text element …
Private Sub IPrimitiveCommandEvents_Dynamics(point As Point3d, ByVal oView As View, ByVal drawMode As MsdDrawingMode) Dim rotation As Matrix3d rotation = Matrix3dInverse (oView.Rotation) Set oTextElement = CreateTextNodeElement1 (Nothing, point, rotation)
Regards, Jon Summers LA Solutions
.... you need to get the view rotation and invert it before applying to your text element …
Thank you Jon. It works very well now.
You are a 'MVBA manual walking'. A guru. Thank you again for this trick.