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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Automation required to Calculate Mass properties and designate attribute

khimani_mohiki
15-Moonstone

Automation required to Calculate Mass properties and designate attribute

Hi all, we have linked our WTPart Mass attribute to PRO_MP_MASS, however to start populating mass information from Creo into Windchill we need to calculate Mass properties in Creo then designate PRO_MP_MASS before checking in. This apparently is too much effort for my users and they would like and automation. I have got something working via Mapkey, but unfortunately if you run the Mapkey a second time it will un-designate the attribute without indication to the user. So I need a more elegant solution which can use some sort of "if" logic to determine whether PRO_MP_MASS is already designated, does anyone have a similar problem with a similar solution, I have no background in Creo automation or customization.

 

Many thanks

ACCEPTED SOLUTION

Accepted Solutions
TomU
23-Emerald IV
(To:TomU)

By the way, there actually is a good article about this in the knowledge base:

https://www.ptc.com/en/support/article/CS74103

View solution in original post

8 REPLIES 8

We use a relation to set the parameter weight = pro_mp_mass in our parts and then have weight designated in the start parts.

We also use a mapkey to recalculate the pro_mp_mass and then a regen to get it up date the weight parameter.

The key to getting the mapkey to update the designation check is to run it in the old UI. This will not toggle it.

We do the same thing. Our start parts have a parameter called "WEIGHT" and we use relations to set it equal to mass. Weight is a designated parameter so there is no need to toggle designation.

 

WEIGHT=MP_MASS("")

 

Tdaugherty_0-1600352410345.png

 

 

We also use these config options to automatically calculate mass properties.

 

mass_prop_update_force_change no
mass_property_calculate automatic

This isn't going to help you but obviously if your start parts have the parameter designated from the start you shouldn't need to toggle them.

 

Looking at the mapkey code there is a "PARAMETERS_TOGGLE" command that gets executed to make this happen. You are likely out of luck here.

 

mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `PARAMETERS_TOGGLE` `'relation_dlg' \

 

Some other operations have a 0 and a 1 that are assigned for on and off.

Hi all, thanks for your help, we had looked at the option of adding an additional parameter then creating relations but i found it to be a bit flakey and not reliable, also any user can go ahead and delete the relations. The Windchill bit is done now, parameters are linked and its not possible to change it.

 

So what Im looking for is something more sophisticated than a mapkey where we can use some logic to determine whether to toggle the checkbox of not, perhaps using toolkit or VB, any help much appreciated,

msteffke
14-Alexandrite
(To:khimani_mohiki)

I feel like an answer would lie in toolkit or VB.  This is a chunk of code I wrote several years ago to create and designate a parameter. Not sure I ever used it,  Been many years,   Toolkit is licensed and has a moderate learning curve.   An outside party could set you up w a program.  Or you could try the VB. 

 


/* DESCRIPTION PARAMETER, IF DOESN'T EXIST, CREATE IT */
ProStringToWstring(name, "DESCRIPTION");
status = ProParameterInit(&modelitem, name, &param) ;
fprintf( stream, "Description parameter existence %d\n", status);

if (status == PRO_TK_NO_ERROR)
{
status = ProParameterDesignationAdd(&param);

ProParameterDesignationVerify(&param, &p_exist);
if (p_exist == PRO_B_TRUE)
fprintf( stream, "%s\n", "DESIGNATED");
if (p_exist == PRO_B_FALSE)
fprintf( stream, "%s\n", "NOT DESIGNATED!");

}
//return(0); // testing

TomU
23-Emerald IV
(To:khimani_mohiki)

If you use the parameters menu (or right mouse button), designate and undesignate are both unique commands:

 

TomU_0-1600441959864.pngTomU_1-1600441985787.png

 

The same is true in the mapkey syntax:

mapkey(continued) ~ Activate `relation_dlg` `PBDesignate`;\
mapkey(continued) ~ Activate `relation_dlg` `PBUndesignate`;\

 

This means that it is possible to create a mapkey to designate a parameter with no risk that it will undesignate it if already designated.

mapkey tom @MAPKEY_NAMEtom;@MAPKEY_LABELtom;~ Command `ProCmdMmParams` ;\
mapkey(continued) ~ Select `relation_dlg` `ParamsPHLay.OMPrmType` 1 `reported_mp`;\
mapkey(continued) ~ Select `relation_dlg` `ParamsPHLay.ParTable` 2 `rowPRO_MP_MASS` `name`;\
mapkey(continued) ~ Activate `relation_dlg` `PBDesignate`;\
mapkey(continued) ~ Activate `relation_dlg` `PB_OK`;

 

All testing was performed with Creo Parametric 6.0.5.1

TomU
23-Emerald IV
(To:TomU)

By the way, there actually is a good article about this in the knowledge base:

https://www.ptc.com/en/support/article/CS74103

Hi Everyone,

 

We have Component Parameter Management automation that can help create and store component parameters that can be used across your organization. These parameters can be grouped and labeled for specific assembly use cases. Attributes such as designated and locked can be added as well, so you don't need to do it manually. Users can then export your assembly structure and add/edit the component parameters in Excel, then import them back into Creo.

 

Please see a demo video (here) on this Component Parameter Management functionality and let me know if there are any questions.

 

Cheers,

John Piotrowski, Co-Founder & Product Manager
CadActive Technologies - www.cadactive.com
Announcements


Top Tags