Page 1 of 1

make envelope items standard components

Posted: Tue Aug 15, 2023 7:26 am
by Bradfordzzz
Is there a way to make envelope items standard components for all components in an Assembly, that has many components and subassemblies with many components? All files are currently enveloped.

Thanks,
Mark

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 7:44 am
by AlexLachance
I'm not sure I understand the question. What do you refer to as standard components?

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 7:48 am
by Bradfordzzz
Just remove the envelope. Currently have to go in each subassembly and select all components ... then go to component properties, and un check the envelope. This customers assembly is huge, and everything is individually enveloped. Hoping there is is a way to select all assemblies with dependents and uncheck the envelope option on all. This is going to take a great deal of time manually!

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:08 am
by mattpeneguy
You should be able to do it with a macro, if there isn't an easier way.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:13 am
by DanPihlaja
So there is "sort of" a way.

If you use Assembly Visualization, you can add a column called "Excluded From BOM".
(by default, all envelope components are excluded from BOM).

Then you can sort by that column. Which puts all the envelope components at the top of the list.

Unfortunately, you cannot Multi-select and uncheck "Envelope" as it is greyed out as soon as you have more than 1 selected.

But, it will give you all the components right there in front of you.

I will look a little deeper to see if envelope can be toggled off on multiple things at once.
image.png
image.png
image.png (31.43 KiB) Viewed 3401 times
image.png
image.png (13.92 KiB) Viewed 3401 times
image.png
image.png (16.46 KiB) Viewed 3401 times
image.png

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:16 am
by DanPihlaja
OK, what I found was that, if you multi select components and ALL the components that you have selected are ALL envelope, then you can toggle off envelope for all of them all at once.
image.png
image.png

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:18 am
by Bradfordzzz
DanPihlaja wrote: Tue Aug 15, 2023 8:13 am So there is "sort of" a way.

If you use Assembly Visualization, you can add a column called "Excluded From BOM".
(by default, all envelope components are excluded from BOM).

Then you can sort by that column. Which puts all the envelope components at the top of the list.

Unfortunately, you cannot Multi-select and uncheck "Envelope" as it is greyed out as soon as you have more than 1 selected.

But, it will give you all the components right there in front of you.

I will look a little deeper to see if envelope can be toggled off on multiple things at once.
Thanks Dan,

Yeah .. I can find a couple of ways to get them all selected .. but the option to toggle off the envelope has been greyed out each time so far. frustrating. seems like it should be such an easy thing. can help but feel like I am just missing the option somewhere, but can't find anything on google for this either.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:19 am
by Bradfordzzz
mattpeneguy wrote: Tue Aug 15, 2023 8:08 am You should be able to do it with a macro, if there isn't an easier way.
Thanks Matt .. I've been looking for one, but havent had any luck there either.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:26 am
by Bradfordzzz
DanPihlaja wrote: Tue Aug 15, 2023 8:16 am OK, what I found was that, if you multi select components and ALL the components that you have selected are ALL envelope, then you can toggle off envelope for all of them all at once.

image.png

image.png
The problem for this assembly is there are many sub assemblies inside of sub assemblies, and they all of teh components have envelopes .. so the option is always greyed out. I am having to expand the entire assembly and manually select each component in order for it to not be grayed out.
looking for a a tool to "select all envelopes" so then I can uncheck that option .. but no luck there

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:28 am
by mattpeneguy
There's this from a quick google search on changing a part to an envelope part:
https://help.solidworks.com/2021/englis ... ple_vb.htm
You'd need to figure out which "True" to change to false and then wrap it in a loop to go through the assembly.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:31 am
by Bradfordzzz
mattpeneguy wrote: Tue Aug 15, 2023 8:28 am There's this from a quick google search on changing a part to an envelope part:
https://help.solidworks.com/2021/englis ... ple_vb.htm
You'd need to figure out which "True" to change to false and then wrap it in a loop to go through the assembly.
Thanks Matt .. I found that one too .. but it doesn't actually go into all of the sub assemblies inside of other subassemblies to select all the components and then continue with all the components and all of their dependents. I don't know enough enough VBA to alter this unfortunately.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:37 am
by mattpeneguy
Here's further information:
https://help.solidworks.com/2019/englis ... ties6.html
Looks like it's the second to last true in the above link that needs to be changed to false:
image.png

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:42 am
by mattpeneguy
Here's the loop through assembly that will be the other part:
https://help.solidworks.com/2023/englis ... Redirect=1
The API help the people at SW provide is pretty darn good.

If I get some time today I may be able to kludge it together. But if you want something clean, @josh, @gupta9665, @artem, or one of the other actual programmers would have to weigh in.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:50 am
by Bradfordzzz
mattpeneguy wrote: Tue Aug 15, 2023 8:42 am Here's the loop through assembly that will be the other part:
https://help.solidworks.com/2023/englis ... Redirect=1
The API help the people at SW provide is pretty darn good.

