VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
END
Attribute VB_Name = "SVGFile"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Dim ts As Scripting.TextStream
Dim fs As New Scripting.FileSystemObject
Dim indent As Integer
Dim path As Long, layer As Long
Dim CurrentLayer As String
Dim CurrentPath As String
Const PI As Double = 3.14159265358979
Const rad2deg As Double = 180 / 3.14159265358979
Const height As Double = 21
Const width As Double = 29.7
Const scalefac As Double = 1
Sub OpenFile(originX As Double, originY As Double)
Set ts = fs.CreateTextFile("C:/temp/newfile.svg")
writelineTS ""
writelineTS ""
ts.Close
Call ThisApplication.CreateFileDialog(oFileDlg)
oFileDlg.Filter = "SVG File (*.svg)"
oFileDlg.DialogTitle = "Choose a filename"
oFileDlg.InitialDirectory = "C:\Temp"
oFileDlg.CancelError = True
On Error Resume Next
oFileDlg.ShowSave
If Not Err Then
fname = oFileDlg.FileName
If fs.GetExtensionName(fname) <> "svg" Then fname = fname & ".svg"
fs.CopyFile "C:\temp\newfile.svg", fname, True
fs.DeleteFile "C:\temp\newfile.svg"
End If
On Error GoTo 0
bStop = True
End Sub
Private Sub openpath(startx As Double, starty As Double)
If CurrentPath <> "" Then Exit Sub
path = path + 1
CurrentPath = "path_" & path
writelineTS ""
End Sub
Private Function writeTS(f As String, ParamArray t())
' A simple version of printf for putting numbers into strings
' also replaces ' by "" to keep things legible
Dim i As Integer
For i = 0 To UBound(t)
f = Replace$(f, "{" & i + 1 & "}", t(i))
Next
f = Replace$(f, "'", """")
If InStr(f, "") Then
indent = indent - 3
End If
ts.Write f
If ts.Column > 120 Then
ts.WriteLine
ts.Write Space(indent)
End If
If InStr(f, "") Then
indent = indent - 3
End If
ts.WriteLine f
If InStr(f, " 0
ArcTan2 = Atn(Y / X)
Case Is < 0
ArcTan2 = Atn(Y / X) + PI * Sgn(Y)
If Y = 0 Then ArcTan2 = ArcTan2 + PI
Case Is = 0
ArcTan2 = PI / 2 * Sgn(Y)
End Select
End Function