cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Pro-Program IF statement question

Steve99
2-Guest

Pro-Program IF statement question

Hello,

Looking for help with Pro-Program IF statement.  I have a part model that has 2 different bolt hole patterns.  I would like to turn off or suppress the larger bolt pattern when the diameter is below a certain size.  For instance;

If diameter d37 <= 5.500, turn off or suppress pattern 2, else leave pattern 2.

I greatly appreciate the help,

Steve

1 ACCEPTED SOLUTION

Accepted Solutions
avero
13-Aquamarine
(To:Steve99)

First you should create a real number parameter called something like PART_DIAMETER and attach it to the diameter using relations. In relations you would either type PART_DIAMETER=dxxx or dxxx=PART_DIAMETER (you will find the dxxx value by clicking on the extrude sketch while in relations), depending on whether you want to control the diameter by changing the parameter or have the parameter change based on whatever value you put in the extrude sketch.

 

After that you open Pro-Program, locate the larger bolt hole pattern and type IF PART_DIAMETER<=5500 right before the ADD FEATURE (initial number xx) text that Creo has generated. Finally you locate END ADD and type in END IF after that. Make sure you get both the hole and the pattern you want to suppress in between the IF statement and END IF.

 

It should look something like this:

 

IF PART_DIAMETER<=5500

ADD FEATURE (initial number xx)

feature ID, parents, dimensions etc.

END ADD

END IF

View solution in original post

7 REPLIES 7
avero
13-Aquamarine
(To:Steve99)

First you should create a real number parameter called something like PART_DIAMETER and attach it to the diameter using relations. In relations you would either type PART_DIAMETER=dxxx or dxxx=PART_DIAMETER (you will find the dxxx value by clicking on the extrude sketch while in relations), depending on whether you want to control the diameter by changing the parameter or have the parameter change based on whatever value you put in the extrude sketch.

 

After that you open Pro-Program, locate the larger bolt hole pattern and type IF PART_DIAMETER<=5500 right before the ADD FEATURE (initial number xx) text that Creo has generated. Finally you locate END ADD and type in END IF after that. Make sure you get both the hole and the pattern you want to suppress in between the IF statement and END IF.

 

It should look something like this:

 

IF PART_DIAMETER<=5500

ADD FEATURE (initial number xx)

feature ID, parents, dimensions etc.

END ADD

END IF

MartinHanak
24-Ruby II
(To:avero)

Hi,

it is not necessary to create a parameter.

1.] user can use IF dxxx<=5500 notation

2.] user can rename dimension symbol from dxxx to PART_DIAMETER and use IF PART_DIAMETER<=5500 notation

 


Martin Hanák
avero
13-Aquamarine
(To:MartinHanak)

Ok, then I learned something myself, thanks!

Although creating a parameter is not necessary, I would recommend to do it anyway

 

Why?

 

If you are putting your logic into the PRO/Program, a user needs to have an AAX license to change/overrule that logic... Sooner of later, a user will have the need to overrule your logic.

 

So we would create a new parameter SHOW_PATTERN in the RELATIONS:

 

IF PART_DIAMETER <= 5500

   SHOW_PATTERN = NO

ELSE

   SHOW_PATTERN = YES

ENDIF

 

Or, if you would like to shorten your code in your RELATIONS:

 

SHOW_PATTERN = (PART_DIAMETER > 5500)

 

Then, you can use the SHOW_PATTERN parameter in the PRO/Program:

 

IF SHOW_PATTERN

ADD FEATURE (xxx)

...

END ADD

ENDIF

 

Now if a user want to overrule the logic, he can either change the value 5500 to something else, or he could simply write SHOW_PATTERN = YES just below the logic.


@HamsterNL wrote:

If you are putting your logic into the PRO/Program, a user needs to have an AAX license to change/overrule that logic... Sooner of later, a user will have the need to overrule your logic.

 

As far as I know, AAX license is needed only if you're using Pro/PROGRAM at the assembly level; if you use it in single part, it should be covered by the base license. So it all depends on where you need to actually work with Pro/PROGRAM.

That's true...editing the PRO/Program of an Assembly requires an AAX license.

Worked perfectly for what I needed.  Thank you all so much for the responses

Top Tags