the following code is what i have right now, it makes the 1:1flat pattern in the same folder as the 3d model with the same nameas the model file (exactly what i want) but it just doesnt get ridof the ".sldprt".
so if the solidworks 3d model was named "bob" the macro will make adxf file in the same folder called "bob.sldprt"
and its annoying as hell and ive tried different code but somethinghas gone awry and i cant think of what it is anymore, thanks toanyone that can help me finish this little project
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim PartName As String
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
PartName = swModel.GetPathName
Debug.Print PartName
swModel.ExportFlatPatternView PartName & ".dxf", 0
End Sub
Public Function GetFileName(pstrFile As String) As String
If InStr(pstrFile, "\") <> 0 Then
GetFileName = Right(pstrFile, Len(pstrFile) - InStrRev(pstrFile,"\"))
\$exts = split("[/\\.]", \$filename) ;
GetFileName = Left(GetFileName, Len(GetFileName) - 1)
End If
End Function
SolidworksApi macros
so if the solidworks 3d model was named "bob" the macro will make adxf file in the same folder called "bob.sldprt"
and its annoying as hell and ive tried different code but somethinghas gone awry and i cant think of what it is anymore, thanks toanyone that can help me finish this little project
Dim swApp As SldWorks.SldWorks
Dim swModel As ModelDoc2
Dim PartName As String
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
PartName = swModel.GetPathName
Debug.Print PartName
swModel.ExportFlatPatternView PartName & ".dxf", 0
End Sub
Public Function GetFileName(pstrFile As String) As String
If InStr(pstrFile, "\") <> 0 Then
GetFileName = Right(pstrFile, Len(pstrFile) - InStrRev(pstrFile,"\"))
\$exts = split("[/\\.]", \$filename) ;
GetFileName = Left(GetFileName, Len(GetFileName) - 1)
End If
End Function
SolidworksApi macros