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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Creo Parametric Tips

Sort by:
This is a document so please edit it and add, correct, &/or clarify how you see fit.  Then we can all use this as a point of reference when dealing with Repeat Regions/BOM programming.  If you don't want to edit it but still want to contribute, then just leave a comment.  Thanks!   List of System Parameters and Model Parameters used in model/drawing (Document - CS133915): https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS133915&art_lang=en&posno=10&q=repeat%20region%20symbols&sourc…   List of Operators and Functions: Type Name syntax Explanation eg: Input   Eg: output Assignment Operator = MyVar="string" Defines, or assigns, a variable as a # or string       MyVar="H123" MyVar=10     = = No Output but defines the variable MyVar to be: H123 10 String Operators/Functions   Comparison Operators ==     == A==B     #A==#B Compares strings as equal.     Compares #s as equal "456"=="123" "456"=="456"   7==1 7==7 = =   = = NO YES   NO YES String Operators/Functions     Comparison Operators !=, <>, ~= A!=B A<>B A~=B   #A!=#B #A<>#B #A~=#B   Compares strings as unequal. (checks to see if not equal or not)     Compares #s as unequal. (checks to see if not equal or not)   "456"<>"123" "456"<>"456"     7!=1 7<>1 7~=1 7!=7 7<>7 7~=7 = =     = = = = = = YES NO     YES YES YES NO NO NO String Operators/Functions Arithmetic Operators +   + A+B   #A+#B For Strings: Concatenate strings. For Numbers: Add #s (Addition, Plus) "456"+"123"   7+7 =   = 456123 (returns a string e.g. "456123"*1="ERROR") 14 Arithmetic Operators - #A-#B Subtract #s (Subtraction, Take away, Minus) 3-2 = 1 Arithmetic Operators / #A/#B Divide #s (Division) 6/2 = 3 Arithmetic Operators * #A*#B Multiply #s (Multiplication) 6*2 = 12 Arithmetic Operators ^ #A^#B A to the Power of B (Exponent, Powers, Raised to) 2^3 = 8 Arithmetic Operators () (#A-#B)*#C Parentheses for grouping, Priority, and order of operations (3-2)*4 4*(3-2) = = 4 4 Comparison Operators ==   <See String Operators above>       Comparison Operators > #A>#B Greater than       Comparison Operators >= #A>#B Greater than or equal to       Comparison Operators !=, <>,~=   <See String Operators above>       Comparison Operators < #A<#B Less than       Comparison Operators <= #A<#B Less than or equal to       Comparison Operators | #A | #B | #C OR       Comparison Operators & #A & #B & #C AND       Comparison Operators ~,! #A == !B     #A!=B #A~=B NOT (i.e. Reverse a statement, Opposite) (                         Tilde ~ doesn't work for NOT next to a #.  Only next to operator = 7 == 7 7 == !7 7 == !4 7> 4 7>!4       7 != 7 7>=3 7!>=3 7~=7 7~=4   7 == ~7 7 == ~4 "ABC" == !"ABC" = = = = =       = = = = =   = = = YES NO NO YES YES (I guess even mathematically this is strange)   NO YES NO NO YES   ERROR ERROR ERROR Mathematical Functions abs abs(#) Returns the absolute value of a number abs(-2) = 2 Mathematical Functions acos acos(#º) Returns the arccosine of a number ACOS(0.125) = 1.445468496 Mathematical Functions asin asin(#º) Returns the arcsine of a number ASIN(0.125) = 0.125327831 Mathematical Functions atan atan(#º) Returns the arctangent of a number ATAN(0.125) = 0.124354995 Mathematical Functions atan2 atan2(#º) Returns the arctangent (inverse tangent), of the specified x- and y-coordinates ATAN2(2,3) = 0.982793723 Mathematical Functions bound bound(#x,#lo,#hi) Forces #x to be within the range of #lo to #hi. If x ≤ lo,        then output = lo. If lo ≤ x ≥ hi, then output = x If x ≥ hi,        then output = hi   (kind of the opposite as DEAD(), but not exactly)     bound(0,5,15) bound(7.25,5,15) bound(100.2,5,15)     = = =     5.0 7.25 15.0   cable_len       =   Mathematical Functions ceil ceil(#) Round # up ceil(3.25) = 4.0000   comparegraphs       =   Mathematical Functions cos cos(#º) Returns the Cosine of a # cos(2) = -0.416146837 Mathematical Functions cosh cosh(#º) Returns the hyperbolic Cosine of a # cosh(2) = 3.762195691   dbl_in_tol  dbl_in_tol (#x, #y, #r) Checks to see if x and y are within the tolerance of ± r #x, #y, #r are all real numbers Returns TRUE if abs(x-y) ≤ r Returns FALSE if abs(x-y) > r dbl_in_tol (2, 1, 1) dbl_in_tol (2,1,0.5) dbl_in_tol (10,20,9) dbl_in_tol (10,20,10) dbl_in_tol (10,20,11) = = = = = YES NO NO YES YES Mathematical Functions dead dead(#x,#lo,#hi) "Defines a range of values for x, for which the result of the function is 0." If x < lo,        then output = x–lo If lo ≤ x ≥ hi, then output = 0 If x > hi,         then output = x–hi   (kind of the opposite as BOUND(), but not exactly)     bound(0,5,15) bound(7.25,5,15) bound(100.2,5,15)     = = =     -5.0 (0-5) 0 85.2 (100.2-15) Cabling, Case Study Functions eang  eang(e_ID1, e_ID2)  Angle in radians between two entities, e_ID1 and e_ID2, of a case study   =   Cabling, Case Study Functions ecoordx  ecoordx(e_ID1)  x coordinate of the e_ID1 entity of a case study   =   Cabling, Case Study Functions ecoordy  ecoordy(e_ID1)  y coordinate of the e_ID1 entity of a case study   =   Cabling, Case Study Functions edistk  edistk(e_ID1, e_ID2) Distance between two entities, e_ID1 and e_ID2   =   Cabling, Case Study Functions elen  elen(e_ID1)   Length of the e_ID1 entity of a case study   =   Graph Evaluation Function evalgraph  evalgraph("graph_name", x) Graph evaluation function enables you to use graph features to drive dimensions through relations. The dimensions can be section, part, or assembly dimensions. graph_name—the name of a graph. x—the value along the x-axis of the graph for which the y value is returned.   =   Strings as Arguements exists  exists("x") Test if a parameter, variable, or dimension exists or not   x is a string EXISTS("ASM_MBR_NAME") EXISTS("ASM_MBR_NAME_") EXISTS("test03") = = = YES NO YES (note test03 is a defined variable in my relations) Mathematical Functions exp exp(#) e3 Returns e raised to the power of a number, where e = Euler's number = 2.718…  exp(3)=e3 =  20.085537 String Operators/Functions extract extract(#1,#2,#3) Extracts pieces of strings. #1=string analyzing #2=starting position #3=length (how many char to extract)   e.g. looking at the entire string (4324870B) Starting with the first character (4) Extract 7 characters (4324870) extract("4324870B",1,7)   Extract("4324870B",8,1) =   = 4324870   B Logical Functions False* false() false False function Returns "No" (For some reason doesn't return "False"!) False() False = = NO FALSE Mathematical Functions floor floor(#) Round # down Floor(3.25) = 3.0000 Mathematical Functions if IF(c,x,y) Similar to IF() function in Excel: c= condition statement x = what to do if true y= what to do if false (PTC documentation calls this a switching function but to me is too  basic to earn this title) IF(10==9,2,10) = 10.0 Conditional Statements if, Else, Endif IF <condition>    <what to do if condition is met>   ELSE <what to do if condition is not met> (optional)   ENDIF If--Starts the if statement Else--says what to do if statement is not bet (and is optional) Endif--(closes the if statement)   Can have IF without ELSE Can't have IF with more than one ELSE (E.g. IF ELSE ELSE ENDIF Can't have IF without ENDIF Can have nested IF statements.  Eg. IF ELSE IF ELSE IF ENDIF ENDIF ENDIF asm_mbr_name = 4564870B IF string_length(asm_mbr_name) > 7    Test01 = extract(asm_mbr_name,1,8) ELSE    Test01 = extract(asm_mbr_name,1,7) ENDIF = 4564870B String Operators/Functions itos itos(#) Integer to String-- Reads in an integer and returns a string.  If the input number is a # that is not an integer, itos rounds up, than converts to a string. itos(6) itos(6.7) = = 6 7 Mathematical Functions ln ln(#) Returns the natural log (base e) of a # ln(2) = 0.693147181 Mathematical Functions log log(#) Returns the base 10 logarithm of a # log(2) = 0.301029996   lookup_inst lookup_inst ("generic_name", match_mode, "param_name_1", match_value_1, "param_name_2", match_value_2,...) Used in ProPROGRAM Used to automatically replace the given Family Table instance with another FT instance: •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 INPUT END INPUT RELATIONS INST_NAME = LOOKUP_INST ("PEG.PRT", 0, "D2", D6:0, "D1", D5:0 + 1) END RELATIONS ADD PART BLOCK INTERNAL COMPONENT ID 1 END ADD ADD PART (INST_NAME) INTERNAL COMPONENT ID 2 PARENTS = 1 (#1) END ADD MASSPROP END MASSPROP Example: Replacing Family Table-Driven Components --> "In this way, the instance of peg.prt being assembled to blockpeg.asm is controlled, based on the dimensions of the hole in block.prt."     massprop_param       =     material_param       =   Mathematical Functions max max(#) Compares 2 #s and returns the larger one max(6.2,4) = 6.2 Mathematical Functions min min(#) Compares 2 #s and returns the smaller one min(6.2,4) = 4 Mathematical Functions mod  mod(#n,#d) Modulus function.  Also known as Remainder function because gives just the remainder. e.g. n/d (numerator/denominator): 10/2=5 Remainder=0 (10/2+0/2) 10/3=3 Remainder=1 (9/3+1/3) 10/4=2 Remainder=2 (8/4+2/4)   In Programming Modulus can be useful to do many things. e.g. Determine if Number is Odd/Even [if mod(n,2)=0 then n is even] Clock arithmetic [mod(9+5,12)=2pm] Truncating decimal values Wrapping values into a certain range [given mod(n,360) to determine what quadrant a particular angle falls in for the unit circle) if Remainder       0-90, then Quad.1 if Remainder   90-180, then Quad.2 if Remainder 180-270, then Quad.3 If Remainder 270-360, then Quad.4]       Mod(10,2) Mod(10,3) Mod(10,4)           Mod(9+5) Mod(9+8,12)     Mod(400,360)   Mod(2300,360)       = = =           = =     =   =       0 1 2           2 (e.g. 9am+5hrs =2pm) 5 (e.g. 9am+8hrs = 5pm)     40 (40º is in quadrant 1)   140 (140º is in quadrant 2)   mp_assigned_mass       =     mp_cg_x       =     mp_cg_y       =     mp_cg_z       =     mp_mass       =     mp_surf_area       =     mp_volume       =   Mathematical Functions near near(#y,#y,#delta) determines if the numbers x and y are within delta of each other near(5,8,3) near(5,8,1) = = 1.0 (i.e. when true) 0.0 (i.e. when false) Logical Functions No* no() no No Function Returns "No" No() No = = NO FALSE Mathematical Functions pi pi() Returns the number for PI PI() = 3.141592654 Mathematical Functions pow pow(#x,#y) x^y Raising x to the Power of y #1=Base value #2=Exponent Pow(1,2) Pow(2,2) Pow(2,4) = = = 1.0 (i.e. 1^2) 4.0 (i.e. 2^2) 16.0 (i.e. 2^4) Strings as Arguements rel_model_name rel_model_name   or   rel_model_name()     Passing Strings as Arguments in Relations rel_model_name   rel_model_name()   =   501234 (when done on 501234.drw table repeat region relations) Strings as Arguements rel_model_type   rel_model_type   or   rel_model_type() Returns the current model type.  If you are working in Assembly mode, rel_model_type() is equal to assembly.   (note you can use with or without parenthesis) Passing Strings as Arguments in Relations rel_model_type   rel_model_type()     = DRAWING (when used in table repeat region relations) String Operators/Functions search search(string, substring) Searches for substrings. The resulting value is the position of the substring in the string (0 if not found). You can specify substrings with single or double quotes. search(asm_mbr_name,"501234") = 2 (Given asm_mbr_name is 05012340.prt) Mathematical Functions sign  sign(x,y)  Sign Transfer of y to x If y<0, the result is –abs(x) if y>=0, the result is abs(x). sign(-2,3) sign(2,3) sign(2,-3) sign(-2,-3) = = = = 2.0 2.0 -2.0 -2.0 Mathematical Functions sin sin(#º) Returns the sine of a number sin(2) = 0.909297427 Mathematical Functions sinh sinh(#º) Returns the hyperbolic sine of a number sinh(2) = 3.626860408   smt_def_ben_rad       =     smt_thickness       =   Mathematical Functions sqrt sqrt(#) Take the square root of a number sqrt(4) = 2 String Operators/Functions string_ends string_ends (string1, string2) Check to see if string1 ends with string2 Case Sensitive ("H" <NOT => "h") string_ends("h456","56") string_ends("h456H","56h") string_ends("h456H","56H") = = = YES NO YES Strings as Arguements string_length string_length(string)   string_length(<param>) Returns the number of characters in a string or parameter. string_length("als23fj") string_length(asm_mbr_name) = = 7.0 6.0 (when done on 501234.prt table repeat region relations) String Operators/Functions string_match string_match(string1, string2) Check to see if 2 strings are exactly the same or not Case insensitive ("H"="h") string_match("456","456") string_match("456","4560") string_match("h456","H456") = = = YES NO YES String Operators/Functions string_starts string_starts(string1, string2) Check to see if string1 starts with string2 Case Sensitive ("H" <NOT => "h") string_starts("h456","h4") string_starts("h456","H4") string_starts("h456","asd4") = = = YES NO NO Mathematical Functions tan tan(#º) Returns the tangent of a number tan(2) = -2.185039863 Mathematical Functions tanh tanh(#º) Returns the hyperbolic tangent of a number tanh(2) = 0.96402758   trajpar   "Trajectory Parameter" Returns a system of numbers that varies from 0 to 1 across the length of a given path http://en.wikipedia.org/wiki/Trajpar sin(trajpar*8*pi()) = creates an undulating wave Composite Curve Trajectory Function trajpar_of_pnt trajpar_of_pnt("trajname", "pointname") The trajectory parameter of a composite curve, trajpar_of_pnt, can be used in relations. The following function returns a value between 0.0 and 1.0:   =   Logical Functions True* true() true True function Returns "YES" (For some reason doesn't return "True"!) True() True = = YES TRUE Logical Functions Yes* yes() yes Yes function Returns "Yes" Yes() Yes = = YES TRUE     *Relations containing conditional statements are not sorted. A condition is an expression that is either TRUE (or YES) or FALSE (or NO). These values can be used interchangeably in the conditional statement. For example, the following statements can all be evaluated the same way: From <https://support.ptc.com/help/creo/creo_pma/r9.0/usascii/fundamentals/fundamentals/Conditional_Statements_in_Relations.html>     Pro/ENGINEER, Creo Elements/Pro and Creo Parametric
View full tip
Do you want to learn about ProProgram? Here is the introduction tutorial:
View full tip
Sometimes you need to clean up CAD data before sharing it with a third party or you would like to update Start parts templates and remove old PDM parameters. You need to Set config.pro options: dm_emulate_ilink_sys_parameters=yes allow_create_pdm_param=yes  
View full tip
Hi folks, I have created for you: REPEATABLE MAPKEY GENERATOR  By default, the program generates the Repeatable Mapkey code from the list. The Repeatable Mapkey Generator uses the existing Mapkey "4k". The Mapkey "4k" is user-defined and is repeated on every object from the list. Please do not forget to set the Close window at the end of your user-defined Mapkey, because Creo is limited that only 15 active windows are allowed to use. How it works:
View full tip
Applicable Release: Creo Parametric 1.0 to 8.0   Description: In this video, we will be enabling DEBUG Logs For Creo Parametric by setting environment variables from Command Prompt window If the CMD window is launched with Admin Privilege (Run as Administrator), the variables will be set as system level. Else, will be set at user level. The user may need to log off and log-in for the variables to take effect.
View full tip
Applicable Release: Creo Parametric 1.0 to 8.0   Description: In this video, we will be enabling DEBUG Logs For Creo Parametric by using Parametric.psf file Parametric.psf file exists in <Creo load point>\Parametric\bin The PSF file could be any custom PSF file configured for users to launch Creo Parametric
View full tip
Applicable Release: Creo Parametric 1.0 to 8.0   Description: In this video, we will be enabling DEBUG Logs For Creo Parametric by using Parametric.bat file Parametric.bat file exists in <Creo load point>\Parametric\bin The batch file could be any custom start batch script file configured for users to launch Creo Parametric  
View full tip
  Let's continue the conversation from the webinar: We’re Moving on Up! Ensuring the Success of your next Creo Parametric This session introduced our newly launched Success Path for upgrading your version of Creo, reviewed the tools available to you to harness the expertise of our Customer Success team.  If you missed the webcast you can watch the replay and add any questions you have here. Jake and other experts at PTC will help to get your questioned answered!  Speaker:   Watch the Replay Visit the Success Path Jake Koch, PTC Director, Customer Success Journey Lead CAD
View full tip
LiveWorx and PTC/User are now offering an entire day focused on Creo and Windchill content with the addition of CAD & PLM Technical Day on Monday, June 10. This is an additional 25 breakout sessions with all of the Creo and Windchill tips, tricks and insights necessary to get the most out of your PTC Products. Here’s what you need to know:   You can take a look at what to expect for sessions here CAD & PLM Technical Day is included with your purchase of an All Access or DeluX Pass Explorer Pass holders can add it on for an additional cost of $250 until March 27 and $350 through June 13 If you are already registered it is not too late to add this to your registration: Log In to your account Enter username and password Select “Registration” Scroll down and click “Purchase Additional Event Offerings” and add the CAD & PLM Technical Day to your account   Seats are filling fast for this dedicated content, don’t miss out on learning from some of our Creo and Windchill super users (and fellow Community members) on best practices and how other organizations are utilizing these solutions.   Please email concierge@liveworx.com if you have any questions.      
View full tip