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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Pro programming user guide

Ketan_Lalcheta
19-Tanzanite

Pro programming user guide

Has anyone come across user manual or any help file of pro program?

Regards

Ketan

35 REPLIES 35

This may help https://www.youtube.com/watch?v=930o_03tlGo

Personal notes:

When a Pro Program is edited the information will come from the file the first time. The editor will create a copy of the file program as-is for backup purposes. After that it will ask "From Model' or From File." If the last time turned out poorly, then 'From File' is your best choice.

When a program is run:

  • Current Vals will run unaided;
  • Enter will show the choices to change and then prompt you to change the selected ones;
  • Read File will get the values from a file you select.

  Any values in the program and not in the file are unchanged, any values in the file and not in the program are ignored. 

Example file entries - one per line; case-sensitive
THICKNESS = 2.5
INCLUDE_VALVE = YES
MATERIAL = "STEEL"

Comments

/* < your comment
Place the comment immediately after an ADD to keep its place with the feature.

Input

Types:

  • Number (default)
  • String
  • Yes_No.

Must exist between INPUT and END INPUT.
Can use IF-ELSE-ENDIF

IF-ELSE-ENDIF

logical operations are >,<, ==; string literals are in quotes.

Component Replacement

Get the name of the replacement from INPUT or via RELATIONS

Change the ADD PART to ADD PART (replacement) for part to part exchange
or
Change the ADD COMPONENT(replacement) for part to subassy exchange.
"COMPONENT" requires file extension, PART does not.

Relations


Must be between RELATIONS and END RELATIONS

XYZ = <parameter_name>:fid_<feature_name>:<comp_id>
or
XYZ = <parameter_name>:fid_<N>:<comp_id>

Family table based replacement

The format for lookup_inst is:

lookup_inst ("generic_name", match_mode, param_name_1, match_value_1, param_name_2, match_value_2,...)

where:

generic name—Name of the generic model with a .prt or .asm extension

match_mode—One of the following values:

–1 (find closest instance with param values less than or equal to supplied values)

0 (find instance with param values that match supplied values exactly)

1 (find closest instance with param values greater than or equal to supplied values)

param_name_1—Family table parameter name

match_value_1—Value to match against

User-Defined Features

CHOOSE (<ID>)

All the available IDs can be found in the ADD statement of the leader of the currently active group in the Program listing

To use a CHOOSE statement, you must first manually replace a family table instance of the group or replace the group with another group.

CHOOSE statements cannot be included in conditional statements.

EXECUTE

Replaces the ADD end END ADD

This is for assemblies to link assy input variables to program variables in assembly components.

EXECUTE {PART}/{ASSY } name or variable

input variable of design at next lower level = expression

input variable.....

END EXECUTE

Only reaches one level, but that level can domino to the next.

Can be used with IF-ELSE-ENDIF

MASSPROP

MASSPROP
IF THICKNESS > 1
PART PLATE
ELSE
ASSEMBLY BLOCK
ENDIF
END MASSPROP

INTERACT

Can be inserted anywhere within the FEATURE ADD - END ADD or PART ADD - END ADD statement

Stops program execution and uses FEAT CLASS menu to allow additional work to be done on the model.

ADD, ADD SUPPRESSED

MODIFY - changes dimensions

MODIFY d# = value

nalexandru
13-Aquamarine
(To:dschenken)

Hi, D,

1. It is not possible to add comments in the INPUT block? I get an error every time I add "/*":

/* A STRING

!*** ERR: not a valid line for the INPUT statement

2. There is not possible to define an INTEGER parameter in the INPUT block? Only "NUMBER" (real)?

B INTEGER

!*** ERR: line contains a bad symbol or is otherwise invalid

Thanks,

Nic.

If you read the document that DCG supplied you can see that comments don't apply to the INPUT section.

It is not possible to use INTEGER to define an input type.

nalexandru
13-Aquamarine
(To:dschenken)

thank you.

may I ask you another question, please?

In program Drawing I believe I have a relation that is too long. Is more than 80 characters long and gets truncated. How do I solve this situation? I tried using backslash "\" but it didn't work.

Thanks again

Nic.

I don't know; I don't recall any line continuation method for relations. I would have to see the relation to see what might be done differently.

BenLoosli
23-Emerald II
(To:dschenken)

From the WF4 help desk collection Program.pdf:

If it isn't working, then I suspect it is an undocumented unfeature of pro/program.

Test your relation in the relation editor just to see if it works there.

nalexandru
13-Aquamarine
(To:BenLoosli)

Thank you!

It works in Pro/PROGRAM

but in Drawing Program I get something like that:

IF BSHAPE:1 == "J-TYPE" | BSHAPE:1 == "TRUNCATED"  | BSHAPE:1 == "TRUNCATED WIT

and there are others characters at the end that are deleted. I don't even know if the Drawing Programs runs correctly if there are missing characters in the condition. I am not sure that it works the "\" as I get an error when I put it before the last "IF".

I am struggling as I am working on a simple assy but that has 300-400 parameters to speed the creation of variants of the simple assembly with the dedicated drawing. I am not familiar with Program so I started to learn.

Do you know where I can find the syntax for these. For example, in my relation, what role has the "|" in it?

Thanks again, Ben

Nic.

BenLoosli
23-Emerald II
(To:nalexandru)

I am not sure where you are getting the '|' character from. It is used as a pipe in C programming or an 'or' in some coding.

What are you trying to do in the Drawing Program code. Very few pages of documentation and typical PTC fashion, not very helpful.

TomU
23-Emerald IV
(To:nalexandru)

The pipe character is the "OR" comparison operator.  It is used in relations and pro/program.  See this link: Creo Parametric Help Center

nalexandru
13-Aquamarine
(To:TomU)

Thank you. Very useful. I still can't understand how to "brake" a line in Drawing Program as the backslash "\" doesn't work

It looks like, from the documentation, that what you will use is ELSE IF for each feature. Since the docs are so skimpy, I assume the ELSE IF can be used multiple times in the IF ENDIF structure

.

IF <expression>

ELSE IF <expression>

ELSE

ENDIF

If you wish to record inter-dependencies between conditionals use assignments:

var_name= expression, where var_name is a variable name.

nalexandru
13-Aquamarine
(To:dschenken)

So, in my particular case, you say that my expression:

IF BSHAPE:1 == "J-TYPE" | BSHAPE:1 == "TRUNCATED"  | BSHAPE:1 == "TRUNCATED WIT

should be broken like this:

IF BSHAPE:1 == "J-TYPE"

OR BSHAPE:1 == "TRUNCATED"

OR BSHAPE:1 == "TRUNCATED WITH INCL"

SET STATE K_STEP

ENDIF

??

I will try right away

I did not include OR, did I?

If BSHAPE:1 == "J-TYPE"

SET STATE K_STEP

else if BSHAPE:1 == "TRUNCATED"

SET STATE K_STEP

else if BSHAPE:1 == "TRUNCATED WITH INCL"

SET STATE K_STEP

endif

Hi,

I hope you know that Drawing program is quite different from Pro/Program (used in assemblies and parts). Did you search Creo Help for information ?

MH


Martin Hanák

Hi, Martin,

I start to understand that. I'm not an expert in Pro/PROGRAM so I learn both of Programs concomitantly.

I tried to look in forums for help. I found a nice tutorial for Pro/Program which helped me a lot. Now I'm trying to find one for Drawing Program and manipulating the States in drawing.

I inherited an assembly, simple!! per se, with 400 parameters and 160 states that I have to fix and modify for new requirements.

Thank you,

Nic.

Hi,

1.]

I guess that in Drawing program IF command can contain single condition (not compound as you need).

2.]

Solution you need to get depends on your data.

3.]

Maybe following program suits your needs.

---

If BSHAPE:1 == "J-TYPE"

   SET STATE K_STEP

endif

if BSHAPE:1 == "TRUNCATED"

   SET STATE K_STEP

endif

if BSHAPE:1 == "TRUNCATED WITH INCL"

   SET STATE K_STEP

endif

4.]

BSHAPE:1 is model parameter. Therefore you can create relation (in model !!!) which contains compound condition. See below:

/* BSHAPE_CONDITION is yes_no parameter

BSHAPE_CONDITION=NO

If BSHAPE == "J-TYPE" || BSHAPE == "TRUNCATED" || BSHAPE == "TRUNCATED WITH INCL"

   BSHAPE_CONDITION=YES

endif

In Drawing program you can use following code:

If BSHAPE_CONDITION:1 == YES

   SET STATE K_STEP

endif

MH


Martin Hanák

but it works if the relation line is less than 80 characters:

IF BSHAPE:1 == "INCLINED" | BSHAPE:1 == "PARALLEL" | BSHAPE:1 == "TRUNCATED"

SET STATE NO_K_STEP

ENDIF

I don't get any error for this kind of relations. It seems really that when it reaches 80 characters it gives an error. I'm trying to find a line separator in the PTC documentation, like the "\" for Pro/Program. I haven't found it yet... 😞

Does anybody knows a tutorial for the Drawing Program and Setting View States to show models?

Thanks again,

Nic.

TomU
23-Emerald IV
(To:nalexandru)

I don't get any error for this kind of relations. It seems really that when it reaches 80 characters it gives an error. I'm trying to find a line separator in the PTC documentation, like the "\" for Pro/Program. I haven't found it yet... 😞

You need to be clear on whether you are referring to a drawing program or Pro/Program.  One is used for drawings, the other is used for assemblies, and they are not the same.  I did just confirm with tech support that drawing programs do not support the line continuation character ( \ ).  This is documented in CS34738.

nalexandru
13-Aquamarine
(To:TomU)

Hi, Tom,

I thought is clear that I was talking about Drawing Program.

Thank you for the information. I was thinking that's the reason I get the error.

Tom, do you know a method of "braking" down the line before the 80th character? Like the backslash "\" for Pro/PROGRAM?

Nic.

Hi,

Tom just told you that maximum length of the drawing program line is 80 characters. Also splitting of line into two is not implemented.

Simply use my method

3.]

Maybe following program suits your needs.

---

If BSHAPE:1 == "J-TYPE"

   SET STATE K_STEP

endif

if BSHAPE:1 == "TRUNCATED"

   SET STATE K_STEP

endif

if BSHAPE:1 == "TRUNCATED WITH INCL"

   SET STATE K_STEP

endif

MH


Martin Hanák

Hi,

Yes, I understood that there was a problem with the length if the line. I counted 79 but the limit is 80 as Tom pointed exactly to the source. I just presumed that there is a way of splitting the line as in pro/Program. I'm said to know that there isn't.

So you suppose that putting them separately will have the same effect? I'm wondering shy they hadn't done it like that in the first place.

Nic.

Have you discussed this with other CAD users where you work? Forward a link to this thread and see what they think.

nalexandru
13-Aquamarine
(To:dschenken)

I replace the guy that managed the assy years ago and left the company 3-4 years ago. They need some new parameters name and other modifications.

So, I'm on my own.

And with you guys!

Thank you again,

Nic.

nalexandru
13-Aquamarine
(To:TomU)

Hi, Tom,

Just to be clear, I opened a new question about the Drawing Program here:

Drawing Program User Guide, Tutorial and Hands-On Workshop

If you have some additional info, please let me know in the question.

On the other hand

since my line is too long I was wondering splitting the relation and I ask everyone if this relation

IF PAR1=="VAL1" | PAR2=="VAL2"

SET STATE STATE_1

ENDIF

is equivalent with this one

IF PAR1=="VAL1"

IF PAR1=="VAL2"

SET STATE STATE_1

ENDIF

ENDIF

Your question is a basic programming logic one. What you have in the nested IF code is the equivalent to IF "A AND B" (In Creo "A & B"). Not equivalent to "A OR B".

The correct way to do this would be

IF PAR1 == "VAL1"

  SET STATE STATE_1

ENDIF

IF PAR1 == "VAL2"

  SET STATE STATE_1

ENDIF

nalexandru
13-Aquamarine
(To:KenFarley)

thank you very much, Kenneth!

It drives me crazy an apparently simple assembly which has 160 states depending on language, number of hole, form of holes (round or slot), grooves (with different paths and profiles), position slots, etc, etc.

And my job seems pretty simple: to change the names of the parameters.

A lot of problems as I can't understand how vies states work and how can I manipulate them.

For example, for generating a version with two holes, I get the two holes but I don't get the dimensions and the diameter. Obviously I don't recall the right view state form some reason. With the old names of the parameters I get them.

Any idea to help start from somewhere?

Thank you,

Nic.

Hi,

tip 1.]

Create simple test model and test drawing and use them to investigate Drawing program behaviour.

tip 2.]

Contact your PTC VAR and order special training.

MH


Martin Hanák

Hi, Martin

1. I started that already. But the View States acts so weirdly...

2. It will take too long and probably it will exceed our budget. I was supposed only to change the parameters name. It's true that are 400 and 160 view states. Theoretically is not so difficult, right? Until you get into this problems, like the length of the line in Drawing Program that can be maximum 80 characters and you can't do anything about it.

That's why I'm trying to re-write the long lines and asked you guys for help.

Nic.

TomU
23-Emerald IV
(To:nalexandru)

Be careful about rewriting things.  Clearly the person who originally built this drawing understood what they were doing.  You shouldn't change anything until you understand exactly what they are doing and why.      

Just to reiterate, these are both "OR" statements.  They will execute the state if either of the conditions are true (only one required):

IF PAR1=="VAL1" | PAR2=="VAL2"

    SET STATE STATE_1

ENDIF

IF PAR1 == "VAL1"

    SET STATE STATE_1

ENDIF

IF PAR1 == "VAL2"

    SET STATE STATE_1

ENDIF

On the other hand, these are both "AND" statements.  They will only execute the state if ALL of the statements are true.

IF PAR1=="VAL1" & PAR2=="VAL2"

    SET STATE STATE_1

ENDIF

IF PAR1=="VAL1"

    IF PAR1=="VAL2"

        SET STATE STATE_1

    ENDIF

ENDIF

Announcements
Business Continuity with Creo: Learn more about it here.

Top Tags