If I get some time today I may be able to kludge it together. But if you want something clean, @josh, @gupta9665, @artem, or one of the other actual programmers would have to weigh in.
Thanks for finding all of this Matt. I can sort of understand the individual bits of code and what they are doing, but I don't have the knowledge it would take to put this into a working macro. definitely beyond my abilities unfortunately.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 8:54 am
by JSculley
FYI: There are 3 separate SPRs requesting the ability to select envelopes via Advanced Selection

SPR542629 - Cannot select assembly envelope components through the Advanced Selection criteria
SPR666548 - It should be possible to identify and select envelope components with advanced selection or with assembly visualization
SPR1059850 - Ability to select components which are excluded from BOM (Bill of Materials) and Envelope Components in Component Selection tools, and Advanced Selection

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:04 am
by Bradfordzzz
JSculley wrote: Tue Aug 15, 2023 8:54 am FYI: There are 3 separate SPRs requesting the ability to select envelopes via Advanced Selection

SPR542629 - Cannot select assembly envelope components through the Advanced Selection criteria
SPR666548 - It should be possible to identify and select envelope components with advanced selection or with assembly visualization
SPR1059850 - Ability to select components which are excluded from BOM (Bill of Materials) and Envelope Components in Component Selection tools, and Advanced Selection
Great to know... I'll add my name to them too. Thanks

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:15 am
by AlexLachance
Can you provide some images please? I've never encountered enveloppes that couldn't be toggled off.

A bit more context would help in perhaps getting more solutions.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:23 am
by DanPihlaja
JSculley wrote: Tue Aug 15, 2023 8:54 am FYI: There are 3 separate SPRs requesting the ability to select envelopes via Advanced Selection

SPR542629 - Cannot select assembly envelope components through the Advanced Selection criteria
SPR666548 - It should be possible to identify and select envelope components with advanced selection or with assembly visualization
SPR1059850 - Ability to select components which are excluded from BOM (Bill of Materials) and Envelope Components in Component Selection tools, and Advanced Selection
Yeah, that was the first thing that I checked. I remembered seeing this (below) and thought that this would do it, but it doesn't mean an envelope component. It means something else.
image.png

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:29 am
by DanPihlaja
AlexLachance wrote: Tue Aug 15, 2023 9:15 am Can you provide some images please? I've never encountered enveloppes that couldn't be toggled off.

A bit more context would help in perhaps getting more solutions.
He is trying to multi select envelope components to turn them off he has hundreds of them.

Unfortunately, if the components that you have multi selected aren't ALL envelope, then you cannot turn off envelope en-masse.

Also, I don't think that you can select multi-levels and turn them off en-masse either.

So, it sounds like a lot of work.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:31 am
by Bradfordzzz
AlexLachance wrote: Tue Aug 15, 2023 9:15 am Can you provide some images please? I've never encountered enveloppes that couldn't be toggled off.

A bit more context would help in perhaps getting more solutions.
You can see that the Envelope toggle box is greyed out here. Thats because in this assembly, and in a subassembly is a component that isn't in an envelope. so since there is something not in an envelope .. the option is greyed out. I need a way to select ONLY all assemblies and their dependents that are in an envelope so that I can toggle that option on all of those components. currently, I can find a way to do this without manually expanding each assembly and subassembly and selecting only the enveloped components and assemblies. this will take hours on this assembly becuase of its size. Im was thinking there might be an easier way .. but its looking like a macro might be the only way.
image.png

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:34 am
by josh
This will select all envelope components at any level. You should then be able to toggle envelope off.
Sub main()
Dim swapp As SldWorks.SldWorks
Dim swDoc As SldWorks.AssemblyDoc
Dim swComp As SldWorks.Component2
Dim vComps As Variant
Set swapp = Application.SldWorks
Set swDoc = swapp.ActiveDoc
vComps = swDoc.GetComponents(False)
Dim i As Long
swDoc.ClearSelection2 True
For i = 0 To UBound(vComps)
Set swComp = vComps(i)
If Not (swComp.IsEnvelope = False) Then
swComp.Select2 True, 1
End If
Next i

End Sub

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:38 am
by DanPihlaja
AHAH! Try this!

I just tested it out and it works.

First of all, Make sure that everything is NOT hidden in your assembly first. There are no hidden components.

