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

Pro-Program IF statement question

SOLVED
Highlighted
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

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Pro-Program IF statement question

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
Highlighted

Re: Pro-Program IF statement question

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

Highlighted

Re: Pro-Program IF statement question

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
Highlighted

Re: Pro-Program IF statement question

Ok, then I learned something myself, thanks!

Highlighted

Re: Pro-Program IF statement question

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.

Highlighted

Re: Pro-Program IF statement question


@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.

Highlighted

Re: Pro-Program IF statement question

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

Highlighted

Re: Pro-Program IF statement question

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

Announcements