Quote:Should PolyText.csv and a path have been be setup previously ?
No,
PolyText.csv is automatically created by the macro.
Yes,
a path should have been be setup previously but a DeltaCad install should have created the\DeltaCad\macro folder already.
Check your Default Directory which is set in DeltaCad's menu Options / Options. Normally it would be C:\Program Files (x86)\DeltaCad
The line in the code that reads >>
Open "PolyText.csv" For Output As #1 is the line of code that creates the file.
Because the macro is run from
the\DeltaCad\macro folder the file PolyText.csv should have been created there.
If you want the CSV file created in a different folder then the line of code will need to be changed.
An example would be
Open "C:\Program Files (x86)\DeltaCad\CSV\PolyText.csv" For Output As #1
===============================================================
I have a new macro code below that puts each polygon in its own and different CSV files (Polygon1.csv, Polygon2.csv . . . ect) and
puts them in a different folder besides the macro folder.
The line of code that reads:
PFile$ = "C:\Program Files (x86)\DeltaCad\CSV\"
puts them in a folder called C:\Program Files (x86)\DeltaCad\CSV\ but you can create your own folder name.
Make sure the folder already exists before you run the macro.
P.S.
It is possible to code to open a "File Dialog" in the macro to pick any folder you want but it is a long and complicated process that would take time if you needed it.
Another possibility would be to put each polygon in different layers and have files created using the layers name. Maybe I will do that when I feel creative.
Code:
Sub Main
'This sub finds all shape points
Dim ot As Long
Dim vert(640) As Double
Dim num As Long
Dim j As Long
Dim color As Long
Dim lt As Long
Dim lw As Long
Dim layer As String
P=1
ot = dcGetFirstObject("")
PT$=""
While ot <> dcNone
If ot = dcShape Then
PFile$ = "C:\Program Files (x86)\DeltaCad\CSV\" : ' << Folder where CSV files are put.
Open PFile$+"Polygon"+Trim$(Str$(P))+".csv" For Output As #1
Print #1,"Polygon # ";P
num = 320
dcGetShapeData vert(1), num, color, lt, lw, layer
For j=1 to num
PT$=Format(vert(j*2-1))+", "+Format(vert(j*2))
Print #1,PT$
'MsgBox Format(vert(j*2-1))+", "+Format(vert(j*2))
Next j
P=P+1
Close #1
End If
ot = dcGetNextObject
Wend
MsgBox "Found "+Str$(P-1)+" Polygons"+chr$(13)+chr$(10)+"Files created in folder "+chr$(13)+chr$(10)+PFile$
Close #1
End Sub