Welcome to the COE Discussion Forum! 

 

To participate in the discussion forum, you must be logged in to the website.  If you forget your login information, please contact COE Headquarters at coe@coe.org or (800) 263-2255.

If you are new to the COE Discussion Forum and would like to participate, please register.

 

COE DISCUSSION FORUM
Subject: Expert Rule With Lists

You are not authorized to post a reply.   
Author Messages
MADAXE

12 May 2008 05:55 PM

I have a CATPart That contains A List called "PointList" also their are a series of geometrical sets that contain point data which is constaintly changing geometric set and existance.  I want to write a expert rule that populates an existing List with all the point objects.

 

MyPointoint

Let MyList(List)

MyList = `Parameters\PointList`

I know this is wrong here but how do i make it so that i can access the existing list?

MyList ->AddItem(MyPoint,1)

 

 

MAD,MADXAE

 

 

knowledgeds

13 May 2008 03:13 AM
Hello,

A simple formula or a Knowledge Adivsor rule can make it (let's say that the mechanical part is named "part":

ListPoints = part.Query("Point", "")

(the second argument can be used to add an expressional filter, for example:
ListPoints = part.Query("Point", "x.Coord(2) == 0mm") will retrieve all points with y coordinate equal to zero).
MADAXE

13 May 2008 06:11 AM

Thanks for your post

I had already looked at that,im doing more withit. im changing names filtering certain points getting the owner and so on once i have filtered the points i want to add them to a perminant list, i understand that in an expert rule you can creat a temporary list but i want a persistant one.

 

Madaxe

knowledgeds

13 May 2008 06:54 AM
It is not easily possible to create a list within rules (expert or adivsor). You can create the list thanks to a macro with argument and call it in a KWA rule, but you then have to manage associativity (each time the rule will be evaluated, a new list will be created).

But if you have an existing list ("permanent", "persistent"), you can fill it with the method I provided, only in KWA rules (in expert rules, you can not refer existing objects).

If you want to work on the list before (filtering it, ...), you can work with a volatile list, and finally inject its content in the permanent list:

let vollist (List)

... /* fill the vollist list, filter it, ... */

PointsList = vollist /* injects vollist content in PointsList which is a permanent list */
MADAXE

13 May 2008 07:53 AM

In this example im trying to build a list of components within  an assembly and populate a list for a bom  thre last line i did what you surgested make PointList=FinalList and i get the following error

Syntax Error Line 90: Parameter PointList cannot be used in this context

 

Madaxe


/*Rule created by madaxe 05/12/08 MyPartart*/

Let MyPartList(List)

Let MyProdList(List)

Let FinalList(List)

Let MyPartName(String)

Let MySize(Integer)

Let I(Integer)

Let ListItem(String)

Let MyListPart(Part)

Let MyListAssy(Assemble)

Let Len(Integer)

/*####################### Get Root Node From A Direct Child Sub Assembly #####################*/

MyProdList = MyProduct -> Query("Assembly",""

I = 1

For I While I <= MyProdList -> Size()

{

MyListAssy = MyProdList -> GetItem(I)

ListItem = MyListAssy.Owner.Name

Len = ListItem->Search(".CAT"

if Len <> -1

{

MyProdList ->RemoveItem(I)

}

 

}

I = 1

For I While I <= MyProdList -> Size()

{

MyListAssy = MyProdList -> GetItem(I)

FinalList -> AddItem(MyListAssy.Owner,1)

/*Message("#",FinalList -> GetItem(I))*/

}

 

/*###############################################################################*/

MyPartList = MyPart.Owner->Query("Part",""

I = 1

For I While I <= MyPartList -> Size()

{

 

MyListPart =MyPartList -> GetItem(I)

ListItem = MyListPart.Owner.Name

Len = ListItem->Search(".CAT"

if Len <> -1

{

MyPartList ->RemoveItem(I)

}

}

I = 1

For I While I <= MyPartList -> Size()

{

MyListPart = MyPartList -> GetItem(I)

FinalList -> AddItem(MyListPart,I+1)

}

/*###############################################################################*/

MySize = FinalList->Size()

Message("#","My List Size = " + MySize)

I = 1

For I While I <= FinalList -> Size()

{

MyListPart = MyPartList -> GetItem(I)

Message("#",MyListPart.Name)

}

/*###############################################################################*/

PointList=FinalList


knowledgeds

13 May 2008 08:12 AM
Is it a Knowledge Advisor rule??? I don't think so... The use of permanent list can not be done in KWE rules.

Here, the error only says the list is not found. It means that either you are not in a KWA rule, or it is not in the same place than the rule (in a Product), or it has not the good name, or the list is in another document, and you need to prefix it (or just to click or double click on it within expression and you will get the correct name to use)

You have to know following thing : The content of the persistent lists is controlled... It can not contain (at least on last delivered CATIA versions) links to other documents. If we'd authorize such links, it would open big holes in data model integrity (it would be possible to create mechanical features with inputs located in other parts without the use of imports for example).

So if you work in a product context and your goal is to gather objects in different parts in a persistent list, it is not possible.
MADAXE

13 May 2008 09:28 AM

This is an Expert Rule KWE, so the bottom line is you can' update a persistant list with Knowledge Expert

 

Mad Axe

 

 

You are not authorized to post a reply.
Forums > COE Forums > KBE > Expert Rule With Lists



ActiveForums 3.6

    

401 North Michigan Avenue, Chicago, IL 60611-4267 | (312) 321-5153 | (800) COE-CALL (U.S.)