Skip to main content
1-Visitor
April 6, 2022
Question

Create Functions on relations

  • April 6, 2022
  • 3 replies
  • 1340 views
I am using Pro/ENGINEER and Creo Elements/Pro Release Wildfire 4.0 and DatecodeM130

I want to use the same relation using measurements of the model many times. Instead of repeating the same relation for each used measurement, is it possible to create a function where each time it is needed on the Relations it could be called specifying the value needed to perform the calculation.
For instance, in Python would be something like this:

#Function definition:
def sum(a, b):
return a + b

#When the function is needed would be called like this:
sum(3, 4)

Result --> 7

3 replies

Chris3
21-Topaz I
April 6, 2022

It is not part of Creo functionality to create functions in relations.

 

You can however create mapkeys to automate typing in relations. You can also create UDFs that have relations built in. Lastly there are several toolkits available (jlink, weblink, vb, etc) that allow you to more fully automate Creo. If you are interested in automating Creo there is going to be a webinar this Thursday at 1pm EST talking about just that:

https://ptc.zoom.us/webinar/register/WN_q7sn4TyDQaG328fc8SVDcQ

KenFarley
21-Topaz II
April 6, 2022

This isn't possible. Relations are processed in a serial manner every time you regenerate. There is no looping or function definition capability, regrettably. That's why if you need to do something like calculate the closest fraction based on a floating point value, or generate a few strings from real numbers, you end up with a very long list of relations, with many IF - ELSE- ENDIF statements.

tbraxton
22-Sapphire II
April 13, 2022

If you have a license for the BMX module you can use an Excel analysis feature which would may support what you are trying to do.

 

http://support.ptc.com/help/creo/creo_pma/usascii/index.html#page/model_analysis%2Fbemod%2FTo_Create_an_Excel_Analysis_Feature.html%23wwconnect_header