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.
<p>Dim swApp As Object</p><p>Dim sFileName As String</p><p>Dim Part As Object</p><p></p><p></p><p>Sub main()</p><p>Set swApp = Application.SldWorks</p><p>Set Part = swApp.ActiveDoc</p><p></p><p></p><p>Set fso = CreateObject("Scripting.FileSystemObject")</p><p>sFileName = Left\\\$(Part.GetPathName, (Len(Part.GetPathName) - 6)) & "SLDDRW"</p><p>If fso.FileExists(sFileName) Then</p><p> Set Part = swApp.OpenDoc(sFileName, swDocDRAWING)</p><p> Else: MsgBox ("Drawing does not exist")</p><p>End If</p><p></p><p></p><p>End Sub</p>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