Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
> ... My question is: Does this function require that the csys
> specified be owned by the specified solid? This behavior does
> not happen in the Pro/ENGINEER command Analysis->Model->Mass
> Properties.
I think the ProSolid that is passed into this function
determines the context of the analysis.
If it's a part, then it would be as if you had a single part
open in Pro/Engineer and ran the analysis. In this case,
even in normal Pro/Engineer, i don't think you can
reference a CSYS from another model.
It seems that there's a couple different ways to go about
what you're trying to do:
1) Create a simplified rep in the assembly showing only
this part, using a CSYS from the assembly.
2) Figure out the transform matrix between the part default
CSYS and the assembly CSYS, create a new CSYS in the part
using that transform, then run the analysis using that CSYS.
3) Using the transform matrix from option #2, tranform the
results of using the part's default csys.
Hopefully one of these options will work for you.
Marc
--
Marc Mettes
-
Visit My CAD/PDM AutomationBlog
Or, Subscribe to My CAD/PDM Automation Blog by Email
Hi all,
Patric,
Here is a code snippet to get mass properties in the selected coordinate system
(writing from memory, don't have a user guide near by, check spelling,error checks are ommitted)
ProSelect( "csys",1, NULL,NULL,NULL,NULL, &p_sel,&n_sel);
ProSelectionModelitemGet( p_sel[0], &csys_gi);
ProSelectionAsmcomppathGet( p_sel[0], &cpath_csys);
ProGeomitemGeomitemdataGet( &csys_gi,&p_gd);
//gettransformation matrix from the coordinate system to thecsys owner model
ProMatrixInit( p_gd->p_csys_data->x_v, p_gd->p_csys_data->y_v, p_gd->p_csys_data->z_v, p_gd->p_csys_data->origin, from_csys_trf);
//invert matrix to get transformation from global to local
UserMatrixInvert( from_csys_trf, to_csys_trf);
//get transfromation from the assembly to the owner of the csys, or init identity matrix if csys belongs to assembly
ProAsmcomppathTrfGet( &cpath_csys, PRO_B_FALSE, asm2csysowner_trf);
//multiply matrix to get combined transformation from assembly global frame to the selected csys
UserMatrixMultiply( result_trf, to_csys_trf, asm2csysowner_trf); //check an order of arguments...
//select part andget transfromation matrix from part to assembly frame
ProSelect( "part",1, NULL,NULL,NULL,NULL, &p_sel,&n_sel);
ProSelectionAsmcomppathGet( p_sel{0], &cpath);
ProAsmcomppathTrfGet( &cpath, PRO_B_TRUE, part2asm_trf);
ProAsmcomppathMdlGet( &cpath, &part);
//multiply combined matrix with part matrix to get a final transformation
UserMatrixMultiply( final_trf, result_trf, part2asm_trf);
//get mass properties
ProSolidMassPropertyGet( part, NULL, &prop);
//use ProPointTrfEval to transfer point properties and ProVectorTrfEval for vector entities
//center of gravity:
ProPointTrfEval( prop->center_of_gravity, final_trf, cntr_grav);
and so on...
HIH.
Feliks.