has anyone got a macro that lists all linestring points?
I am looking for a tool that would work like this:
1. I select some linestrings in MicroStation
2. I run a macro while linestrings are selected
3. The macro produces .txt file:
234545.324 54645.232 12.324
223545.346 56567.234 13.545
235445.346 56887.234 15.573
268845.324 54445.232 13.324
229845.346 56337.234 14.545
235225.346 56227.234 17.573
Can anyone help with it? Macro or any tip how to do it will be greatly apreciated. Thank.
You don't need a Macro MS has a builtin tool, search the help for "EXPORT ELEMENT"
since 1985: GIS, CAD, Engineering (Civil) Senior Consultant : [Autodesk Civil 3D , Esri ArcGIS, VertiGIS: in previous days : Bentley MS V4 - V8i, GeoGraphics, Bentley Map V8i, InRoads, HHK Geograf, IBr DAVID] : Dev: [C, C++, .NET, Java, SQL, FORTRAN, UML][direct quote by: http://en.wikipedia.org/wiki/Helmut_Schmidt]: "Wer Kritik übel nimmt, hat etwas zu verbergen"Wer Grammatik- und/oder Rechtschreibfehler findet, der darf sie behalten :-)
I have checked that - it doesn't give separation between separate strings, just a big list of points. I can't recover separate strings from a report like that.
Sub Start()Open "C:\\path_to_your_file\\output_file.txt" For Output As #1Dim esc As ElementScanCriteriaSet esc = New ElementScanCriteriaesc.ExcludeAllTypesesc.IncludeType msdElementTypeLineString Dim ee As ElementEnumeratorSet ee = ActiveModelReference.Scan(esc)Dim el As LineElementDim stringNum As LongstringNum = 1Do 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 + 1LoopClose #1End Sub
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Sure, it does what you want, see:
Use Comma as a speparator!
I think the problem is not in the separator between coordinates, but that there are no separators between exported elements - the result is just a plain list of coordinates, so there is no information what coordinates belong to what element.
Jan Slegr said:"C:\\path_to_your_file\\output_file.txt"
You were wearing your MDL hat when you wrote that. VBA requires only a single backslash in a quoted string:
Regards, Jon Summers LA Solutions
Ha ha ha, you are right :-) ... but double backslash notation works also in VBA ... at least on my computer, so despite of it's not correct from VBA point of view, it works.
Jan Slegr said:Double backslash notation works also in VBA ... at least on my computer
It varies with Windows version. Also, you can use forward-slash (/) in Windows Explorer.
It works! And it is exactly what I wanted. :) Thank you very much.