Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X
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
Solved! Go to Solution.
modification of the element tree for table driven patterns should work just fine...
here is the sample of the feature tree:
here is the code:
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
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?
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
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:
HIH.
FV.
modification of the element tree for table driven patterns should work just fine...
here is the sample of the feature tree:
here is the code:
Hi
I created a C++ dll which will be invoked through C# windows form.
the tool worked fine and successfully updated the Assembly using ProFeatureWithoptionsRedefine() API.
But when i tried it in some other system having same Creo version and proper editing license the API ProFeatureWithoptionsRedefine() gave me a message prompt to edit the table pattern.the tool exceution wouldn't be completed unless the user provides an input to Creo.
i tried changing the contents of config.pro file.
Is there any other specific creo settings which needs to be changed ?
Any Suggestion would be great help
Thanks and regards,
Rohit
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 wrong
| * 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.
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 wrong
| * 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.
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.
In Tcl your code:
set name mypart if [catch { set M [ ps_file open $name.asm] } ] { set M [ps_file open $name.prt] } ps_wind set $M set dimid [lindex [ps_dim list -model $M -pattern d5210] 0] set dimObj [ps_dim from -model $M $dimid] $dimObj config -value 900.12 $dimObj show ps_regen
In your code you mix PART/ASSEMBLY. But I don't believe that this cause your problem.
CollectdatumPoints use ProAssembly even if you load a Model.
ObjectwindowCreate may use PRO_PART even if you load an assembly ...
But anyhow I tested it again, and after regen the dimension was changed.
For the tree, here the part of the tree for 2 tables and the second one is active with 3 points
.3.2 -type GENPAT_TABLE_LIST -array .3.2.1 -type GENPAT_TABLE_ENTRY -compound .3.2.1.1 -type GENPAT_TABLE_NAME -wstring TABLE1 .3.2.1.2 -type GENPAT_TABLE_INSTANCES -array .3.2.1.2.1 -type GENPAT_TABLE_INSTANCE -compound .3.2.1.2.1.1 -type GENPAT_TABLE_INSTANCE_INDEX -integer 1 .3.2.1.2.1.2 -type GENPAT_TABLE_INSTANCE_DIMS -array .3.2.1.2.1.2.1 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 11.0 .3.2.1.2.1.2.2 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 31.0 .3.2.1.2.1.2.3 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 21.0 .3.2.1.2.2 -type GENPAT_TABLE_INSTANCE -compound .3.2.1.2.2.1 -type GENPAT_TABLE_INSTANCE_INDEX -integer 2 .3.2.1.2.2.2 -type GENPAT_TABLE_INSTANCE_DIMS -array .3.2.1.2.2.2.1 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 111.0 .3.2.1.2.2.2.2 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 131.0 .3.2.1.2.2.2.3 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 121.0 .3.2.1.3 -type GENPAT_TABLE_EDIT .3.2.1.4 -type GENPAT_TABLE_READ .3.2.1.5 -type GENPAT_TABLE_WRITE .3.2.2 -type GENPAT_TABLE_ENTRY -compound .3.2.2.1 -type GENPAT_TABLE_NAME -wstring TABLE2 .3.2.2.2 -type GENPAT_TABLE_INSTANCES -array .3.2.2.2.1 -type GENPAT_TABLE_INSTANCE -compound .3.2.2.2.1.1 -type GENPAT_TABLE_INSTANCE_INDEX -integer 1 .3.2.2.2.1.2 -type GENPAT_TABLE_INSTANCE_DIMS -array .3.2.2.2.1.2.1 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 50.0 .3.2.2.2.1.2.2 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 60.0 .3.2.2.2.1.2.3 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 70.0 .3.2.2.2.2 -type GENPAT_TABLE_INSTANCE -compound .3.2.2.2.2.1 -type GENPAT_TABLE_INSTANCE_INDEX -integer 2 .3.2.2.2.2.2 -type GENPAT_TABLE_INSTANCE_DIMS -array .3.2.2.2.2.2.1 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 55.0 .3.2.2.2.2.2.2 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 65.0 .3.2.2.2.2.2.3 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 75.0 .3.2.2.2.3 -type GENPAT_TABLE_INSTANCE -compound .3.2.2.2.3.1 -type GENPAT_TABLE_INSTANCE_INDEX -integer 3 .3.2.2.2.3.2 -type GENPAT_TABLE_INSTANCE_DIMS -array .3.2.2.2.3.2.1 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 70.0 .3.2.2.2.3.2.2 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 80.0 .3.2.2.2.3.2.3 -type GENPAT_TABLE_INSTANCE_DIM_VALUE -double 90.0 .3.2.2.3 -type GENPAT_TABLE_EDIT .3.2.2.4 -type GENPAT_TABLE_READ .3.2.2.5 -type GENPAT_TABLE_WRITE .3.3 -type GENPAT_TABLE_SET_ACTIVE -integer 1
Here I would be able to modify the value. I need to have the tree for the pattern feature with the id 334. To change the last dim (90.0) within the tree:
ps_ftree ft
ft config -model $M -id 334 -type pattern
ft get
ft itemconfig .3.2.2.2.3.2.3 -double 99.99
ft redefine