Skip to main content
1-Visitor
Mar 5, 2015 3:21 PM UTC
Solved

Relation to control a parameter based on a part length range

I want to create a model relation that will control a parameter based on the length of a part.

For example IF LENGTH_1 = 255 thru 305 then MAKE_FROM = 12 FOOT. Is there a way to get that to work?

I am just not sure how to go about writing it.

 

IF LENGTH_1 == 225 THRU 305

MAKE_FROM = 12 FOOT

ENDIF


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
13-Aquamarine
Mar 5, 2015 4:40 PM UTC

I would start by setting a default value for MAKE_FROM, and then changing it if LENGTH_1 exceeds a threshold:

MAKE_FROM = "1 FOOT"

IF LENGTH_1 > 25.4

MAKE_FROM = "2 FOOT"

ENDIF

IF LENGTH_1 > 50.8

MAKE_FROM = "3 FOOT"

ENDIF

IF LENGTH_1 > 76.2

MAKE_FROM = "4 FOOT"

ENDIF

...

IF LENGTH_1 > 305

MAKE_FROM = "NOT AVAILABLE!"

ENDIF

etc. This approach is simple, transparent and robust; the final entry handles anything that's too long for a stock size.

You could equally start by setting "NOT AVAILABLE!" and then count down into smaller sizes if the length is suitable, using less-thans.

A 'cleverer' way would be to calculate the required length, round up and form that into a string. It looks like you might be using 3 foot (inch?) increments, so something like

REQ_LENGTH_FOOT = LENGTH_1 / 25.4

REQ_LENGTH_FOOT = FLOOR(REQ_LENGTH_FOOT / 3 + 1)*3

MAKE_FROM = ITOS(REQ_LENGTH_FOOT)+" FOOT"

or you can crunch it all together as

MAKE_FROM = ITOS( FLOOR(LENGTH_1/25.4 / 3 + 1) * 3 ) + " FOOT"

although note that this actually gives "9 FOOT" for 225, and only jumps to 12 from 228.6.

You could still add the "NOT AVAILABLE" clause for robustness...

2 replies

13-Aquamarine
Mar 5, 2015 4:40 PM UTC

I would start by setting a default value for MAKE_FROM, and then changing it if LENGTH_1 exceeds a threshold:

MAKE_FROM = "1 FOOT"

IF LENGTH_1 > 25.4

MAKE_FROM = "2 FOOT"

ENDIF

IF LENGTH_1 > 50.8

MAKE_FROM = "3 FOOT"

ENDIF

IF LENGTH_1 > 76.2

MAKE_FROM = "4 FOOT"

ENDIF

...

IF LENGTH_1 > 305

MAKE_FROM = "NOT AVAILABLE!"

ENDIF

etc. This approach is simple, transparent and robust; the final entry handles anything that's too long for a stock size.

You could equally start by setting "NOT AVAILABLE!" and then count down into smaller sizes if the length is suitable, using less-thans.

A 'cleverer' way would be to calculate the required length, round up and form that into a string. It looks like you might be using 3 foot (inch?) increments, so something like

REQ_LENGTH_FOOT = LENGTH_1 / 25.4

REQ_LENGTH_FOOT = FLOOR(REQ_LENGTH_FOOT / 3 + 1)*3

MAKE_FROM = ITOS(REQ_LENGTH_FOOT)+" FOOT"

or you can crunch it all together as

MAKE_FROM = ITOS( FLOOR(LENGTH_1/25.4 / 3 + 1) * 3 ) + " FOOT"

although note that this actually gives "9 FOOT" for 225, and only jumps to 12 from 228.6.

You could still add the "NOT AVAILABLE" clause for robustness...

Translate
cleamon1-VisitorAuthor
1-Visitor
Mar 5, 2015 5:30 PM UTC

Oh I like that. I like the way you put it better than what I was trying to do with >= and <=.

Thank you so much

Just put it in and all of that work perfect!

Translate