Then RMB on your top level and select "Hide all envelopes"
image.png
Now, under your selection tool bar, select "Select Hidden"
image.png
Them RMB on them and Select your properties and Envelope won't be greyed out.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:48 am
by Bradfordzzz
This works perfectly. Thanks for this solution Dan !!

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:50 am
by Bradfordzzz
josh wrote: Tue Aug 15, 2023 9:34 am This will select all envelope components at any level. You should then be able to toggle envelope off.
Sub main()
Dim swapp As SldWorks.SldWorks
Dim swDoc As SldWorks.AssemblyDoc
Dim swComp As SldWorks.Component2
Dim vComps As Variant
Set swapp = Application.SldWorks
Set swDoc = swapp.ActiveDoc
vComps = swDoc.GetComponents(False)
Dim i As Long
swDoc.ClearSelection2 True
For i = 0 To UBound(vComps)
Set swComp = vComps(i)
If Not (swComp.IsEnvelope = False) Then
swComp.Select2 True, 1
End If
Next i

End Sub
Thanks Josh ! This works perfectly !

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:50 am
by Bradfordzzz
Really appreciate you all working thru the problem with me. Helped me quite a bit. Thank you all.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 9:53 am
by AlexLachance
DanPihlaja wrote: Tue Aug 15, 2023 9:29 am He is trying to multi select envelope components to turn them off he has hundreds of them.

Unfortunately, if the components that you have multi selected aren't ALL envelope, then you cannot turn off envelope en-masse.

Also, I don't think that you can select multi-levels and turn them off en-masse either.

So, it sounds like a lot of work.
Well, a solution was provided. If that one fails, then you can hide all and then toggle "show all enveloppes" and proceed to do a similar process.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 10:20 am
by josh
It should probably be noted that selecting all envelopes (or any big bunch o’ components) and hitting the “Properties” box may change more than just the property you want. There’s no way to specify “Only change the envelope property”. This will also change suppression states, flexible/rigid, and maybe more.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 10:29 am
by gupta9665
Add following line before end sub to remove the envelope option for bulk. But please note that any component solve state, suppression, etc. wil change like @josh has stated.

swDoc.CompConfigProperties6 2, 0, True, True, swComp.ReferencedConfiguration, False, False, 0

Remove Envelope.png
But you can also replace

swComp.Select2 True, 1

with

swComp.CompConfigProperties6 swComp.GetSuppression2, 0, swComp.Visible, True, swComp.ReferencedConfiguration, False, False, 0


This will only change solve state and assembly save as part option. Rest properties will remain intact.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 11:10 am
by DanPihlaja
josh wrote: Tue Aug 15, 2023 10:20 am It should probably be noted that selecting all envelopes (or any big bunch o’ components) and hitting the “Properties” box may change more than just the property you want. There’s no way to specify “Only change the envelope property”. This will also change suppression states, flexible/rigid, and maybe more.
It shouldn't. It only changes the things that you specifically change. If you select it in the box. Has worked in the past before. Unless there is some thing that I have missed (which is always a possibility) UU

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 11:31 am
by josh
DanPihlaja wrote: Tue Aug 15, 2023 11:10 am It shouldn't. It only changes the things that you specifically change. If you select it in the box. Has worked in the past before. Unless there is some thing that I have missed (which is always a possibility) UU
You're right. It shouldn't. But it does. At least in 22sp4. I made 2 comps envelope, then suppressed one of them. Selected both, and changed back to non-envelope. The suppressed one became resolved. Did the same thing with a couple subassemblies and their rigid/flexible setting. Ended up with both set to rigid.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 11:36 am
by DanPihlaja
josh wrote: Tue Aug 15, 2023 11:31 am You're right. It shouldn't. But it does. At least in 22sp4. I made 2 comps envelope, then suppressed one of them. Selected both, and changed back to non-envelope. The suppressed one became resolved. Did the same thing with a couple subassemblies and their rigid/flexible setting. Ended up with both set to rigid.
Now that you mention it, when I was playing around with this fix, I noticed the same thing with regards to suppressed/unsuppressed state. (I am also using 2022 SP4). I didn't think anything of it at the time, thinking that maybe it was a fluke.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 11:49 am
by AlexLachance
josh wrote: Tue Aug 15, 2023 11:31 am You're right. It shouldn't. But it does. At least in 22sp4. I made 2 comps envelope, then suppressed one of them. Selected both, and changed back to non-envelope. The suppressed one became resolved. Did the same thing with a couple subassemblies and their rigid/flexible setting. Ended up with both set to rigid.
It does that in 2019 also.

Re: make envelope items standard components

Posted: Tue Aug 15, 2023 11:55 am
by Bradfordzzz
josh wrote: Tue Aug 15, 2023 11:31 am You're right. It shouldn't. But it does. At least in 22sp4. I made 2 comps envelope, then suppressed one of them. Selected both, and changed back to non-envelope. The suppressed one became resolved. Did the same thing with a couple subassemblies and their rigid/flexible setting. Ended up with both set to rigid.
It did the same for me ... but in my case it didnt really matter. But its a good thing to be aware of for sure!