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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Creo 2.0 ProToolkit: Cannot get geometry item from constraint for datum point

ahofmann
7-Bedrock

Creo 2.0 ProToolkit: Cannot get geometry item from constraint for datum point

@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).

CreoBallConstraintDatumPlane.png

 

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


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

1 REPLY 1

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

Announcements


Top Tags