I use microstation 08.11.09.578, DGN 2D V7 Upgrade V8
I want to get the 2D coordinates of the element, I see the manual but don't see the method 'Point2dFromXY'
Point2dFromXY Method Returns a point with specified x and y components. Syntax Point2d = object.Point2dFromXY (X, Y)
Hi,
Jon wrote good answer, some extra comments:
ba ranh said:I want to get the 2D coordinates of the element
Element? What element? Be developer, be precise!
Element is e.g. (reference) Attachment. Has it coordinates? No. Or what about cell? It has coordinates (origin / insertion point), but maybe you are interested in vertices coordinates of lines inside the cell?
No detail answer can be provided until more details is shared.
ba ranh said:I see the manual but don't see the method 'Point2dFromXY'
Did you try to search manual and this forum?
When I searched for "get line vertices", as example of more specific requirement, in MicroStation VBA help, I found immediately "Highlighting the Closest Segment" example, that can be used to learn how to do it. And when I searched for "get line vertices vba" in this forum, many discussions were found.
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I want to get the X Y coordinates of the line element to compare with each other to see if it overlaps
I see your code at https://communities.bentley.com/products/programming/microstation_programming/f/archived-microstation-v8i-vba-forum/75500/getting-linestring-points/203597#203597
Sub Start() Open "C:\\path_to_your_file\\output_file.txt" For Output As #1 Dim esc As ElementScanCriteria Set esc = New ElementScanCriteria esc.ExcludeAllTypes esc.IncludeType msdElementTypeLineString Dim ee As ElementEnumerator Set ee = ActiveModelReference.Scan(esc) Dim el As LineElement Dim stringNum As Long stringNum = 1 Do While ee.MoveNext Print #1, "String " + CStr(stringNum) Dim vertices As Long vertices = ee.Current.AsLineElement.VerticesCount Dim points() As Point3d points = ee.Current.AsLineElement.GetVertices Dim index As Long For index = 0 To vertices - 1 Print #1, CStr(points(index).X) + " " + CStr(points(index).Y) + " " + CStr(points(index).Z) Next stringNum = stringNum + 1 Loop Close #1 End Sub
I convert to c# code, it gives me an empty error like this