New or exsisting macro

Library for macros
User avatar
Bryan O
Posts: 109
Joined: Wed Mar 24, 2021 7:34 am
Answers: 1
Location: Lowell MI
x 17
x 37

New or exsisting macro

Unread post by Bryan O »

There are a lot of pet peeves that my coworkers do that annoy me.
Here is a short list LOL!:
• Saving a model zoomed in so when you open it, you’re looking at the side of a surface.
• Leaving unused features in part trees.
• Display states. We don’t use them but many leave display states linked to configurations and inadvertently make many copies of unused states.

I would like a macro that saves out a “clean” part/assembly.
I would like this macro to:
• Unlink display states
• Set the display state to <default>_Display State 1
• Delete all but <default>_Display State 1
• Delete all unused features/parts( and their children)
• Hide all sketches
• Return the display area to a default ISO view (full screen)
• Save the file (with option to close)

anyone have something or would be willing to write one?
I tried to record a macro to do this, but it stalls at the close. I looked at it and it looked like it was trying to rename the part to whatever the part I was recording that I used while I was recording it.
Attachments
Macro2.swp
(24 KiB) Downloaded 173 times
by gupta9665 » Sun Sep 22, 2024 4:04 am
Try the attached macro, does not delete unused features/parts but covers rest others.
Go to full post
User avatar
gupta9665
Posts: 411
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 434
x 450

Re: New or exsisting macro

Unread post by gupta9665 »

Try the attached macro, does not delete unused features/parts but covers rest others.
Attachments
Model Clean Up.swp
(60.5 KiB) Downloaded 107 times
Deepak Gupta
SOLIDWORKS Consultant/Blogger
User avatar
Bryan O
Posts: 109
Joined: Wed Mar 24, 2021 7:34 am
Answers: 1
Location: Lowell MI
x 17
x 37

Re: New or exsisting macro

Unread post by Bryan O »

Thanks for the help Deepak.
I downloaded it and ran it but it did nothing.
Is there any restriction on where the file needs to be or anything else that stop it from running?
User avatar
gupta9665
Posts: 411
Joined: Thu Mar 11, 2021 10:20 am
Answers: 25
Location: India
x 434
x 450

Re: New or exsisting macro

Unread post by gupta9665 »

Bryan O wrote: Mon Sep 23, 2024 9:23 am Thanks for the help Deepak.
I downloaded it and ran it but it did nothing.
Is there any restriction on where the file needs to be or anything else that stop it from running?
It should work on active file. Make sure you have set the references correctly to your installed version. Refer this video

If above does not fix the issue, then kindly share some sample files to check.
Deepak Gupta
SOLIDWORKS Consultant/Blogger
User avatar
Bryan O
Posts: 109
Joined: Wed Mar 24, 2021 7:34 am
Answers: 1
Location: Lowell MI
x 17
x 37

Re: New or exsisting macro

Unread post by Bryan O »

Again, Thanks for the help Deepak.
Post Reply