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

ListComponentsByAssemblyRule and wfcAssemblyExpressionRule return empty result.

Piotr
4-Participant

ListComponentsByAssemblyRule and wfcAssemblyExpressionRule return empty result.

Hi All! 

 

My creo is creo Parametric 10.0.3. 

 

How does the wfcAssemblyExpressionRule works ? Can not find any details. Situation goes like:

 

There is a part with given parameter like YEAR with value 2012. 

Part is child of "activeAssembly" 

After calling ListComponentsByAssemblyRule with expression  "YEAR==2012" I got something in message window like :

 

WARNING: Symbol '�䋐ȃ' not found in model XXXXXXXX. Retrieving submodels.

 

where '�䋐ȃ' is totally random and varies form run to another.  LogTrace  shows that everything is ok with expression string and model. String is std::string passed by copy to local function.  Result is always empty.

 

Here are lines of code

 

   
xstringsequence_ptr stringSeq = xstringsequence::create();      
    stringSeq->append(expression.c_str());
 
    const auto rule = wfcAssemblyExpressionRule::Create(stringSeq);        
 
    wfcAssemblyRule_ptr targetRule = wfcAssemblyRule::cast(rule);
LogTrace(fmt::format("Searching for components with this rule {} in assembly: '{}' ", (string)stringSeq->get(0), (string)activeAssembly->GetInstanceName()));
   LogTrace(fmt::format("wfcAssemblyRuleType {}", (int)targetRule->GetRuleType()));
 
    const auto components = activeAssembly->ListComponentsByAssemblyRule(targetRule);
 
ListComponentsByAssemblyRule works for me with  wfcAssemblyNameRule without problems. 
 
What am I doing wrong? Thanks in advance! 
 
4 REPLIES 4
Piotr
4-Participant
(To:Piotr)

I found  Article - CS242290 - ProRuleInitExpr() and ProRuleEval() cannot gather components by parameters. (ptc.com) which is directly connected with my issue. Can you, THE PTC mark such API with attribute like C++ attribute: deprecated (since C++14) - cppreference.com or just delete it?  Does it make any sense to keep this in  API? This does noting and hang there only as a trap which takes time to investigate why again something is wrong,

olivierlp
Community Manager
(To:Piotr)

Hi @Piotr 

Thank you for bringing this up. Let us look into it. 

Olivier
Piotr
4-Participant
(To:olivierlp)

Thanks for response 🙂 I had bad day(s) with that and searching for walkaround took my time. Hope you will be able to find / do something with that. 

RPN
17-Peridot
17-Peridot
(To:Piotr)

Same here as for finding skeletons, write a visit filter for feature IDs

  • Is the feature ID a component 
  • has the parameter you are looking for
  • the parameter is from the type you need
  • the value is matching

If you want, you can do this recursive if the component is an assembly. 

Announcements


Top Tags