Hi All,
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:
string 1
234545.324 54645.232 12.324
223545.346 56567.234 13.545
235445.346 56887.234 15.573
string 2
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"
Regards
Frank
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 :-)
Hi,
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.
========
https://itunes.apple.com/us/app/rail-library/id784641429?ls=1&mt=8
code snippet:
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
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Unknown 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:
"C:\path_to_your_file\output_file.txt"
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.
Unknown 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.
Jan,
It works! And it is exactly what I wanted. :) Thank you very much.