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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Create a Datum Point on flat Surface with Toolkit

windstrike
4-Participant

Create a Datum Point on flat Surface with Toolkit

I have a plate with 6 flat surfaces. It was added to an assembly, and I need to create a Datum point on the front surface, with offset distances to 2 adjacent surfaces.

There's an example from protoolkit/UgGeneralPointCreate.c for creating a General Datum point at Intersection of Three Surfaces, which works great, except I need to locate this point on the front surface with offset to the left and bottom surfaces (edges will work too).

This example (point at Intersection of Three Surfaces) element tree looks like this:

--PRO_E_DPOINT_POINTS_ARRAY               
    |--PRO_E_DPOINT_POINT
         |--PRO_E_DPOINT_POINT_NAME
         |--PRO_E_DPOINT_PLA_CONSTRAINTS 
              |--PRO_E_DPOINT_PLA_CONSTRAINT
                   |--PRO_E_DPOINT_PLA_CONSTR_REF    (Ref to surface 1)
                   |--PRO_E_DPOINT_PLA_CONSTR_TYPE   (PRO_DTMPNT_CONSTR_TYPE_ON)
                   |--PRO_E_DPOINT_PLA_CONSTR_VAL
                   |--PRO_E_DPOINT_PLA_CONSTR_REF    (Ref surface 2 that's adjacent to surface 1)
                   |--PRO_E_DPOINT_PLA_CONSTR_TYPE   (PRO_DTMPNT_CONSTR_TYPE_ON)
                   |--PRO_E_DPOINT_PLA_CONSTR_VAL
                   |--PRO_E_DPOINT_PLA_CONSTR_REF    (Ref surface 3 that's adjacent to surface 1)
                   |--PRO_E_DPOINT_PLA_CONSTR_TYPE   (PRO_DTMPNT_CONSTR_TYPE_ON)
                   |--PRO_E_DPOINT_PLA_CONSTR_VAL

I modified the tree to fit my need as (will be called “1st element tree” from below):

    |--PRO_E_DPOINT_POINT
       |--PRO_E_DPOINT_POINT_NAME
         |--PRO_E_DPOINT_PLA_CONSTRAINTS 
            |--PRO_E_DPOINT_PLA_CONSTRAINT
               |--PRO_E_DPOINT_PLA_CONSTR_REF    (Ref surface 1 – front surface)
               |--PRO_E_DPOINT_PLA_CONSTR_TYPE   (PRO_DTMPNT_CONSTR_TYPE_ON)
               |--PRO_E_DPOINT_PLA_CONSTR_VAL
               |--PRO_E_DPOINT_PLA_CONSTR_REF    (Ref surface 2- Left side)
               |--PRO_E_DPOINT_PLA_CONSTR_TYPE   (PRO_DTMPNT_CONSTR_TYPE_OFFSET)
               |--PRO_E_DPOINT_PLA_CONSTR_VAL  (offset value of 40.0 – front surface width is 100.0)
               |--PRO_E_DPOINT_PLA_CONSTR_REF    (Ref surface 3 - Bottom side)
               |--PRO_E_DPOINT_PLA_CONSTR_TYPE   (PRO_DTMPNT_CONSTR_TYPE_OFFSET)
               |--PRO_E_DPOINT_PLA_CONSTR_VAL  (offset value of 80.0 – front surface length is 200.0)

By plugging in this element tree, it created a red colored point in the Model tree panel. And there’s no such datum point exists in Assembly. Apparently there’s something missing. When I right click on this red point in Model tree and pick “Edit”, there’s nothing shown in the dialog.

Then I tried using the element tree structure partially with PRO_E_DPOINT_DIM_CONSTRAINT (will be called “2nd element tree” from below):

 PRO_E_DPOINT_POINTS_ARRAY               
   |--PRO_E_DPOINT_POINT
        |--PRO_E_DPOINT_POINT_NAME
        |--PRO_E_DPOINT_PLA_CONSTRAINTS 
             |--PRO_E_DPOINT_PLA_CONSTRAINT
                  |--PRO_E_DPOINT_PLA_CONSTR_REF    (Ref to surface 1 – front surface)
                  |--PRO_E_DPOINT_PLA_CONSTR_TYPE   (PRO_DTMPNT_CONSTR_TYPE_ON)
                  |--PRO_E_DPOINT_PLA_CONSTR_VAL
        |--PRO_E_DPOINT_DIM_CONSTRAINTS 
             |--PRO_E_DPOINT_DIM_CONSTRAINT
                  |--PRO_E_DPOINT_DIM_CONSTR_REF (Ref surface 2 – left side)
                  |--PRO_E_DPOINT_DIM_CONSTR_TYPE (PRO_DTMPNT_CONSTR_TYPE_OFFSET)
                  |--PRO_E_DPOINT_DIM_CONSTR_VAL  (offset value of 40.0 – front surface width is 100.0)
                  |--PRO_E_DPOINT_DIM_CONSTR_REF  (Ref surface 3 – bottom side)
                  |--PRO_E_DPOINT_DIM_CONSTR_TYPE (PRO_DTMPNT_CONSTR_TYPE_OFFSET)
                  |--PRO_E_DPOINT_DIM_CONSTR_VAL (offset value of 80.0 – front surface length is 200.0)

And it gave me Access Violation error when ProFeatureWithoptionsCreate is called.

 

The 1st modified element tree refers to Creo Parametric Toolkit 3.0 p786 (Example 4: Point On a Surface or Offset from a Surface):

The 2nd modified element trees refers to ProDtmPnt.h (in the comment section "On/Offset Surface")

I am running out of ideas. Your help will be greatly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions

If you are able to create manually, best way to analyse this is reverse engineering.

 

Create feature manually. Get handler of that feature into code and use API ProElemtreeWrite() to have element tree of your manually created feature. Use that element tree to get idea of what you need to update while creating feature element tree.

View solution in original post

2 REPLIES 2

If you are able to create manually, best way to analyse this is reverse engineering.

 

Create feature manually. Get handler of that feature into code and use API ProElemtreeWrite() to have element tree of your manually created feature. Use that element tree to get idea of what you need to update while creating feature element tree.

That's a great way to do it! Thanks for helping!

Top Tags