Select Components

Library for macros
User avatar
Rob
Posts: 128
Joined: Mon Mar 08, 2021 3:46 pm
Answers: 2
Location: Mighty Glossop, UK
x 787
x 208
Contact:

Select Components

Unread post by Rob »

Maybe I skipped class on this one, but I couldn't find an easy way to select components (No component filter).

Problem: When selecting components from the Graphics Area, the selections are the actual entities of the components.

Illustrated here when saved as a Selection Set.
image.png
image.png (7.09 KiB) Viewed 1888 times
The attached macro will upgrade your selections to the component level - and optionally allow you to save the selection.

So with the same selections as before
image.png
image.png (5.32 KiB) Viewed 1888 times
note that the first selection had two entities from the same component - so the total was reduced to 3.

Hope you find it useful - or can tell me a better way
Attachments
SelectComponents.zip
(10.43 KiB) Downloaded 102 times
User avatar
DanPihlaja
Posts: 849
Joined: Thu Mar 11, 2021 9:33 am
Answers: 25
Location: Traverse City, MI
x 812
x 979

Re: Select Components

Unread post by DanPihlaja »

So question:
Why do you specifically need to select the component?

The reason that I ask, is that normal assembly functions (like copy with mates, copy/paste, change transparency, hide, suppress, etc...) are applied at the component level even though you have selected a face of that part.
-Dan Pihlaja
Solidworks 2022 SP4

2 Corinthians 13:14
User avatar
Rob
Posts: 128
Joined: Mon Mar 08, 2021 3:46 pm
Answers: 2
Location: Mighty Glossop, UK
x 787
x 208
Contact:

Re: Select Components

Unread post by Rob »

dpihlaja wrote: Fri May 07, 2021 8:41 am So question:
Why do you specifically need to select the component?

The reason that I ask, is that normal assembly functions (like copy with mates, copy/paste, change transparency, hide, suppress, etc...) are applied at the component level even though you have selected a face of that part.
Mostly for good organisation / ease of identification - I've since added the functionality to add to a folder - which is better than selection sets because the components are reordered in the tree and I can hide or suppress en-masse.

If you select faces then the component is highlighted in the tree, but edges or vertices do not have the same behaviour.
Since I discovered that folders are as good if not better than selection sets I could perform the same job by the UI, but this is still nicer / faster.

I'm dealing with a lot of tiny fixings that are added to the assembly in an ad-hoc manner - they're a reet pain to deal with.
image.png
Ultimately this macro is part of a wider suite I am writing that attempts to automate the tedium. Having a selection set or folder is a nice way for me to provide a group of components as input to another macro.

For example, the next step in this process is to rotate each of these as the pattern in the top left - but differing by a small random amount - I did that manually a couple of times and it was enough
User avatar
Tom G
Posts: 355
Joined: Tue Mar 09, 2021 9:26 am
Answers: 0
Location: Philadelphia, PA area
x 989
x 466

Re: Select Components

Unread post by Tom G »

I usually select them in the FM assembly tree.

Appearances is one example where I would want something like paint applied to the whole component, not to selected faces and entities.

**If it helps, I'd trash that ad-hoc manner by selecting sets (rows, orientations, w/e) and establishing some folders. Conditions apply whether this task would be worth the effort.* *
Edit: oops, that IS what you are doing.
User avatar
Tom G
Posts: 355
Joined: Tue Mar 09, 2021 9:26 am
Answers: 0
Location: Philadelphia, PA area
x 989
x 466

Re: Select Components

Unread post by Tom G »

Rob wrote: Fri May 07, 2021 9:36 am Ultimately this macro is part of a wider suite I am writing that attempts to automate the tedium. Having a selection set or folder is a nice way for me to provide a group of components as input to another macro.
I do really wish that I could select only a folder and thereby select all its contents (not only highlight it in view), but accept that folders make selecting related items easier already.
User avatar
Rob
Posts: 128
Joined: Mon Mar 08, 2021 3:46 pm
Answers: 2
Location: Mighty Glossop, UK
x 787
x 208
Contact:

Re: Select Components

Unread post by Rob »

Tom G wrote: Fri May 07, 2021 9:46 am I do really wish that I could select only a folder and thereby select all its contents (not only highlight it in view), but accept that folders make selecting related items easier already.
..and that's a great idea for another macro :D
Post Reply