How do you add the correct material

Use this space to ask how to do whatever you're trying to use SolidWorks to do.
berg_lauritz
Posts: 423
Joined: Tue Mar 09, 2021 10:11 am
Answers: 6
x 441
x 235

How do you add the correct material

Unread post by berg_lauritz »

So....
We upgraded yesterday to SolidWorks 2021 and now we will finally be able to link the materials to a gauge table & with this to the thickness (FINALLY!).
Also we are finally able to search for materials in the database - or so we thought:

SolidWorks only allows to search for the TITLE of the material, but not for the description. Which does not help us a lot, because we do not want to name our materials "[material#]-[description]". I cannot believe honestly, that they only allow to search for the title within an .XML file.

LIKE... COME ON! grumph grumph grumph o[ <()>

The goal is to have the correct Material in there, that is used on the floor (a.k.a. the material #) or a material group that can easily be identified (i.e LEATHER (of no specific color)). This is so that we only have to enter this material once and not show the description with it all the time. Plus it would show on the BOM correctly for everybody.

How do you deal with this? Do you search outside of SolidWorks for the material number & assign it then through your own?
Is there a tool, that will let you search properly for the material?
How do you deal with this problem?
Do you just make folders with the description in it? i.e. alum. -> angle -> 9 -> 6 -> .25 -> [material#]
This way you can search for it at least....
by JSculley » Fri Jul 08, 2022 1:17 pm
AlexLachance wrote: Fri Jul 08, 2022 10:34 am I don't know if it's possible, but perhaps you should rename your topic title to reflect your add-in's capacities rather then have it be the question that caused you to create this. You could also add to your original post the link to the Prerelease. so that it is "easier" to find, if this ever picks up a lot of attention.
I've added a separate ' announcement' post in the API topic.
Go to full post
User avatar
jcapriotti
Posts: 1802
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 29
Location: The south
x 1140
x 1947

Re: How do you add the correct material

Unread post by jcapriotti »

We put what we need in the Name. I'm guessing the search is not looking at the XML, just the tree structure at run-time which is why its not seeing the other properties such as description. FWIW, Inventor did find it so its searching for more than just the name although not every property. Solid Edge had no search option.
Jason
berg_lauritz
Posts: 423
Joined: Tue Mar 09, 2021 10:11 am
Answers: 6
x 441
x 235

Re: How do you add the correct material

Unread post by berg_lauritz »

jcapriotti wrote: Fri Oct 22, 2021 5:06 pm We put what we need in the Name. I'm guessing the search is not looking at the XML, just the tree structure at run-time which is why its not seeing the other properties such as description. FWIW, Inventor did find it so its searching for more than just the name although not every property. Solid Edge had no search option.
So if you call out the material it would say:

Code: Select all

123-456789 Aluminum 1/8" Tread Plate
?

It's just that we already have 'correct' Material number that we would like to use, because the shop floor uses it. It's actually more work for them to look it up all the time.
User avatar
jcapriotti
Posts: 1802
Joined: Wed Mar 10, 2021 6:39 pm
Answers: 29
Location: The south
x 1140
x 1947

Re: How do you add the correct material

Unread post by jcapriotti »

berg_lauritz wrote: Mon Oct 25, 2021 9:05 am So if you call out the material it would say:

Code: Select all

123-456789 Aluminum 1/8" Tread Plate
?

It's just that we already have 'correct' Material number that we would like to use, because the shop floor uses it. It's actually more work for them to look it up all the time.
Mostly we handle the material BOM manually but are moving toward automating it more.

Our shop doesn't see the Solidworks material name. The material in SolidWorks is based on an engineering material specification document that could cover a range of material form factors. This number and it's description is added as a custom property in the SWX material database. We pull these values with the API to apply it to the regular custom properties.
image.png
The factory might have have several material part numbers for this material that is added by them in the Mfg BOM. For example, for the above "HR Sheet grade 50" they have different gauges and even different stock sheet sizes (36x48, 48x72, etc.). This is done outside of SolidWorks in the MBOM.
Jason
Jim Steinmeyer
Posts: 93
Joined: Thu Mar 11, 2021 4:35 pm
Answers: 0
x 461
x 93

Re: How do you add the correct material

Unread post by Jim Steinmeyer »

We give all of our parts, and materials a 6 digit number. For assigning materials for plate and sheetmetal we create them as sheet metal and then have a gage table for the different materials as well as gage or plate. We then have a macro that will assign the material number and description based on the selected table. Of course this only works for plate and sheet so there are lots of additional materials that require the user lookup a chart and enter the information. For many of those materials we have a small model saved in the design library and do a save as to have the correct shape and material information in the properties. We then change to the correct length.
User avatar
JSculley
Posts: 606
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 8
x 837

Re: How do you add the correct material

Unread post by JSculley »

berg_lauritz wrote: Fri Oct 22, 2021 12:56 pm So....
We upgraded yesterday to SolidWorks 2021 and now we will finally be able to link the materials to a gauge table & with this to the thickness (FINALLY!).
Also we are finally able to search for materials in the database - or so we thought:

SolidWorks only allows to search for the TITLE of the material, but not for the description. Which does not help us a lot, because we do not want to name our materials "[material#]-[description]". I cannot believe honestly, that they only allow to search for the title within an .XML file.

LIKE... COME ON! grumph grumph grumph o[ <()>

The goal is to have the correct Material in there, that is used on the floor (a.k.a. the material #) or a material group that can easily be identified (i.e LEATHER (of no specific color)). This is so that we only have to enter this material once and not show the description with it all the time. Plus it would show on the BOM correctly for everybody.

How do you deal with this? Do you search outside of SolidWorks for the material number & assign it then through your own?
Is there a tool, that will let you search properly for the material?
How do you deal with this problem?
Do you just make folders with the description in it? i.e. alum. -> angle -> 9 -> 6 -> .25 -> [material#]
This way you can search for it at least....
I whipped up an add-in that will let you search for text in the material name or description. The basic building blocks are in place but I 'm curious on how you would like it to work. Would you prefer a tree structure that narrows itself down as you type your search terms like the current name search does? The problem with that is that if the tree lists just material names and a description matches, it might not be obvious that it's a correct match. Another option is to simply have a search form that then lists the results in a tabular form showing name, description, etc and then you could select from the list to apply the material.
berg_lauritz
Posts: 423
Joined: Tue Mar 09, 2021 10:11 am
Answers: 6
x 441
x 235

Re: How do you add the correct material

Unread post by berg_lauritz »

JSculley wrote: Mon Oct 25, 2021 2:26 pm I whipped up an add-in that will let you search for text in the material name or description. The basic building blocks are in place but I 'm curious on how you would like it to work. Would you prefer a tree structure that narrows itself down as you type your search terms like the current name search does? The problem with that is that if the tree lists just material names and a description matches, it might not be obvious that it's a correct match. Another option is to simply have a search form that then lists the results in a tabular form showing name, description, etc and then you could select from the list to apply the material.
If we could search for a description - that would solve almost all of our problems! Is it within Solidworks?

@jcapriotti I love your idea (exactly what we would need) but I don't like that it requires an extra step. But is seems that there is no good solution currently.
We will talk with BOM about that & maybe we can come up with a good solution.
User avatar
JSculley
Posts: 606
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 8
x 837

Re: How do you add the correct material

Unread post by JSculley »

berg_lauritz wrote: Tue Oct 26, 2021 4:59 pm If we could search for a description - that would solve almost all of our problems! Is it within Solidworks?
Yes. As a SOLIDWORKS add-in it can be a menu item, toolbar button, etc. I played around with having it pop up when 'Edit Material' is selected, but the results weren't satisfactory (two dialogs showing, one dropping into the background). I haven't given up on that approach entirely but I suspect it isn't doable.
User avatar
JSculley
Posts: 606
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 8
x 837

Re: How do you add the correct material

Unread post by JSculley »

JSculley wrote: Tue Oct 26, 2021 5:24 pm I haven't given up on that approach entirely but I suspect it isn't doable.
Actually it is quite doable. I just needed to read the API docs more carefully. Edit Material now brings up this dialog:
image.png
And search results look like this:
image.png
So...progress.
berg_lauritz
Posts: 423
Joined: Tue Mar 09, 2021 10:11 am
Answers: 6
x 441
x 235

Re: How do you add the correct material

Unread post by berg_lauritz »

JSculley wrote: Tue Oct 26, 2021 7:31 pm Actually it is quite doable. I just needed to read the API docs more carefully. Edit Material now brings up this dialog:

image.png

And search results look like this:

image.png

So...progress.
Is this on GIT? Which language are you writing it in? C#?
Man, I wish I could help you with this. It looks VERY promising!
User avatar
JSculley
Posts: 606
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 8
x 837

Re: How do you add the correct material

Unread post by JSculley »

berg_lauritz wrote: Wed Oct 27, 2021 10:10 am Is this on GIT? Which language are you writing it in? C#?
Man, I wish I could help you with this. It looks VERY promising!
It is C#. I've got the dialog all working correctly. Next is to pass the info back to SOLIDWORKS to apply the material. I have to do a little more work to differentiate between applying to part/bodies and to handle applying to current config/all configs/selected configs. I'll probably add another button to the form that works exactly like the one in the SW dialog:
image.png
Also, storing some of the state between subsequent calls so that it remembers dialog size, selected libraries, etc...
User avatar
bnemec
Posts: 1890
Joined: Tue Mar 09, 2021 9:22 am
Answers: 10
Location: Wisconsin USA
x 2485
x 1361

Re: How do you add the correct material

Unread post by bnemec »

JSculley wrote: Wed Oct 27, 2021 10:26 am It is C#. I've got the dialog all working correctly. Next is to pass the info back to SOLIDWORKS to apply the material. I have to do a little more work to differentiate between applying to part/bodies and to handle applying to current config/all configs/selected configs. I'll probably add another button to the form that works exactly like the one in the SW dialog:

image.png

Also, storing some of the state between subsequent calls so that it remembers dialog size, selected libraries, etc...
I've been getting pressure to do something with our materials "DB". As the list grows and is not sorted people are not finding the correct material or asking for existing material to be added. If it would be possible to work together I'll do what I can.
User avatar
JSculley
Posts: 606
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 8
x 837

Re: How do you add the correct material

Unread post by JSculley »

bnemec wrote: Thu Dec 02, 2021 1:32 pm I've been getting pressure to do something with our materials "DB". As the list grows and is not sorted people are not finding the correct material or asking for existing material to be added. If it would be possible to work together I'll do what I can.
I haven't had time to work on this due to a large looming project deadline, but I do plan on getting back to it, hopefully before the end of the year or early in the new year.
User avatar
JSculley
Posts: 606
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 8
x 837

Re: How do you add the correct material

Unread post by JSculley »

I've finally gotten around to putting together an installer and pushing this to GitHub. The 2022 version is available on the develop branch. I will create an official 0.1 tag and preliminary release tomorrow. If you need a version for a different SW version, submit an Issue
User avatar
JSculley
Posts: 606
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 8
x 837

Re: How do you add the correct material

Unread post by JSculley »

Prelease v0.2 which includes the Windows Installer for the add-in is now available here
User avatar
AlexLachance
Posts: 2056
Joined: Thu Mar 11, 2021 8:14 am
Answers: 17
Location: Quebec
x 2203
x 1902

Re: How do you add the correct material

Unread post by AlexLachance »

I don't know if it's possible, but perhaps you should rename your topic title to reflect your add-in's capacities rather then have it be the question that caused you to create this. You could also add to your original post the link to the Prerelease. so that it is "easier" to find, if this ever picks up a lot of attention.
User avatar
JSculley
Posts: 606
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 8
x 837

Re: How do you add the correct material

Unread post by JSculley »

AlexLachance wrote: Fri Jul 08, 2022 10:34 am I don't know if it's possible, but perhaps you should rename your topic title to reflect your add-in's capacities rather then have it be the question that caused you to create this. You could also add to your original post the link to the Prerelease. so that it is "easier" to find, if this ever picks up a lot of attention.
I've added a separate ' announcement' post in the API topic.
User avatar
AlexB
Posts: 459
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 25
x 249
x 406

Re: How do you add the correct material

Unread post by AlexB »

bnemec wrote: Thu Dec 02, 2021 1:32 pm I've been getting pressure to do something with our materials "DB". As the list grows and is not sorted people are not finding the correct material or asking for existing material to be added. If it would be possible to work together I'll do what I can.
I know this is an old post, but I put something together a while back that sorts the existing material DB and them puts a sorted version of the file on your desktop (if you want to compare to make sure stuff isn't missing)

Not sure if you have visual studio installed but this works as a simple console app. I've also attached the console application zipped .exe file if you want that.

Code: Select all

using System;
using System.IO;
using System.Linq;
using System.Xml.Linq;

namespace Material_Database_Sorter
{
    internal class Program
    {
        static void Main()
        {
            Console.WriteLine("Please type the URL or your Material Database:");
            string myURL = Console.ReadLine().Trim();
            if (File.Exists(myURL))
            {
                SortXmlNodes(myURL);
            }
            else
            {
                Console.WriteLine("File does not exist");
            }
        }
        static void SortXmlNodes(string docUrl)
        {
            var xDoc = XDocument.Load(docUrl);
            var parent = xDoc.Elements().FirstOrDefault();
            var comparer = StringComparer.Create(System.Globalization.CultureInfo.CurrentCulture, true);
            var sortedNodes = parent.Elements().OrderBy(node => node.Name.LocalName, comparer);

            parent.ReplaceNodes(sortedNodes);

            foreach (var node in sortedNodes)
            {
                if (node.Name.LocalName == "classification")
                {
                    var sortedChildren = node.Elements().OrderBy(element => element.Attribute("name").Value, comparer);
                    node.ReplaceNodes(sortedChildren);
                }
            }

            string newFileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Sorted_" + Path.GetFileName(docUrl));
            xDoc.Save(newFileName);
        }
    }
}
Attachments
Material Database Sorter.zip
(2.99 KiB) Downloaded 106 times
berg_lauritz
Posts: 423
Joined: Tue Mar 09, 2021 10:11 am
Answers: 6
x 441
x 235

Re: How do you add the correct material

Unread post by berg_lauritz »

Thank you @JSculley for the amazing add in that I'll be using from now on!

Here the link to the topic!
Post Reply