-
Re: Chunking Up Properties
Nilesh Patel May 30, 2018 6:31 AM (in response to Michael Ferraro)Could you attach your part and then try to explain in detail what do you mean by Major length and Minor length?
-
Re: Chunking Up Properties
Michael Ferraro May 30, 2018 8:14 AM (in response to Nilesh Patel)I can here we go.
We have an ERP system that was recently implemented which caused a couple opportunities to be had. One of which is parts that get cut to length. There is only one field for "Quantity" so my thought was to put the length in the part number (in this case like SP-0001-092-05 which would stand for 92 and 5/32 long). And then the quantity could be how many I need at that length since there is not another field.
What we have been doing up to this point is so that we can get the total material requirement would would just multiply the 2 numbers together and put that in the quantity field and then just make a spreadsheet on the side for the breakdown. I am trying to eliminate that step.
The goal is to take the length of the part and create its part number. The resulting combination would go into a custom property called "Supplier Part Number"
So here are two examples
Length = 120"
Major Length = 120
Minor Length = 00
Supplier Part Number = SP-0001-120-00
Length = 92.15625"
Major Length = 092
Minor Length = 05
Supplier Part Number = SP-0001-092-05
Does that make sense?
-
LIB SP-0001-XXX-XX.SLDPRT.zip 67.9 KB
-
Re: Chunking Up Properties
Glenn Schroeder May 30, 2018 8:24 AM (in response to Michael Ferraro)It makes sense, sort of, but I don't think you're going to be able to do that (unless maybe a macro?). Why not just let your Supplier Part Number be SP-0001-092.15625?
-
Re: Chunking Up Properties
Michael Ferraro May 30, 2018 8:50 AM (in response to Glenn Schroeder)That is currently my back up plan.
Our part number field has a 17 character limit (dumb I know). The set up I listed (SP-0001-AAA-BB) is 14 characters. The one you just listed is 17, which obviously works I was just trying to see if I could keep a small buffer in there in the event something came up and I needed to steel some more characters.
However, I wasn't sure I knew how to keep it to be AAA.BBBBB. I thought the part number would end up being different lengths i.e.
SP-0001-24
SP-0001-24.03125
SP-0001-24.0625
SP-0001-24.125
etc.
Is there a way to keep it to SP-0001-AAA-BBBBB?
Thanks,
Pencil
-
Re: Chunking Up Properties
Glenn Schroeder May 30, 2018 8:55 AM (in response to Michael Ferraro)Michael Ferraro wrote:
That is currently my back up plan.
Our part number field has a 17 character limit (dumb I know). The set up I listed (SP-0001-AAA-BB) is 14 characters. The one you just listed is 17, which obviously works I was just trying to see if I could keep a small buffer in there in the event something came up and I needed to steel some more characters.
However, I wasn't sure I knew how to keep it to be AAA.BBBBB. I thought the part number would end up being different lengths i.e.
SP-0001-24
SP-0001-24.03125
SP-0001-24.0625
SP-0001-24.125
etc.
Is there a way to keep it to SP-0001-AAA-BBBBB?
Thanks,
Pencil
You could try setting trailing zeros to "Show" at Tools > Options > Document Properties > Dimensions, but I'm not sure it would carry over.
Jeff Mirisola wrote a very good blog post a few years ago about trying to make file names too fancy. I wish I could link to it, but it's no longer active.
-
-
-
-
-
Re: Chunking Up Properties
Jim Steinmeyer May 30, 2018 8:48 AM (in response to Michael Ferraro)This sounds like what you are looking for is a Cut List. If you create your parts as a weldment your part number would be the shape with the length attached. You are able to add additional properties if wanted and you can create custom shapes that would have custom descriptions for the first part of the part number if desired. Glenn Schroeder can talk more about as I do not use them as cut lists do not work for us.
-
Re: Chunking Up Properties
Michael Ferraro May 30, 2018 8:51 AM (in response to Jim Steinmeyer)Yea weldments do not work for us either. But you are correct that I am essentially trying to use the idea of a cut list without the rest of "cut lists".
Thanks,
Pencil
-
-
Re: Chunking Up Properties
Greg H. May 30, 2018 9:15 AM (in response to Michael Ferraro)Which part are you having trouble with, creating the desired values for AAA & BB or inserting the values into a part number (or both)?
-
Re: Chunking Up Properties
Michael Ferraro May 30, 2018 9:29 AM (in response to Greg H.)The two options are as follows:
SP-0001-AAA-BB
or
SP-0001-AAA.BBBBB
I can do the 2nd one easily (with it actually looking like SP-0001-AA.BBBBB, then SP-0001-AA.BBBB, etc)
I would LOVE if I can do the first one, but I haven't had a solution that works without configurations / code both of which I would like to dodge. I try to avoid smart numbers here whenever possible however, I can solve like 5 problems at once on this part in doing so, so its worth the investigation.
The problem I am having is creating the AAA and BB in the first option. Once I create both of those values in a custom property I can handle the rest without issue. I just don't know how to make the AAA property or the BB property.
-
Re: Chunking Up Properties
Nilesh Patel May 31, 2018 12:43 AM (in response to Michael Ferraro)Hi Michael,
Have a look at the attached part. I can get "92" and "5". I will play around to see if I can get "092" and "05". Have a look at the custom properties and equation manager.
Regards,
Nilesh
-
LIB SP-0001-XXX-XX.SLDPRT.zip 73.1 KB
-
Re: Chunking Up Properties
Michael Ferraro May 31, 2018 8:57 AM (in response to Nilesh Patel)o man that is awesome. That is closer than I have gotten that may just be the answer. I will do some testing but I think you may have it!
-
Re: Chunking Up Properties
Casey Bergman May 31, 2018 9:58 AM (in response to Nilesh Patel)Can you explain what you did for those of us still using older versions of Solidworks?
-
Re: Chunking Up Properties
Greg H. May 31, 2018 10:22 AM (in response to Casey Bergman)I have not opened Nilesh's part but one way to do it is through the following equations:
Assume "Length" is the length of the part that we want broken down into two segments.
X=int ("Length") [returns the value left of the decimal, in this case 92]
Y=("Length"-"X)*32 [returns the numerator of the fraction over 32. You can take it a step further & add" int()" to it, for instances of decimals that don't evenly divide into 32, i.e. .105 would return 3]
The trick is, and I have not been able to do it thus far, is to add the leading "0" to the number. My attempts via a design table do not auto-update & I haven't been able to make the properties smart enough to know how many "0" it needs yet.
-
Re: Chunking Up Properties
Michael Ferraro May 31, 2018 12:58 PM (in response to Greg H.)That is what he did. I am also trying to see if I can get the zeroes in and have been unsuccessful. I can do it with the "0"'s in the design table but since it doesn't automatically update it doesn't do me any good.
So I am still trying to figure out how to do it in properties.
-
Re: Chunking Up Properties
Greg H. May 31, 2018 2:36 PM (in response to Michael Ferraro)I GOT IT!
I tried a few length combo's, you may want to try some more to stress test it, but this concept should do the trick. You also may want to add an additional variable for "int(D1@Sketch1)" as it's used several places. I had to add 3 of those "int"s after 99.9 would turn into 100 for AAA.
I also added a Denominator variable, so the BB sizing could be done by 1/4, 1/8, 1/32, 1/10, etc. for different parts.
For those who don't want to be bothered downloading the file &/or do not have 2017, here is a picture of the variables & Properties (99 29/32" shown):
Phew!
This was a good learning exercise for myself as well.
Edit:
Here's what I did:
Instead of adding zero's in front of the number, I broke the number down into 1 digit parts. There is a hidden round function not listed in SW but it can only round to a specific decimal, so I could turn 47.65 into 47.7, but couldn't turn it into 50. To work around that, I divided the number by it's know max digits, so 47.65 would turn into .4765 before rounding. thus we can round to .5 & then multiply by 10 to get the single digit of 5. But in that example, we want the answer to be 4, so the int command is used. Lastly, I would subtract the leading digit from the total number to get the next digit, i.e. 47.65-40 = 7.65 & then repeat the above processing.
-
Part3.zip 39.5 KB
-
Re: Chunking Up Properties
Michael Ferraro May 31, 2018 4:02 PM (in response to Greg H.)Greg,
I was putting the part through its paces, and it looks like there are some situations where this doesn't work.
I downloaded your part to make sure I didn't screw up an equation on my end and if you put in a value of 99 even as an example, it looks like it spits out SP-0001-098-32 when it should be SP-0001-099-00. There may be a few other instances as well but not sure where the odd behavior resides.
-
Re: Chunking Up Properties
Greg H. May 31, 2018 4:11 PM (in response to Michael Ferraro)Interesting. Well we're close. I'll try to look into it tomorrow. If you come up with a fix, let me know!
There maybe a way to fix the equations outright, or we may need to add an integer pass to start with, i.e. "if dimension- int(dimension) = 0, then +1" or something to that effect.
-
Re: Chunking Up Properties
Rob Edwards May 31, 2018 4:33 PM (in response to Michael Ferraro)Hi Michael
Sorry I don't have the spare brain capacity at the moment to work out your example (It's been a long day!) but I recall when I use INT for working out the number of treads in a staircase I have to account for the special case when the number divides exactly. I guess you have a similar situation going on.
My solution is to add an IFF statement.
Your situation is different but I'm pretty certain an IFF or two would fix it
-
Re: Chunking Up Properties
Greg H. May 31, 2018 4:37 PM (in response to Rob Edwards)Yay Rob! Thought that might be the case. Thanks for confirming.
-
Re: Chunking Up Properties
Rob Edwards May 31, 2018 4:39 PM (in response to Greg H.)Hi Greg
I got distracted and didn't see your response until I'd posted.
It's a nice job you've done there
-
Re: Chunking Up Properties
Greg H. May 31, 2018 4:42 PM (in response to Rob Edwards)No, no, I was just theorizing, your example confirms that we need to do the pass. That will save a lot of time! Cheers!
-
Re: Chunking Up Properties
Michael Ferraro Jun 1, 2018 8:24 AM (in response to Greg H.)I am not sure I follow how to correct the issue, I kept playing with the part for a few more hours last night and wasn't sure how to get it to reliably work. Where do you land the IIF statement. do you need to do it in more than one place?
-
Re: Chunking Up Properties
Greg H. Jun 1, 2018 11:13 AM (in response to Michael Ferraro)I think the issue is with how SW reads the line length & not the int() command. If you type int(109) you will get 109. But if you set your line length to 109 & run the int command on it, you get 108. Same is true for 89,99 & 399, but not for 79,199 or 299. It's quite perplexing. If it was consistent, it would be easy, but I'm not seeing the cause right now. If I had to guess, Solidworks is seeing the line at 108.9999999999ect.
I would wager there is an work around, but unfortunately I've exhausted my available time on this issue for now. The IFF does go before everything. You need to compare the produced int() value with the expected value & add 1 for cases that it loses an integer. The problem I'm having is comparing 98.99999 to 98 differently than say 57.6 to 57.
-
Re: Chunking Up Properties
Jeremy Feist Jun 1, 2018 11:32 AM (in response to Greg H.)the different rounding is coming from the fact that, even if you set all your dims and properties to inches, or even mm, under the hood all of the dims are actually calculated in meters (out to 8 or 9 decimal places, but still meters). not sure if that helps you find a solution, but that is why 299 runs differently than 399.
-
Re: Chunking Up Properties
Greg H. Jun 1, 2018 11:40 AM (in response to Jeremy Feist)That's good to know, thanks Jeremy!
-
-
-
Re: Chunking Up Properties
Greg H. Jun 1, 2018 11:22 AM (in response to Michael Ferraro)Michael,
Have you tried applying these equations to one of your parts? Just wondering if you get better results.
-
-
-
-
-
-
-
-
-
-
-
-
-