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

Changing Dimensions Of Datum points in Table driven Pattern

Regular Member

Changing Dimensions Of Datum points in Table driven Pattern

Hello

 

We are trying update dimensions of the datum points present in the table driven pattern.

We are using the code below.

 

//Retrieve part and display in part window
status = ProMdlnameRetrieve(MdlName, PRO_MDLFILE_ASSEMBLY, &pHandler);
if (status != 0) {
status = ProMdlnameRetrieve(MdlName, PRO_MDLFILE_PART, &pHandler);
}

status = ProObjectwindowCreate(MdlName, PRO_PART, &win_id);
status = ProWindowActivate(win_id);
status = ProMdlDisplay(pHandler);

 

//get datum points from Model
status = ProUtilCollectdatumPoints((ProAssembly)pHandler,&datumpoints);

//get 2nd Datum point dimensions
status = ProUtilCollectPointDimension(&datumpoints[1],&p_dims);
ProArraySizeGet(p_dims, &dimsize);
for (int i = 0; i < dimsize; i++)

{
ProStringToWstring(dimname, "d5210");
ProDimensionSymbolGet(p_dims + i, dimSymbol);

 

//Update dimension d5210 to 900.12
status = ProWstringCompare(dimSymbol, dimname, 5, &cmpres);
if (cmpres == 0)

{
status = ProDimensionValueSet(p_dims + i,900.12);
status = ProDimensionDisplayUpdate(p_dims + i);
status= ProSolidRegenerate((ProSolid)pHandler, PRO_REGEN_UPDATE_INSTS);
}
}

 

This Code works fine for datum points outside the pattern.

For datum points present in the Table driven pattern the dimensions are updated temporarily but are reverted back to original value upon regeneration.

 

we are using Creo 4.0 M030.

 

Any Suggestion would be great help.

 

Thanks and Regards

Rohit

10 REPLIES 10

Re: Changing Dimensions Of Datum points in Table driven Pattern

I am pretty sure there is no way in ObjectToolkit to manipulate Pattern Tables...  The fallback seems to be to import a new table with a Mapkey ... a bit painful.

 

If anyone has a better way - please suggest.

 

Dave

Re: Changing Dimensions Of Datum points in Table driven Pattern

1. is there any way we can change data of the table pattern by importing a file using Toolkit?

 

2. The TOOLKIT user Guide contains Element Tree Structure for a Table Pattern.....can we implement this to access table and change dimensions?

Re: Changing Dimensions Of Datum points in Table driven Pattern

THOSE are VERY good questions.... 

 

I will talk to my developer about that a bit more...   Anyone else have any ideas/feedback on that?

 

Best advice - try it if you can.

 

Dave

Re: Changing Dimensions Of Datum points in Table driven Pattern

Hello Rohit, for me it's working fine.

Assume I have a parametric table in my current model, and one dim has the symbol d89, now change that to 105.6

 

# required code in p-Shell, no error checking 
# list with pattern (can contain *, ? ,[chars]) will return a list containing the dim id, the dim symbol and the dim value, 
# from_ids the dim handle,

foreach match [ps_dim list -pattern d89] {

  foreach {dimid dimsym dimval} $match {}

  set dimObj [ps_dim from_ids $dimid]

  $dimObj config -value  105.6

}

ps_regen

 

 

I would re-think your regen option.

 

Note: ProPattern.h will contain all you need to deal with that kind of a feature, in my point of view Dave is wrongSmiley LOL

 

|      * Table Pattern *
|
|--- PRO_E_GENPAT_TABLE
|      |--- PRO_E_GENPAT_TABLE_DIMS
|      |      |--- PRO_E_GENPAT_TABLE_DIM_ENTRY
|      |             |
|      |             |- PRO_E_GENPAT_TABLE_DIM
|      |
|      |--- PRO_E_GENPAT_TABLE_LIST
|      |      |--- PRO_E_GENPAT_TABLE_ENTRY
|      |             |- PRO_E_GENPAT_TABLE_NAME
|      |             |--PRO_E_GENPAT_TABLE_INSTANCES
|      |                |--PRO_E_GENPAT_TABLE_INSTANCE
|      |                   |--PRO_E_GENPAT_TABLE_INSTANCE_INDEX
|      |                   |--PRO_E_GENPAT_TABLE_INSTANCE_DIMS
|      |                        |--PRO_E_GENPAT_TABLE_INSTANCE_DIM_VALUE
|      | 
|      |--- PRO_E_GENPAT_TABLE_SET_ACTIVE
|

Here is all you need for a Table Pattern. But I think, you don't need that.

 

 

