Drawing is saved

This commit is contained in:
Anton 2021-01-27 14:11:49 +01:00
parent f27db3229c
commit 0e2ede0625
1 changed files with 7 additions and 9 deletions

View File

@ -9,7 +9,6 @@ Public Class Program
Dim swApp As SldWorks.SldWorks Dim swApp As SldWorks.SldWorks
swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks) swApp = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), SldWorks.SldWorks)
Dim Model As ModelDoc2 Dim Model As ModelDoc2
Dim Part As PartDoc
Dim RootPoint(2) As Double Dim RootPoint(2) As Double
Dim Normal(2) As Double Dim Normal(2) As Double
'Dim TempBody As Body2 'Dim TempBody As Body2
@ -17,7 +16,6 @@ Public Class Program
swApp.UserControl = True swApp.UserControl = True
'Create a new blank document 'Create a new blank document
Model = swApp.NewDocument("C:\ProgramData\SOLIDWORKS\SOLIDWORKS 2020\templates\part.prtdot", 0, 0, 0) Model = swApp.NewDocument("C:\ProgramData\SOLIDWORKS\SOLIDWORKS 2020\templates\part.prtdot", 0, 0, 0)
Part = Model
Dim swSkMgr As SketchManager Dim swSkMgr As SketchManager
Dim longstatus As Integer Dim longstatus As Integer
@ -72,14 +70,11 @@ Public Class Program
swFeature = swFeatureMgr.FeatureExtrusion3(True, False, False, 0, 0, 0.001, 0, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False) swFeature = swFeatureMgr.FeatureExtrusion3(True, False, False, 0, 0, 0.001, 0, False, False, False, False, 0, 0, False, False, False, False, True, True, True, 0, 0, False)
Dim randInt As Integer
randInt = CInt(Math.Ceiling(Rnd() * 1000)) + 1 'For debug only
Dim iPart As PartDoc Dim iPart As PartDoc
iPart = swApp.ActiveDoc iPart = swApp.ActiveDoc
Dim newName As String Dim newName As String
newName = "C:\Users\Anton\Documents\Exjobb\Temp" & "\TESTPART" & randInt & ".SLDPRT" newName = "C:\Users\Anton\Documents\Exjobb\Temp" & "\TESTPART" & 1 & ".SLDPRT"
longstatus = Part.SaveAs3(newName, 0, 0) longstatus = iPart.SaveAs3(newName, 0, 0)
End Sub End Sub
@ -104,9 +99,12 @@ Public Class Program
swSheet.ReloadTemplate(True) swSheet.ReloadTemplate(True)
Dim myView Dim myView
myView = iDrawing.CreateDrawViewFromModelView3("C:\Users\Anton\Documents\Exjobb\Temp\TESTPART707.SLDPRT", "*Front", swSheetWidth / 2, swSheetHeight / 2, 0) myView = iDrawing.CreateDrawViewFromModelView3("C:\Users\Anton\Documents\Exjobb\Temp\TESTPART1.SLDPRT", "*Front", swSheetWidth / 2, swSheetHeight / 2, 0)
Dim longstatus As Integer
Dim newName As String
newName = "C:\Users\Anton\Documents\Exjobb\Temp" & "\TESTDRAWING" & 1 & ".SLDDRW"
longstatus = iDrawing.SaveAs3(newName, 0, 0)