Page 1 of 1
Hide all reference geometry (Blank Datums)
Posted: Fri Jul 01, 2022 4:22 pm
by jcapriotti
Not sure who created this macro but it is very useful. It will traverse a part tree and hide all reference geometry selected for the configuration or all configurations (if linked to Display States).
Some potential enhancement ideas if there are any takers:
- Ability to unhide
- Support Display States not linked to configurations
- Separate toggle for base planes
- Option to hide surfaces
- image.png (11.12 KiB) Viewed 2400 times
Re: Hide all reference geometry (Blank Datums)
Posted: Tue Jul 05, 2022 8:58 am
by AlexB
I'll take a look at it to see if those are relatively easily added. Will report back.
Re: Hide all reference geometry (Blank Datums)
Posted: Wed Jul 06, 2022 9:29 am
by AlexB
Okay, I got it working... I think. I'm not sure if running it from an assembly really works the way it should so test that out to see if it works the way you want, if you use it at all.
The rest appears to work relatively well in my testing.
Edit: to show additional info
The base plane toggle assumes there are planes labeled Front Plane, Right Plane and Top Plane. If yours differ, these can be modified in the source code.
The "plane" toggle will not show or hide "base planes" and the "base plane" toggle won't affect other planes.
I've added a surface selection that just grabs all surface bodies from the surfaces folder and hides/shows them.
The All Display states toggle will get any available display states for the current configuration and hide/show features within them as well.
I'm sure there's a lot more optimization that can be done to speed things up but I don't have the availability to dig into is on that level.
Edit2: Updated with different assembly functionality. The part needs to be opened to affect display states so this will now only happen when that is checked.
Re: Hide all reference geometry (Blank Datums)
Posted: Thu Jul 07, 2022 11:40 am
by AlexB
@jcapriotti , I updated the file in my previous post with one that seems to work better on assemblies as well.
For read-only files, any changes will be skipped (this assumes these files are checked-in and cannot be changed anyway). There is a prompt that asks for permission to open then close files to affect the inactive display states if that check box is selected.
Re: Hide all reference geometry (Blank Datums)
Posted: Thu Jul 07, 2022 11:48 am
by jcapriotti
AlexB wrote: ↑Thu Jul 07, 2022 11:40 am
@jcapriotti , I updated the file in my previous post with one that seems to work better on assemblies as well.
For read-only files, any changes will be skipped (this assumes these files are checked-in and cannot be changed anyway). There is a prompt that asks for permission to open then close files to affect the inactive display states if that check box is selected.
Awesome, I'll try it out here shortly.
Re: Hide all reference geometry (Blank Datums)
Posted: Thu Jul 07, 2022 1:23 pm
by AlexLachance
Nice macro, it seems more customizable then the one I currently use, will definetly give it a try!
Thanks @AlexB for the little adds you did and thanks @jcapriotti for the share!
Re: Hide all reference geometry (Blank Datums)
Posted: Thu Feb 02, 2023 8:11 am
by chancegarrison
AlexB wrote: ↑Thu Jul 07, 2022 11:40 am
@jcapriotti , I updated the file in my previous post with one that seems to work better on assemblies as well.
For read-only files, any changes will be skipped (this assumes these files are checked-in and cannot be changed anyway). There is a prompt that asks for permission to open then close files to affect the inactive display states if that check box is selected.
I am getting this error, do you know why?
Re: Hide all reference geometry (Blank Datums)
Posted: Thu Feb 02, 2023 10:49 am
by AlexB
chancegarrison wrote: ↑Thu Feb 02, 2023 8:11 am
I am getting this error, do you know why?
What does the error say?
Going with a guess, it could be that a component is lightweight or something unexpected. I'd have to do a bit of testing to figure that out.
Re: Hide all reference geometry (Blank Datums)
Posted: Thu Feb 02, 2023 11:13 am
by chancegarrison
AlexB wrote: ↑Thu Feb 02, 2023 10:49 am
What does the error say?
Going with a guess, it could be that a component is lightweight or something unexpected. I'd have to do a bit of testing to figure that out.
Re: Hide all reference geometry (Blank Datums)
Posted: Thu Feb 02, 2023 2:12 pm
by AlexB
Add this IF statement above the highlighted line in your error image.
Code: Select all
If mCompModelDoc(swChildComp) Is Nothing Then
swChildComp.SetSuppression2 swComponentSuppressionState_e.swComponentFullyResolved
End If
Re: Hide all reference geometry (Blank Datums)
Posted: Wed Feb 08, 2023 1:50 pm
by chancegarrison
AlexB wrote: ↑Thu Feb 02, 2023 2:12 pm
Add this IF statement above the highlighted line in your error image.
Code: Select all
If mCompModelDoc(swChildComp) Is Nothing Then
swChildComp.SetSuppression2 swComponentSuppressionState_e.swComponentFullyResolved
End If
Still sometimes receiving an error on some assemblies, but i'm not sure why.