Hey guys, I have been using this macro to open drawings of components in an assembly by first opening the component model manually, then run the macro to open the drawing. This has worked pretty well, however I have been opening a lot of drawings and it slows down my computer significantly. I have tried to modify the code to open the drawing in quick view mode but I just couldnt get it to work.
Dim swApp As Object
Dim sFileName As String
Dim Part As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set fso = CreateObject("Scripting.FileSystemObject")
sFileName = Left\$(Part.GetPathName, (Len(Part.GetPathName) - 6)) & "SLDDRW"
If fso.FileExists(sFileName) Then
Set Part = swApp.OpenDoc(sFileName, swDocDRAWING)
Else: MsgBox ("Drawing does not exist")
End If
End Sub
On a separate note, if there is a way to open any component drawing directly from the assembly drawing (without opening the component model), that will be awesome! However I'll also need the macro to open the drawing from part model. Thanks a lot guys!!! Its much appreciated.
SolidworksApi macros