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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Programmatically create a Datum Point on flat Surface with Creo Parametric Toolkit

windstrike
4-Participant

Programmatically create a Datum Point on flat Surface with Creo Parametric 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 (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 (surface 2 left of 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 (surface 3 bottom of 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)
     |--PRO_E_DPOINT_PLA_CONSTR_TYPE (PRO_DTMPNT_CONSTR_TYPE_ON)
     |--PRO_E_DPOINT_PLA_CONSTR_VAL
     |--PRO_E_DPOINT_PLA_CONSTR_REF (surface 2 left of s1)
     |--PRO_E_DPOINT_PLA_CONSTR_TYPE (PRO_DTMPNT_CONSTR_TYPE_OFFSET)
     |--PRO_E_DPOINT_PLA_CONSTR_VAL (40.0 - front width is 100)
    |--PRO_E_DPOINT_PLA_CONSTR_REF (surface 3 bottom of s1)
    |--PRO_E_DPOINT_PLA_CONSTR_TYPE (PRO_DTMPNT_CONSTR_TYPE_OFFSET)
    |--PRO_E_DPOINT_PLA_CONSTR_VAL (80.0 - front length is 200)

By plugging 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 no info about this point shown in the dialog.

Then I tried using this element tree structure partially with PRO_E_DPOINT_DIM_CONSTRAINT (will be called “2nd 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 (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 (left face)
       |--PRO_E_DPOINT_DIM_CONSTR_TYPE (PRO_DTMPNT_CONSTR_TYPE_OFFSET)
       |--PRO_E_DPOINT_DIM_CONSTR_VAL (40.0 – front width 100)
       |--PRO_E_DPOINT_DIM_CONSTR_REF (bottom face)
       |--PRO_E_DPOINT_DIM_CONSTR_TYPE (PRO_DTMPNT_CONSTR_TYPE_OFFSET)
       |--PRO_E_DPOINT_DIM_CONSTR_VAL (80.0 – front length 200)

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

 

The 1st modified element tree refers to Creo Parametric Toolkit 3.0 User's Guild on 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!

0 REPLIES 0
Top Tags