Dear All,
I'm drawing a square in rotated View and want to create horizontal lines every X-m. But i'am getting a not rounden X-Cooordinate on the Start of Lines.So I have perhaps to calculate more Distance, because each line must start with a rounded X-Coordinate.Only Rounding the coordinate moves the point along the other axis. How can this problem be solved if there is a view rotation angle, a point of displacement of the axes.
I'am Using a Method form John Summers with IPrimitiveCommandEvents for Creating a of Square and other Elements.
Thanks for your Ideas.
Mikha Zaslavskiy said:I'm drawing a square in rotated View and want to create horizontal lines
Horizontal with respect to the View, or horizontal with respect to the coordinate system?
Mikha Zaslavskiy said:Each line must start with a rounded X-Coordinate
pt.X = CDbl(CLong(1000.0 * pt.X) / 1000)
Regards, Jon Summers LA Solutions
Hi Jon,
to your question: Horizontal with respect to the View
But at first Creation of Line I have to use a View-Matrix without Inverse or?
Mikha Zaslavskiy said:I have to use a View-Matrix without Inverse or?
Jon,
i'am getting a Error by "pt.X = CDbl(CLng(1000.0 * pt.X) / 1000)" because I use a RD83- Coordinates X:5400000,000 and Y: 57000000,000. To Create a Line is not my Question. My Problem is Calculating of Distance to rounded Coordinate along Square, so for Example from X-Point 5458689,333 + 1000 =5459689,33 but I need go to next coordinate 5459700.000.
Create a line aligned with the X axis:
PntZusatz = Origin PntZus2 = Point3dAddScaled(Origin, Xv, 1000) PntZus2.X = Runden(CDbl(CLng(PntZusatz.X)), -2) Axis = Point3dFromXYZ(1, 0, 0) oMatrix = Matrix3dFromVectorAndRotationAngle(Axis, dAngle) Set TmpVertLine = CreateLineElement2(Nothing, PntZusatz, PntZus2) oTransform = Transform3dFromMatrix3dAndFixedPoint3d(oMatrix, Origin) TmpVertLine.Transform oTransform
Mikha Zaslavskiy said:Is it correct?
No idea! I have difficulty visualising what you want to do. Perhaps it would help if you draw manually what you want to achieve, then post the DGN file here?
I have posted a Picture. Thanks for your Time.
Hi Mikha,
the problem is that your picture is not well connected to the code.
Plus, when you do not bother to share a code in a proper way (to use Insert > Insert Code tool to ensure it will be displayed as the code), I assume not many people is willing to invest time to analyze the problem.
Another problem is that you are trying to solve two different problems in one step:
I recommend to implement the rounding at first (for not rotated view, so there will be no matrices used) and provide more complete code, that can be tested (it means it has to be sub, containing input values and some output). It allows to move from pure theory to something testable.
When it will work, it makes sense to start another discussion how to extend the code to work in rotated view.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I will follow your Recommendations Jan and prepare a Code for a Rounding in unrotated View.