Very new to the solidworks API and VB code so been doing quite a bit of searching here and gotten to a stopping point where I need help :<
Downloaded this macro and just need to know how can I make this macro create drawings back off a "master drawing"?
"
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim vConfs As Variant
Dim i As Integer
Dim sDrTemplate As String
Dim lDrSize As Long
Const sOutputFolder As String = "C:\Users\david.mixer\Desktop\test\"
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
sDrTemplate = swApp.GetUserPreferenceStringValue(swUserPreferenceStringValue_e.swDefaultTemplateDrawing)
lDrSize = swDwgPaperSizes_e.swDwgPaperA0size
vConfs = swModel.GetConfigurationNames()
For i = 0 To UBound(vConfs)
Set swDraw = swApp.NewDocument(sDrTemplate, lDrSize, 0, 0)
swDraw.Create1stAngleViews2 swModel.GetPathName
Dim swView As SldWorks.View
Set swView = swDraw.GetFirstView
While Not swView Is Nothing
swView.ReferencedConfiguration = vConfs(i)
Set swView = swView.GetNextView
Wend
Dim swDrawModel As SldWorks.ModelDoc2
Set swDrawModel = swDraw
swDrawModel.ForceRebuild3 False
swDraw.InsertModelAnnotations3 swImportModelItemsSource_e.swImportModelItemsFromEntireModel, 32776, True, True, False, False
swDrawModel.Extension.SaveAs sOutputFolder + swModel.GetTitle() + "_" + vConfs(i) + ".slddrw", swSaveAsVersion_e.swSaveAsCurrentVersion, swSaveAsOptions_e.swSaveAsOptions_Silent, Nothing, 0, 0
swApp.CloseDoc swDrawModel.GetTitle()
Next
End Sub
"
modified
sDrTemplate = swApp.GetUserPreferenceStringValue(swUserPreferenceStringValue_e.swDefaultTemplateDrawing) |
to
sDrTemplate = "C:\Users\david.mixer\Desktop\test\test03.drwdot"
That will drop in the template itself but still drops in the 3 standard views, is there a way I can have this macro use a current Drawing I have for the part and create the new drawing based off that drawing?
our standard for a drawing vary based on the part and shop needs so if I was able to base the new configuration drawing based off a current drawing used as a "master drawing" this macro would work pretty much flawlessly