Material Search Add-In

Programming and macros
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Material Search Add-In

Unread post by JSculley »

As a result of discussion in this topic I have created a small SOLIDWORKS add-in that replaces the SOLIDWORKS Edit Material dialog with a custom version that allows searching by material name or description:
image.png
The Open Library button will open the standard dialog if you need to access other functionality. The source code and Windows MSI installer can be found in the GitHub repository.

Make feature requests and bug reports via the Issues page.
Tera
Posts: 225
Joined: Fri Mar 19, 2021 4:58 am
Answers: 2
x 483
x 91

Re: Material Search Add-In

Unread post by Tera »

Thanks for the addin. I hope you don't mind several points:
  • I have a triple monitor setup. Solidworks is always on the right monitor. Search Material dialogue box opens on the middle (main) monitor. I drag it to the right one, search and close it. I expect it to be on the right monitor the next time I launch it. But it always opens on the middle monitor. I think everyone prefers to see it where it was closed the last time.
  • After searching, if I click Open Library, Solidworks' native material window opens and the first material is selected. Can it be changed to jump to the searched material? Or adding a double click event to the searched item to open the library to the selected material?
  • Is it possible to change it to Search as you type?
Thanks again.
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

Tera wrote: Fri Jul 08, 2022 7:50 pm Thanks for the addin. I hope you don't mind several points:
  • I have a triple monitor setup. Solidworks is always on the right monitor. Search Material dialogue box opens on the middle (main) monitor. I drag it to the right one, search and close it. I expect it to be on the right monitor the next time I launch it. But it always opens on the middle monitor. I think everyone prefers to see it where it was closed the last time.
  • After searching, if I click Open Library, Solidworks' native material window opens and the first material is selected. Can it be changed to jump to the searched material? Or adding a double click event to the searched item to open the library to the selected material?
  • Is it possible to change it to Search as you type?
Thanks again.
I've created Issues for these items:
The first and third are possible. I'm not sure if the second one is possible, but I will investigate.
Tera
Posts: 225
Joined: Fri Mar 19, 2021 4:58 am
Answers: 2
x 483
x 91

Re: Material Search Add-In

Unread post by Tera »

JSculley wrote: Sat Jul 09, 2022 1:20 pm The first and third are possible. I'm not sure if the second one is possible, but I will investigate.
Thanks
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

Pre-release 0.3 is now available which includes:
  • Search as you type
  • Remembering dialog location, size and settings between invocations
Tera
Posts: 225
Joined: Fri Mar 19, 2021 4:58 am
Answers: 2
x 483
x 91

Re: Material Search Add-In

Unread post by Tera »

JSculley wrote: Thu Jul 21, 2022 2:04 pm Pre-release 0.3 is now available which includes:
  • Search as you type
  • Remembering dialog location, size and settings between invocations
thanks
berg_lauritz
Posts: 423
Joined: Tue Mar 09, 2021 10:11 am
Answers: 6
x 439
x 233

Re: Material Search Add-In

Unread post by berg_lauritz »

This is what the search should look like. Take a look, SolidWorks!
berg_lauritz
Posts: 423
Joined: Tue Mar 09, 2021 10:11 am
Answers: 6
x 439
x 233

Re: Material Search Add-In

Unread post by berg_lauritz »

Some things I noticed:
  1. When you try to change the material from the assembly the "apply" will take you to open the library instead of applying the material to the part
  2. the description is not always shown in the preview window (I have no clue why it sometimes blanks out everything), but it will still search for it correctly!
    2022-08-05 14_33_46-ScreenToGif.png
  3. can you make it so that it will immediately jump into the text field when you open it? That way you don't have to click into the search box anymore
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

berg_lauritz wrote: Fri Aug 05, 2022 4:36 pm Some things I noticed:
I've added these as Issues 4 through 6.
berg_lauritz
Posts: 423
Joined: Tue Mar 09, 2021 10:11 am
Answers: 6
x 439
x 233

Re: Material Search Add-In

Unread post by berg_lauritz »

some more weirdness that might be useful for debugging here:
If I search for the description differently it will show it.

Description shown:
2022-10-17 13_44_00-Window.png
Description not shown:
2022-10-17 13_44_13-Window.png
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

berg_lauritz wrote: Mon Oct 17, 2022 2:49 pm some more weirdness that might be useful for debugging here:
If I search for the description differently it will show it.
OK. I'm pretty sure I know what's going on there. Should be a quick fix.

Also, I have been working on the usage from an assembly issue. I stumbled into a strange SW behavior that I discuss here.

So, the question is, how should this add-in behave when you select multiple components in an assembly and apply a material? I can disable the Config... button easily enough when multiple components are selected, but where would the material then be applied? All configs? The config of the selected component? Whatever setting was used the last time?

If I leave the Config... button enabled, choosing Selected configs would require displaying another dialog listing all the components with their configurations where you can pick and choose. For now I could disable the 'Selected configs' option when multiple components are selected and revisit adding that functionality later.
User avatar
bnemec
Posts: 1942
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2540
x 1398

Re: Material Search Add-In

Unread post by bnemec »

