Hide all reference geometry (Blank Datums)

Library for macros
User avatar
jcapriotti
Posts: 1792
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 29
Location: The south
x 1132
x 1940

Hide all reference geometry (Blank Datums)

Unread post 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
image.png (11.12 KiB) Viewed 1495 times
Attachments
BlankDatums.swp
(176 KiB) Downloaded 67 times
Jason
User avatar
AlexB
Posts: 434
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 22
x 242
x 383

Re: Hide all reference geometry (Blank Datums)

Unread post by AlexB »

I'll take a look at it to see if those are relatively easily added. Will report back.
User avatar
AlexB
Posts: 434
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 22
x 242
x 383

Re: Hide all reference geometry (Blank Datums)

Unread post 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.
image.png
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.
Attachments
BlankDatums.swp
(240 KiB) Downloaded 72 times
User avatar
AlexB
Posts: 434
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 22
x 242
x 383

Re: Hide all reference geometry (Blank Datums)

Unread post 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.
User avatar
jcapriotti
Posts: 1792
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 29
Location: The south
x 1132
x 1940

Re: Hide all reference geometry (Blank Datums)

Unread post 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.
Jason
User avatar
AlexLachance
Posts: 1994
Joined: Thu Mar 11, 2021 8:14 am
Answers: 17
Location: Quebec
x 2157
x 1847

Re: Hide all reference geometry (Blank Datums)

Unread post 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!
chancegarrison
Posts: 6
Joined: Wed Feb 01, 2023 5:10 pm
Answers: 0

Re: Hide all reference geometry (Blank Datums)

Unread post 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?
image.png
User avatar
AlexB
Posts: 434
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 22
x 242
x 383

Re: Hide all reference geometry (Blank Datums)

Unread post 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.
chancegarrison
Posts: 6
Joined: Wed Feb 01, 2023 5:10 pm
Answers: 0

Re: Hide all reference geometry (Blank Datums)

Unread post 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.
image.png
User avatar
AlexB
Posts: 434
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 22
x 242
x 383

Re: Hide all reference geometry (Blank Datums)

Unread post by AlexB »

chancegarrison wrote: Thu Feb 02, 2023 11:13 am image.png
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
chancegarrison
Posts: 6
Joined: Wed Feb 01, 2023 5:10 pm
Answers: 0

Re: Hide all reference geometry (Blank Datums)

Unread post 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.
image.png
image.png
Post Reply