Before anyone tries any of my macros, have a look over at https://www.codestack.net/solidworks-tools/ and see if there's a similar macro, if so use the one from the above site before you try mine.
Those macros were made by @artem. For those that don't know he's a programmer, I'm not.
Some macros I've kludged together:
All Title Text Resize - changes all titles in all views in a drawing file to a particular size
Change Default Drawing Fonts - Change all annotations in a drawing to set sizes, good for switching fonts and sizes
Change Dim Tolerances - Changes dimension tolerances for selected dimensions
ChangeToolboxPartType with Dialogue - Self explanatory
Rename all Views In Drawing - Cycle through all views and sequentially renumber them A-Z. This is good if you've
deleted section views and added new ones
Renumber Sheets - Renumbers all sheets in a drawing file based on a starting number you enter in a dialog
Roll Back - Rolls the rollback bar up the feature tree and then back down. Needs modifying to be useful
Sketch Color Change - Change sketch colors with a dialog
Title Text Resize - Self explanatory
Update Sheet Formats - Changes out the sheet formats for all sheets in a drawing file
View Title Text - Adds the BOM Name to a View Title, if selected.
Combine Identical Components - useful for BOMs that have multiple instances of a part. (Pre-selection required)
Dynamic Highlight ON - Just what it says
Multi-Body DXF - a massive masterpiece from Codestack that was modified by us. It will take an assembly or a multibody part file and save all the DXFs to a specified folder using a name based on cutlist properties (you can edit it).
Profile Center Mate - Mates two selected faces/edges, sets distance at 0, locks rotation, and confirms.
Reload all Sheet Formats -- reloads 'em all in a large drawing.
Remove blanks in BOM -- Scans the second to left row in the selected BOM and hides/deletes any row with a blank value. (Needs a little work yet, but extremely powerful!)
Save all sheets as PDF and close - Saves all sheets to a specified location, saves, and closes file. Great for those huge behemoths when you have to go pee while it's saving!
[EDIT: 4-22-21 replaced zip file due to board corruption.]
Here's a version of the Multi-body DXF macro, that Mike posted, on steroids! It allows you to either browse for the "DXFs" folder location or enter the address of the location instead of putting it in the folder the part is located in.
We can also put them in the Downloads area which is a nice central location. The Download area wasn't affected by the corruption. Admin is the only one who can upload, but I'll take that on. You can attach the macros here and I'll upload.
I am new to macros and tried to use your 'rename all views in drawing' macro, however when I attempt to run the macro I get a notification saying
"Run-time error'13': type mismatch" when I click debug it highlights this line "For i = 0 To UBound(vViews)"
I appreciate I am attempting to use something I admittedly know nothing about, but this macro in particular would save me endless amounts of time!
Could you advise me on potential mistakes I am making?
DONALT_95 wrote: ↑Wed May 25, 2022 3:42 am
Hi Matt,
I am new to macros and tried to use your 'rename all views in drawing' macro, however when I attempt to run the macro I get a notification saying
"Run-time error'13': type mismatch" when I click debug it highlights this line "For i = 0 To UBound(vViews)"
I got curious and had a look. There's a for loop in there to look through all the views on a sheet. If the view array is empty, meaning there are no views on the sheet, then it will produce an error.
If Not IsEmpty(vViews) Then
For i = 0 To UBound(vViews)
Dim swView As SldWorks.View
Set swView = vViews(i)
Select Case swView.Type
Case swDrawingViewTypes_e.swDrawingSectionView
Dim swSectionView As SldWorks.DrSection
Set swSectionView = swView.GetSection
Debug.Print swSectionView.GetLabel
swSectionView.SetLabel2 GetNextName
Case swDrawingViewTypes_e.swDrawingDetailView
Dim swDetailedView As SldWorks.DetailCircle
Set swDetailedView = swView.GetDetail
Debug.Print swDetailedView.GetLabel
swDetailedView.SetLabel GetNextName
End Select
Next
End If
mme wrote: ↑Tue Oct 24, 2023 9:42 am
Open part or assemblies. Run the macro. Enter a new name. If there is a drawing, it will put the same name on the drawing.
There is actually some difference. Artyom's macro works with a batch of assemblies and renames the file in the assembly as well. For me, I copy parts or assemblies and rename them along with the drawing.
Modify External References - small dialog to Lock / Unlock / Break all references for all components in the assembly. Useful with Master models.
Rebuild Assembly Parts - for when Force Rebuild doesn't cut it. This macro opens each part individually, shakes it down, saves and closes it. Should get these stuck references to update.
Set Image Quality For All Parts - quickly change imaqe quality for all components in an assembly. Useful when you have tons of components that have high quality setting inherited from template or something.
Toggle Tangent Edge Display - quickly toggle tangent edge view without having to go into Options.
Edit Component - we all know how annoying it is that you can't assign Edit Component / Part command to a keyboard shortcut or mouse gesture. But you can with this macro. Select face / feature of any component in the assembly, and it will enter Edit Component mode. Run it again without anything selected, and it will exit Edit Component mode.
Draw CoV - creates a sketch with a point that marks the center of volume (not mass) of the assembly components. Useful when parts have different materials and densities and CoM doesn't match CoV.
Each body to STL - exports each body from a multibody part to an STL. There are some naming rules in there (I use this in conjunction with my Revision Control App (viewtopic.php?t=1823), so there are rules to add revision name to the file. You might want to adjust naming for your use case.