JSculley wrote: Fri Oct 21, 2022 12:15 pm OK. I'm pretty sure I know what's going on there. Should be a quick fix.

Also, I have been working on the usage from an assembly issue. I stumbled into a strange SW behavior that I discuss here.

So, the question is, how should this add-in behave when you select multiple components in an assembly and apply a material? I can disable the Config... button easily enough when multiple components are selected, but where would the material then be applied? All configs? The config of the selected component? Whatever setting was used the last time?

If I leave the Config... button enabled, choosing Selected configs would require displaying another dialog listing all the components with their configurations where you can pick and choose. For now I could disable the 'Selected configs' option when multiple components are selected and revisit adding that functionality later.
The table would be top notch option. Each of the configs of the each of the selected parts could be set individually or set the material for a column (all configs in the part get same material) or by row (all parts for that config get same material). I'd guess that's a lot of programming work and possibly unearths more cases to deal with or unexpected behavior when your add-in tires to effect the changes that the new, totally awesome, finely polished UI just gathered from the user.

Or you could just implement the new functionality quick and dirty for the use case that made the most noise or verbatim of how the SPR is written, where the test case has more threads dangling loose than hemmed in. Then just let the user base discover the pseudorandom behavior fanout. I mean that's more in line with what we're used to from the OEM.
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

How about a tree like this for a solution:
image.png
The default is the checked config is the configuration in the assembly of the selected component. Checking the ABC.sldprt checkbox applies to all configs. Otherwise, pick and choose.
berg_lauritz
Posts: 423
Joined: Tue Mar 09, 2021 10:11 am
Answers: 6
x 439
x 233

Re: Material Search Add-In

Unread post by berg_lauritz »

I love the tree option for this one - especially if you have nested configurations.
Of course having the option to set a default would be nice and probably the best option. I read your linked post an I'm disappointed again about how many settings/hidden settings are only on a document level in Solidwrecks.
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

berg_lauritz wrote: Fri Oct 21, 2022 2:18 pm I love the tree option for this one - especially if you have nested configurations.
Of course having the option to set a default would be nice and probably the best option. I read your linked post an I'm disappointed again about how many settings/hidden settings are only on a document level in Solidwrecks.
FYI: I have the fixes for the description problem and having the cursor in the search box when the dialog opens. I also made it so that if you double click the selected material it applies it and closes the dialog. I'll try to get this config thing sorted out and push out a new release next week unless something urgent comes up.
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

Getting closer, but there is a lot of strange behavior when setting materials for bodies from inside assemblies. Still trying to sort out if it's on SOLIDWORKS end or my end.
image.png
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

Long time, no update, but we've been busy here.

Setting materials for bodies turned into a bit of a mess due to a deficiency in the API. Essentially, you cannot set the material for a body for any configuration other than the active configuration via the API. So, if bodies are selected I have disabled the 'Config' button.

There's a new release available for download which:
  • fixes the description bug
  • makes the search box the active control when the dialog is opened
  • adds support for applying materials while working in assemblies
Since working from assemblies has exploded the number of different ways to apply materials, it is quite likely that some of them will not work (due to the API deficiency noted above) or due to some other undiscovered bug or API issue. If something strange happens, let me know.

New release can be downloaded here:

https://github.com/jsculley/MaterialSea ... es/tag/0.4
User avatar
loeb
Posts: 68
Joined: Sun Jan 16, 2022 5:55 pm
Answers: 1
x 39
x 10

Re: Material Search Add-In

Unread post by loeb »

Because of my company's security policy, installing an MSI is difficult/impossible for apps that are not trusted. Is a standalone version possible?
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

loebotomy@gmail.com wrote: Tue Mar 28, 2023 8:58 am Because of my company's security policy, installing an MSI is difficult/impossible for apps that are not trusted. Is a standalone version possible?
Can you read/write to the registry via the Registry Editor? If so, I can provide instructions on how to manually 'install' the add-in.
User avatar
loeb
Posts: 68
Joined: Sun Jan 16, 2022 5:55 pm
Answers: 1
x 39
x 10

Re: Material Search Add-In

Unread post by loeb »

JSculley wrote: Tue Mar 28, 2023 10:07 am Can you read/write to the registry via the Registry Editor? If so, I can provide instructions on how to manually 'install' the add-in.
Yes, I can do that (so far). That would be great! Thank you.
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

loebotomy@gmail.com wrote: Wed Mar 29, 2023 11:51 pm Yes, I can do that (so far). That would be great! Thank you.
I will upload the DLL file next week. You should be able to open it in SW with File...Open and it will add itself in the Registry.
User avatar
JSculley
Posts: 641
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 874

Re: Material Search Add-In

Unread post by JSculley »

The DLL and instructions on how to register it are now here:

https://github.com/jsculley/MaterialSea ... es/tag/0.4
User avatar
loeb
Posts: 68
Joined: Sun Jan 16, 2022 5:55 pm
Answers: 1
x 39
x 10

Re: Material Search Add-In

Unread post by loeb »

JSculley wrote: Thu Apr 06, 2023 7:50 am The DLL and instructions on how to register it are now here:

https://github.com/jsculley/MaterialSea ... es/tag/0.4
Thank You!
Post Reply