Při práci s PDMS občas potřebujete načíst nějakou grafiku z Autocadu pomocí datalu, toto je skript který vytvoří txt soubor, ves správné syntaxi pro tvorbu PDMS grafiky
Sub writdatal()
On Error Resume NextThisDrawing.SelectionSets.Item("oznac").Delete
If Err Then Err.Clear
MsgBox ("Vyber objekty pro převod do pdms, převedeny budou jen objekty typu line")
Dim line As AcadLine
Dim soubor As String
Dim startPoint As Variant
Dim endPoint As Variant
soubor = "c:\cad\output.txt"
soubor = InputBox("Zadej výstupní cestu", "Urči výstup", soubor)
Set objSelectionSet = ThisDrawing.SelectionSets.Add("oznac")
objSelectionSet.SelectOnScreen
Open soubor For Output As #1
For Each line In objSelectionSet
radek = "new sctn POSS N" & Round(line.startPoint(1), 0) & " E" & Round(line.startPoint(0), 0) & " U" & Round(line.startPoint(2), 0) & " POSE N" & Round(line.endPoint(1), 0) & " E" & Round(line.endPoint(0), 0) & " U" & Round(line.endPoint(2), 0)
Print #1, radek
Next
Close #1
objSelectionSet.Delete
End Sub