Re: Changing Dimensions Of Datum points in Table driven Pattern

Hello Rohit, for me it's working fine.

Assume I have a parametric table in my current model, and one dim has the symbol d89, now change that to 105.6

# required code in p-Shell, no error checking 
# list with pattern (can contain *, ? ,[chars]) will return a list containing the dim id, the dim symbol and the dim value, 
# from_ids the dim handle,

foreach match [ps_dim list -pattern d89] {

  foreach {dimid dimsym dimval} $match {}

  set dimObj [ps_dim from_ids $dimid]

  $dimObj config -value  105.6

}

ps_regen

 


I would re-think your regen option.

 

Note: ProPattern.h will contain all you need to deal with that kind of a feature, in my point of view Dave is wrongSmiley LOL

 

|      * Table Pattern *
|
|--- PRO_E_GENPAT_TABLE
|      |--- PRO_E_GENPAT_TABLE_DIMS
|      |      |--- PRO_E_GENPAT_TABLE_DIM_ENTRY
|      |             |
|      |             |- PRO_E_GENPAT_TABLE_DIM
|      |
|      |--- PRO_E_GENPAT_TABLE_LIST
|      |      |--- PRO_E_GENPAT_TABLE_ENTRY
|      |             |- PRO_E_GENPAT_TABLE_NAME
|      |             |--PRO_E_GENPAT_TABLE_INSTANCES
|      |                |--PRO_E_GENPAT_TABLE_INSTANCE
|      |                   |--PRO_E_GENPAT_TABLE_INSTANCE_INDEX
|      |                   |--PRO_E_GENPAT_TABLE_INSTANCE_DIMS
|      |                        |--PRO_E_GENPAT_TABLE_INSTANCE_DIM_VALUE
|      | 
|      |--- PRO_E_GENPAT_TABLE_SET_ACTIVE
|

Here is all you need for a Table Pattern. But I think, you don't need that.

Re: Changing Dimensions Of Datum points in Table driven Pattern

If the model has an error after Regen, the new values may ignored, check your config. As far I know, you have to parse an input file by yourself, a function for input is not available.

 

Regarding the feature tree, for me ProFeatureElemDimensionIdGet() will return NOT_FOUND (-4) but 

.7 -type DPOINT_OFST_CSYS_PNTS_ARRAY -array 
.7.1 -type DPOINT_OFST_CSYS_PNT -compound .7.1.1 -type DPOINT_OFST_CSYS_PNT_NAME -wstring PNT0 .7.1.2 -type DPOINT_OFST_CSYS_DIR1_VAL -double 10.0 .7.1.3 -type DPOINT_OFST_CSYS_DIR2_VAL -double 20.0 .7.1.4 -type DPOINT_OFST_CSYS_DIR3_VAL -double 30.0 .7.2 -type DPOINT_OFST_CSYS_PNT -compound .7.2.1 -type DPOINT_OFST_CSYS_PNT_NAME -wstring PNT1 .7.2.2 -type DPOINT_OFST_CSYS_DIR1_VAL -double 40.0 .7.2.3 -type DPOINT_OFST_CSYS_DIR2_VAL -double 50.0 .7.2.4 -type DPOINT_OFST_CSYS_DIR3_VAL -double 60.0 ...

 you can walk the tree, change the double values, and redefine the feature at the end.

Re: Changing Dimensions Of Datum points in Table driven Pattern

Hello all,

Pattern table manipulation API's had existed in Pro/Develop since probably 1992-1993 -proptntbl_set_inst_dim_value , proptntbl_add_inst_to_table, proptntbl_remove_instance and so on...

In WildFire times those API's were replaced with the direct access to  table pattern feature's element tree...

PRO_E_PAT_TABLE

and in Creo it had become

PRO_E_GENPAT_TABLE

There is an example protk_appls\pt_examples\pt_feats\TestPatternCreate.c which shows table pattern element tree manipulation.

There is no need to chase the actual text file containing table instances dimension values because this text file is a 'snapshot' of values stored in feature element tree.

 

The main challenges with editing instance dimensions are:

  • to determine the arithmetic sign (+/-) for the new dimension value(s)
  • to find a 'match' between a user selected feature and a table instance and sub sequentially feature dimensions...  

HIH.

FV.

Re: Changing Dimensions Of Datum points in Table driven Pattern

THAT is an awesome response!

Thank you for the detailed reply.

It was not in the obvious/expected doc locations.

Dave
Highlighted

Re: Changing Dimensions Of Datum points in Table driven Pattern

modification of the element tree for table driven patterns should work just fine...

here is the sample of the feature tree:2_.png

here is the code:

1.png