Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
@hi all,
I am currently working on a project to get the geometry properties of joints within an assembly using ProToolkit. However, for Ball joints i am running into problems lately (should be the same for any other type of constraint, too).
When I select datum points as point alignment for the Ball Joint I get an error with bad inputs (line 8 of code below). If I use edges of the boxes instead, everything is working properly (code finishes).
My algorithm is as follows, (unfortunately I cannot copy-paste my complete code here, since it has been growing to big (I will try to add a small example asap)):
// collect geometry data of part
ProModelitem partModelItemPos;
partModelItemPos = _positionConstraint->getPartModeliItem();
ProGeomitemdata* geomDataPart;
error = ProGeomitemdataGet(&partModelItemPos, &geomDataPart);
if (error != PRO_TK_NO_ERROR)
{
std::cout << "Error getting position data of Ball joint (part). Errorcode: " << error << std::endl;
return error;
}
// collect geometry data of assembly
ProModelitem assemblyModelItemPos;
assemblyModelItemPos = _positionConstraint->getAssemblyModeliItem();
ProGeomitemdata* geomDataAssembly;
error = ProGeomitemdataGet(&assemblyModelItemPos, &geomDataAssembly);
if (error != PRO_TK_NO_ERROR)
{
std::cout << "Error getting position data of Ball joint (assembly). Errorcode: " << error << std::endl;
return error;
}
// get joint partner
_partPath = _positionConstraint->getPartPath();
_assemblyPath = _positionConstraint->getAssemblyPath();
std::cout << "BallJoint found: its internal geometry type is: " << geomDataPart->obj_type << std::endl;
// decide from partgeometry type what to do next
switch (geomDataPart->obj_type)
{
case PRO_EDGE_START: // first point in line
{
for (unsigned int i = 0; i < 3; i++)
{
_jointPosition[i] = geomDataPart->data.p_curve_data->line.end1[i];
}
std::cout << "local position of joint w.r.t partframe:" << std::endl << _jointPosition << std::endl;
break;
}
case PRO_EDGE_END: // second point in line
{
for (unsigned int i = 0; i < 3; i++)
{
_jointPosition[i] = geomDataPart->data.p_curve_data->line.end2[i];
}
std::cout << "local position of joint w.r.t partframe:" << std::endl << _jointPosition << std::endl;
break;
}
case PRO_POINT: // not checked yet
{
for (unsigned int i = 0; i < 3; i++)
{
_jointPosition[i] = geomDataPart->data.p_curve_data->point.position[i];
}
std::cout << "local position of joint w.r.t partframe:" << std::endl << _jointPosition << std::endl;
break;
}
My assumption is, that ProToolkit does not treat the datum point as a geometry feature. Is this true? How am I able to get the position of the Ball refence then, since any features within my part could be used as a geometry reference for that constraint.
I hope you understand my problem since I am not really experienced in the field of CAD itself.
Thank you very much for your help.
Best regards,
Andreas
Nachricht geändert durch Andreas Hofmann Can someone add this to toolkit category. I have no clue to do so. Thanks!
Nachricht geändert durch Andreas Hofmann Figured how to set the category
Solved! Go to Solution.
I found a solution.
The problem is, that ProGeomitemdataGet() does not support ProModelitem with type PRO_POINT.
Instead I haveto check whether the type of the geometry found is a point or not and if it is a point gather the data using another way.
For me ProPointInit() and ProPointCoordGet() worked perfectly.
Best regards,
Andreas
I found a solution.
The problem is, that ProGeomitemdataGet() does not support ProModelitem with type PRO_POINT.
Instead I haveto check whether the type of the geometry found is a point or not and if it is a point gather the data using another way.
For me ProPointInit() and ProPointCoordGet() worked perfectly.
Best regards,
Andreas