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: How can i treat with element using a variable?

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

11 Apr 2008 03:52 AM

I have an amount of element to deal with ,for example an amount of  ponts ,so i think about loop may be useful for this problem;
so i wrote some code in KWE rule.Here is some code:
   /*Rule created by Administrator 2008-4-11*/
let j(integer)
set j=1
 `Geometrical Set.1\Point.1\Activity` =false

i want to associate the point's name with a variable such as j, i want to replace Point.1 with Point.j in KWE rule,if it can success,i can use a variable such as j to control the element ,then a loop may be useful in this scene,a lot of manual acting will save on .
but it can't work ,may be CATIA don't support this technology,
i have need some idea,
Any suggestion about how to solve this issue ?

Mandy

BPRASAD


11 Apr 2008 10:53 AM

 

Yes, it is possible to replace  a part of the text (in an object name Point.i ) to (Point.j) or replace the object.

Depending upon what rule you are using KWA/Rule or KWE/Rule, you may use the following commands or a combinations of

X->SetAttributeObject ("Point.j", GetAttributeObject("Point.i").

X->Set or GetAttributeString.

Its not clear what are you trying to accomplish here? If you could post the actual CATPart and the code, may be then I could look into it.

Thanks


Brian Prasad
COE-DPC/KBE Chairperson
STONE

13 Apr 2008 11:06 PM

Hi,Brian .Thank you for your reply about this problem,i am sorry that i didn't discribe clearly the issue in this post;
I would like to deal with my objects (for example a lot of points) using a batch mode,so i think i may associate the object's name with a integer,
see my code in rule:
let j(integer)
set j=1

for j while j {
 `Geometrical Set.1\Point.j\Activity` =false
}
set j=total -end
for j while j<=total
{
 `Geometrical Set.1\Point.j\Activity` =true
}
but the rule prompt me that `Geometrical Set.1\Point.j\Activity` cann't  be used in this context,more about in the active CATpart;
may be the object of "Geometrical Set.1\Point.j" cann't be regonized in rule,i am in puzzling,
so i need some suggest about this issue,
I hope my description can help you to understand this problem,
 
Mandy

when i upload my CATpart file ,the system prompt me Invalid file type or file exceeds max size(700kb), but the file size only is 58.5kb, i am be puzzled,so i can only the picture about this CATpart file ,

 

 

 






knowledgeds

14 Apr 2008 06:35 AM

Hello,

your problem is that the point is not recognized

a "standard" way to do what needed is the following one :
- create a list parameter
- create a formula or a rule valuating this list parameter : listPoints = `Geometrical Set.1`->Query("Point", "" (this fills the list with all points under the geometrical set)
- modify your rule:

let i (Integer)
let p (Point)

i = 1
for i while i <= listPoints->GetSize()
{
set p = listPoints->GetItem(i)
p.Activity = False /* uses Activity attribute instead of activity parameter */

 

STONE

15 Apr 2008 12:25 AM

Hi,Knowledge ,Thank you for your rely,
may be you are right,i have tried it already, your method is feasible,
my problem is that the point is not recongnized as you point out.if Rule can do this as i point  ,a lot of problems can be solved,
unfortunately,Catia don't supprot this technology,

knowledgeds

15 Apr 2008 07:23 AM
Right, such substituions/replacements are not supported.

KWA Rules can use two kind of objects : the ones they have a link on (parameters, objects that are retrieved when "parsing" the expression), and the ones that are retrieved dynamically (using a function, a method, an attribute).

You are not authorized to post a reply.
Forums > COE Forums > KBE > How can i treat with element using a variable?



ActiveForums 3.6

    

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