Special sorting in bills of materials

Hello

I would like to make a special sorting in my nomenclatures and I can't find solutions. I believe this is a possibility provided by MyCADTools but I don't have it.
I have a coding system for my article references as follows:
- AXXXXXXX for assemblies
- CXXXXXXX for commercial parts
- PXXXXXXX for off-plan parts
- VXXXXXXX for screws
However, I would like the articles to be sorted in order A/P/C/V in my nomenclatures.
Is this possible via Solidworks features? If not, is it possible via a macro?

Thank you in advance for your answers.

Hello

I think you can create a new column, which you name let's say "priority", set the value 1 to the A, 2 to the P, 3 to the C, and 4 to the V, hide the column, and then sort the "priority" column with the "numeric" method.

5 Likes

Hello and thank you,

I had indeed thought of this solution. But this would require taking all the files in my database to integrate this variable.
So good idea but that I will only use if there is no other less expensive solution

Are XXX still just numbers?

Is there already a variable in your pieces that only indicates "A" or "C" without the rest of the reference?

In case the answer to question 1 is yes, and you have a different version of SW than mine (which is not fucked up to solve a concatenation in a condition, y drives me crazy this bug), I suggest you test this equation, in the "priority" column:

IF('ref'="A"#'ref'+0; 1; IF('ref'="P"#'ref'+0; 2; IF('ref'="C"#'ref'+0; 3; IF('ref'="V"#'ref'+0; 4; 5))))

simply change the 'refs' to the column that contains your references (Axxxxx).

In theory it should work, but in practice if it is buggy and does not concatenate in the condition no...

Explanation of the equation:

IF the current row value of the ref column is equal to the letter A plus the numeric part of the value then assign the priority column of the >current row to 1 OTHERWISE IF the same test with the letter P succeeds it assigns priority 2 > OTHERWISE IF the same test with C succeeds it assigns priority 3 > OTHERWISE IF the same test with V succeeds it assigns priority 4 > OTHERWISE assigns priority to 5.

The purpose of this equation is to automatically populate the priority column with values corresponding to the references. The manual creation of the priority + sorting column mentioned above remains relevant of course.

2 Likes

Indeed, XXXXXXX of my codification is only in digital.

I tried your formula and the concatenation doesn't work... But this solution would suit me perfectly!!

Wouldn't the easiest thing be to sort by the column containing your article references?

Right click on the nomenclature, choose sort and select the column that goes well (or can also do successive sorting: column 3 then column 5 if you want)

Hello @froussel 

The problem here is that the sorting is only done in alphabetical or numerical order. And since the desired order A, P, C, V is not in alphabetical order, the result of the sorting will give A, C, P, V, so it doesn't work.

Given the outrageous limitations of the equations, I believe that the only way other than adding the variable to your files is going to be a macro that will populate the priority column based on the reference letter.

I'm sure it's very easy to do but having never done a macro for SW before I can't serve it hot on a platter. I'm going to work on it, unless a member can.

I @PACOSPHARM imagine that if you prefer automation, it's because your bills of materials are too long to fill in the priority column by hand?

Quite @Sylk !!

I have a large number of nomenclatures with more than 100 references...

Hello @PACOSPHARM would it be possible to have a screenshot of the layout of the columns of your standard BOM (with the reference column)?

Do you use BOMs in drawings only?

Out of conscience, did you keep the apostrophes when you tested the above-mentioned equation?

Hello

@Sylk: I had missed the fact that the desired order was not alphabetical indeed.

A 'simple' solution would be to abandon the Solidworks tables and go back to the Excel tables.

In Excel it is easy to make a formula to give a value to the rows according to the value of the first letter (thanks to the "left" and "IF" functions). Simply sort by this column to get the order you want.

This should mean that the table must be systematically re-sorted each time the nomenclature is changed.

Nb: the columns behind the one named $$END do not appear, which allows you to hide the sort column on the map

Hello @Sylk 

Yes, I paid attention to the whole synthaxis.

Here is the nomenclature table:

And yes, I use bills of materials only on drawings

Hello @PACOSPHARM 

So the easiest thing I think in this case is to go through the Solidworks Task Scheduler to make a bulk addition of a custom property to the very many parts, then to sort the bills of materials based on the value of this property.

 

1: Open the Solidworks Task Scheduler (start menu > all programs > SOLIDWORKS Tools > SOLIDWORKS Task Scheduler)

2: In the side panel, choose Update Custom Properties

3: In the dialog box, click on the Add File button... select all the parts A and then open

4: Click the Next button

5: In the Name column type the word sort, in the Type column choose Number, and in the Value column type the number 100 and then click the Finish button to run the task.

6: Repeat steps 2 to 5 for P parts with the value 200

7: Repeat steps 2 to 5 for C parts with the value 300

8: Repeat steps 2 to 5 for V parts with the value 400

 

When all tasks have completed their execution:

1: Open a Drawing

2: Insert a new column (on the right) to the BOM, then in the small menu that appears select Custom Property for Column Type, and in Property Name select sorting

3: Right-click on the BOM > Sort.

4: Sort by: sort. Check Croissant and Numeric Method, then OK

5: Finish by hiding the column: Right-click on the letter of the column "sort" > Hide > Column

That's it, you will now have the desired sort order.

 

Note: The 100-fold increment in the sort value assigned to the part types is not insignificant on my part. Unless you are absolutely certain that you will never have more than these 4 types of parts (APCV) to process, I recommend this system to make possible future insertions of new types more flexible. 99 new types can then be inserted between each. For example, if you have a new reference Y and you want to classify it between P and C, you assign it the intermediate sort value 250, thus leaving room between P and Y, and between Y and C. A new reference Z to be classified between P and Y will take the intermediate value 225. Etc. This system leaves a good deal of leeway before being forced to change sorting values that are already assigned. Of course, the higher the increment, the longer the system will be flexible.

Kind regards

1 Like