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

Find a components loc in assembly

Highlighted
Marble

Find a components loc in assembly

ProTKers,
I am trying to calculate distances between solid coord systems, and simply cannot get this figured out. This seems like it should be so simple.
At this point I'm not even sure I'm heading in the right direction.

I have a long rectangular assembly, with components assembled into the top surface. I need to find the x location for each component in this assembly.
I'm using the default coord system in the component and in the assembly.

What I'm doing now is
/* getting matrix for assy components
status = ProAsmcomppathInit (mdl, c_id_table, 0, &comp_path);
/* (this is non interactive, so ProAsmcomppathInit is the only way I see to get a comp_path)
status = ProAsmcomppathTrfGet (&comp_path,PRO_B_TRUE,matrix);

/* getting default csys from component,
status = ProCsysDataGet(p_csys[Target], &geomdata);
/* applying matrix to each vector
ProPntTrfEval(geomdata->data.p_csys_data->x_vector, matrix, OutVec);
fprintf(testbug, "XVec %f, %f, %f\n", OutVec[0], OutVec[1], OutVec[2] );
ProPntTrfEval(geomdata->data.p_csys_data->y_vector, matrix, OutVec);
fprintf(testbug, "yVec %f, %f, %f\n", OutVec[0], OutVec[1], OutVec[2] );
ProPntTrfEval(geomdata->data.p_csys_data->z_vector, matrix, OutVec);
fprintf(testbug, "zVec %f, %f, %f\n", OutVec[0], OutVec[1], OutVec[2] );
ProPntTrfEval(geomdata->data.p_csys_data->origin, matrix, OutVec);
fprintf(testbug, "origin %f, %f, %f\n", OutVec[0], OutVec[1], OutVec[2] );

Here's the output, not nearly what I expected. Its the same for every part.
XVec 1.000000, 0.000000, 0.000000
yVec 0.000000, 1.000000, 0.000000
zVec 0.000000, 0.000000, 1.000000
origin 0.000000, 0.000000, 0.000000

Thanks for any help you can offer.

Mark



3 REPLIES 3

RE: Find a components loc in assembly

Mark,

You need to read the section in the API Wizard under User's
Guide->Coordinate Systems and Transformations. The function
ProAsmcomppathTrfGet (with PRO_B_TRUE) gets you the matrix to transform a
point from the component csys to the top-level assembly csys. You need to
do this for each component (that you want to measure) in order to get
geometry in the same csys.



Or if you are trying to calculate a distance between two parts then try the
function pro_compute_clearance.



Patrick

_____

RE: Find a components loc in assembly

Hello all,

Mark,
The problem is in:
status = ProAsmcomppathInit (mdl, c_id_table, 0, &comp_path);
This statement would produce the default singular orthogonal matrix.
What needs to be done is to visit component features in the assembly
solid. The result would be an array of component feature ids. Use
component feature id to initiate component path:
for(i=0;i<n_ids;i++){<br/> c_id_table[0] = comp_ids[i];
c_id_table[1] = -1;
status = ProAsmcomppathInit( (ProSolid) mdl, c_id_table, 1,
&comp_path);
...
}
(This example assumes that you have 'flat' one level assembly, for
multilevel assembly you need to do recursive ProSolidFeatVisit)


As a result the ProAsmcomppathTrfGet will return the correct trf matrix.

HIH
Feliks.



RE: Find a components loc in assembly

Mark,
Feliks is correct. You need to build a feature id table which is the
assembly component path from the top-level to the component. An
excellent explanation of this is in the API Wizard under User's
Guide->Assemblies->Structure of Assemblies and Assembly Objects. PTC
has a nice picture of an assembly hierarchy and component ID table
(assembly component path).

Patrick Williams
Application Engineer
Steelcase Inc.