I am attempting to redaw several dozen drawings to have a more presentable bank of drawings and to add revisions that need to be noted on all of them. I am trying to incorperate a macro to redraw all of the configurations and have it place them in the appropriate views. I'm also trying to link revisions from the part to the drawing files so when a new revision is added to a part it will automatically insert the revision into the drawings. This would save a lot of time instead of opening every single drawing individually to add the revisions. I am also having a problem with the macro creating every configuration including the flatpattern configuration, I would like it to skip the flatpattern configuration. I also don't know how to tell it to not auto save and exit. I would like to do the choosing to move onto the next drawing. I also heard you can annotate dimensions into the macro aswell. if anyone has any suggestions on my problems I'm open to anything.
Here is the macro I am trying to work with:
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 = "E:\Drawings\"
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