Skip to main content
8-Gravel
July 22, 2024
Question

ListComponentsByAssemblyRule and wfcAssemblyExpressionRule return empty result.

  • July 22, 2024
  • 1 reply
  • 1833 views

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! 
 

1 reply

8-Gravel
July 24, 2024

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
July 26, 2024

Hi @Piotr_64781 

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

Olivier
8-Gravel
July 26, 2024

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.