I am new to Solidworks and also new to its macro and API functionalities.
Currently I am trying automate the process of importing a geometry (located in a .step-file) into Solidworks, setting a camera angle and export a picture of the geometry. Unfortunately the import of the geomery gives me a warning message which says 'documents will be created on the disc to import free curves'. Two options are given: 'OK' and 'Cancel' (please use the picture as reference).
I always want to pick 'OK'. Now I am looking for a command that can be used inside a macro to avoid this message or to pick 'OK'.
Here is a MWE of my macro:
Sub main() Set swApp = Application.SldWorks Dim COSMOSWORKSObj As Object Dim CWAddinCallBackObj As Object Set CWAddinCallBackObj = swApp.GetAddInObject("CosmosWorks.CosmosWorks") Set COSMOSWORKSObj = CWAddinCallBackObj.COSMOSWORKS boolstatus = swApp.LoadFile2("C:\import_files\geometry.step", "r") Set Part = swApp.ActiveDoc ' Take Snapshot Dim swSnapShot As SnapShot Set swSnapShot = Part.ModelViewManager.AddSnapShot("Anfang") Dim myModelView As Object Set myModelView = Part.ActiveView myModelView.FrameState = swWindowState_e.swWindowMaximized ' Zoom To Fit Part.ViewZoomtofit2 ' Save As longstatus = Part.SaveAs3("C:\export_files\picture.png", 0, 0) Set myModelView = Part.ActiveView myModelView.FrameState = swWindowState_e.swWindowMaximized swApp.ExitApp End Sub