Skip to main content
1-Visitor
June 3, 2015
Solved

Visit all Components/Elements without interaction

  • June 3, 2015
  • 5 replies
  • 2725 views

hey

I am using Creo 2.0 (Date Code M120) with TK/OTK.

In sample applications I found in the internet you can select a feature (via ProSolidFeatVisit()) and in return you'll get a model and information about the feature.

I would like to visit all of the components/elements/features (whatever the modules a model is build of are called) and retrieve all the information without any user interaction.

Basically I want to:

  1. start creo with desired *.prt/*.asm-file
  2. auto-select all features/components/elements (without user interaction)
    1. retrieve all the information (like dimensions,...) (without user interaction)
  3. close creo / save information somehow/somewhere

Any Ideas?

regards,

Luis Güthle


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.
Best answer by Eike_Hauptmann

You can also use :

- ProMdlDependenciesList in a loop with C++ vektor or Map (e.g. Hashmap) would be good

- Filter out whats the right ones you wanna get (ProMdlTypeGet()) you can directly make search through your C++ vektor or reversive function with the hasmap (whats better for you to handle)

- ProSolidDimensionVisit inside a for loop run through all dimensions and get the informations you want

I think about something like this :

pushCurrentModelInVektor

for (int i = 0; i < vector.length; i++) {

  if (ProMdlType(vector.at(i)) == ASM) {

    if (model not in vector) vector.add(submdl);

  }

}

for (int i = 0; vector.length; i++) {

  if (ProMdlType(vector.at(i)) == PRT) { 

    ProSolidDimensionVisit(vector.at(i));

  }

}

Br,

Eike

5 replies

lgüthle1-VisitorAuthor
1-Visitor
June 5, 2015

To be more specific:

  • At the beginning I would basically want to visit all of the dimensions

So if I got a *asm file I imagine I have to visit all *.prt inside the asm and inside the *.prt all the elements wich consist of dimensions?!

I found an example: "..\protoolkit\protk_appls\pt_examples\pt_dbase\TestDimension.c" .."ProTestFeatureDimensionsCollect()" seems like a promising function.. I am trying to get this work for my own code..

FV_01
June 5, 2015

Hi all,

Luis, search source code in toolkit examples for ProUtilAsmTraverse function. It is defined somewhere in UtilVisit.c ( don't remember exact file name).

HIH.

Feliks.

15-Moonstone
June 6, 2015

You can also use :

- ProMdlDependenciesList in a loop with C++ vektor or Map (e.g. Hashmap) would be good

- Filter out whats the right ones you wanna get (ProMdlTypeGet()) you can directly make search through your C++ vektor or reversive function with the hasmap (whats better for you to handle)

- ProSolidDimensionVisit inside a for loop run through all dimensions and get the informations you want

I think about something like this :

pushCurrentModelInVektor

for (int i = 0; i < vector.length; i++) {

  if (ProMdlType(vector.at(i)) == ASM) {

    if (model not in vector) vector.add(submdl);

  }

}

for (int i = 0; vector.length; i++) {

  if (ProMdlType(vector.at(i)) == PRT) { 

    ProSolidDimensionVisit(vector.at(i));

  }

}

Br,

Eike

1-Visitor
July 14, 2015


Hi EikeFlorianPetersen

You gave perfect solution but there is another workaround for above problem.

Here I write another approach for same

Step 1: Get Current Handler using ProMdlCurrentGet()

Step 2: Visit Model Tree using  ProSilidVisit()

Step 3: Filter for Part and Asm using ProMdlType()

Step 4: Now Visit ProSolidDimensionVisit() and write into text

lgüthle1-VisitorAuthor
1-Visitor
July 14, 2015

Nikhil Daslaniya schrieb:

Step 2: Visit Model Tree using  ProSilidVisit()

I only found "ProSolidVisitAction" in TK docu.. and it refers to ProDrawingSolidsVisit which is for drawings?