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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

CREO - Driving dimensions from note parameters

ptc-5459625
1-Visitor

CREO - Driving dimensions from note parameters

Hello,

I have created a new paramter and set to to the 'note' type.

how can i use the alphanumeric values entered inthis note to drive relations.

for example, my note says SL125A

I would like an IF syntax that returns a numerical value when this is entered.

IE

IF PARAMETER_1 == SL125A

PARAMETER_2 = 15

ELSE

PARAMETER_2 = 1

Can anybody help?

I tried putting */ , ' , and " around the note value but none of these worked.

when using ' and " the error message read

error Left and right sides are incompatible

What does this mean?


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.
1 REPLY 1

The following works (given that there are no other relations in the code):

if parameter1=="SL125A"

parameter2=15

else

parameter2=1

endif

Parameter1 was predefined as a string and given a value prior to writing the above relation. You get the incompatible error when you assign a variable as a certain type (integer, string) but then try to use it as another type. And I believe you can define or use a string with either " or '

For example, if I define parameter1 earlier in the code as a real number:

parameter1=1.0

And then try to use it as a string:

if parameter1=="1" ......

I will get the incompatibility error. Just make sure your variable types are consistent throughout your relations. That being said, you can change the variable type by assigning it directly as something else as long as it isn't used as another variable type later on in your code:

parameter1==2.0 /*real number

parameter1=="blahblah" /*becomes a string

Announcements
NEW Creo+ Topics: Real-time Collaboration


Top Tags