Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

EKL Parameters search and selection.

Status
Not open for further replies.

eduardopinto07

Automotive
Feb 28, 2014
20
Good night colleagues!

I am trying to find a way to:
1) insert a Part in an Assembly
2) Read a string parameter inside the inserted Part (The parameter was published)
3) Read a Length parameter inside the inserted Part (The parameter was published)
4) Set the Length parameter to another value.
5) based on the string parameter, search for an Axis System that contains part of the previously found String (The Axis System was published).

This is what I have so far...
 
My environment:

* Part to be inserted.

myComp_k3kxtv.jpg


* Assembly to receive the Part

PRODUCT_vs9wjr.jpg


The assembly contains:

A) A Reaction that is triggered when I insert an Object to my assembly and passes the "inserted" argument from the reaction to the action.

REACTION_c5ceap.jpg


b) An Action that receives the "Inserted" argument from the reaction. A message box displays the attribute Name from the "Inserted" argument.

myAction_njyeqx.jpg

Messagebox_h96wsa.jpg


I need:

1) Read and display the "COMP_TYPE" (String) parameter value = mycomp
2) Read and display the mycomp_STACK_HEIGHT (Length) parameter value = 20mm
3) Set mycomp_STACK_HEIGHT (Length) parameter value = 30mm
4) Search and select AS_mycomp_STACK_HEIGHT (Axis_System).

I tried several times to accomplish it using Find and Query, but I don't understand EKL a lot to do it. I already read the documentation but couldn't understand it...

This is what I tried:
************************************************************************************
Let myParameter (Parameter)
Set myParameter = MyInsertedComponent->Query("Parameter","x.Name==\"COM_TYPE\"")

Let myString (String)
myString = myParameter.Name

Message("Parameter Name:", myString)
************************************************************************************

Any support will be very appreciated.

Thank you for your time and knowledge!

Eduardo
 
Replies continue below

Recommended for you

Hi everyone, any ideas? Even a "bad news is a news"...
Thank you for your help!
Eduardo
 
did you try with inserted.ListPublications() ?this return the name of all publication (FYI I am using 3DX CATIA not V5)

Eric N.
indocti discant et ament meminisse periti
 
Hi Eric, thank you for your reply!
Unfortunately in V5 we don't have the method that you mentioned. I found this list yesterday in the documentation.
Screenshot_20231011-064459_n4lofk.png

I heard that are differences on how the publication is structured in CATIA 3DX in comparison to V5. Maybe this is the reason you have it, and in V5, we don't.
I am still searching...

Really appreciate you time!

Thank you.
 
do you need to use publication? are the parameters and axis always named the same?

Eric N.
indocti discant et ament meminisse periti
 
Hey Eric, the name in the parameters are always the same for each family of components.
All of them are published.
I was trying to Query or Find the string, but I am having difficulty to understand how to build the statement to to that. I was able to get the value using Find, but there is a problem ..if I have another string and it's item count is first them the one that I want, the script returns the string that I don't want...

Not sure what I am doing wrong...

Looks like the Query is working, but I am not being able to narrow down to the parameter name that I want.
 
Hi Little Cthulhu, I am using Reaction with VB Actions now. The problem is with VB Action I couldn't find a way to create global variables and access them from other VB Actions...I posted some questions about this topic some weeks back.

The reason I need to do it is because all the components are together in IF ELSE statments inside the reaction. We are rolling out some of these templates globally and it is becoming more challenging to manage the whole thing...If I separate the parts, the parameters for each part, and the features in smaller groups (Actions) I suspect this will be better to manage and to expand on the long run.

And with CATIA 3DEx on the roadmap for my company, according to Dassault, if I use EKL, will be easier to transition to it.

That is the reason...

I added the test CATPART + CATPRODUCT that I am using.


I am using only Knowledgeware advisor. This is the only license I have for automation.

Thank you for your support!
 
The problem is with VB Action I couldn't find a way to create global variables and access them from other VB Actions

And how would you do that with KW?
 
I don't believe I can...so what I am thinking is to separate the tasks in small pieces, so no more thinking about global variables. The main idea is to move to EKL...

Please see below what I've got so far...

If you add this code to the action that is inside the product...it will do partially the job...I still need to set the value...but this will be tomorrow...or today....I need to sleep...

Code:
Message("MyProduct:", MyInsertedComponent.Name)

let myPart (Part)
Set myPart = MyInsertedComponent.Find("Part","",true) \"I was able to access the Part inside the product like in VBA...\"

let myPartName (String)
myPartName = myPart.Name
Message("Part Name:", myPartName)

let myParameterSet (AdvisorParameterSet) \"This is how to access the parameter set \"
set myParameterSet  =  myPart.Find("AdvisorParameterSet", "x.Name==\"Parameters\" ", true) \"I believe if you have a different parameter set you just change the x.Name== yourParameterSetName...I didn't test it yet...\"

let myParameterString (String)
myParameterString =myParameterSet ->GetAttributeString("COMP_TYPE") \"How to search for a parameter string\"
Message("Parameter String:",myParameterString)

Let myStackHeightName (String)
myStackHeightName = myParameterString + "_STACK_HEIGHT"

let myParameterLength (Length)
myParameterLength =myParameterSet ->GetAttributeReal(myStackHeightName)*1m \"how to search for a length parameter \"
Message("Parameter Length:",myParameterLength)

Let myAxisSystemName (String)
myAxisSystemName = "AS_" + myStackHeightName
Message("Axis System Name:",myAxisSystemName)

Let myAxisSystemStringForSearch (String)
myAxisSystemStringForSearch = "x.Name==\"" + myAxisSystemName + "\""
Message("Axis System String For Search:",myAxisSystemStringForSearch)
	
Let myAxisSystem (AxisSystem)
Set myAxisSystem = myPart.Find("AxisSystem", myAxisSystemStringForSearch, true) \" how to get an axis system\"
Message("myAxisSystemName:",myAxisSystem.Name)

But there is a catch...
you need to right click the parameter and access the Properties panel.
you need to change, [highlight #FCE94F]NOT ONLY THE NAME attribute[/highlight], but also the [highlight #FCE94F]LOCAL NAME attribute[/highlight]!!!!!!!! If you don't, you are not going to find the parameter!

Not going to work(Below)
Catch_on_the_properties1_yic7l3.jpg


Going to work
Catch_on_the_properties2_l2gtka.jpg


Going to work
Catch_on_the_properties3_nahbgy.jpg


Below are the message box from the code:

This is the Product(Part inserted - Instance Name)
My_Instance_name_Product_c8hh0y.jpg


This is the Part Name
Part_Name_sbxmr6.jpg


This is the String Parameter:
Parameter_String_hgb4lt.jpg


This is the length Parameter:
Parameter_Length_pwow3w.jpg


This is to build the string to search the Axis System - first step
Axis_System_Name_gqnqdq.jpg


This is to build the string to search the Axis System - Second step
string_to_search_jlmjcl.jpg


This is the Name attribute from the Axis System Object:
Axis_system_object_name_acxf7d.jpg


I hope it helps.

Still on my EKL journey...haha

If I find any other interesting things, I will continue this post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor