Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Knowledge Fusion Loop to Collect Cylinder Attributes

Status
Not open for further replies.

ChrisNash

Aerospace
Oct 28, 2009
1
Can anyone please help me out with this? I am trying to create some KF code to create a list of lists. Each child list should contain the diameter, height, origin, and direction for each cylinder in a list. I figured the best way to gather this information would be to use a loop. I started simple by just trying to gather the values of the cylinder diameters. The code I have is listed below. The error I keep getting is "Child not available in this context".

Are there any suggestions or ideas out there?

#! UGNX/KF 2.0

DefClass: CylinderAttributes (ug_base_part);

(list) CylList: {
Cylinder:,
Cylinder_0:,
Cylinder_1:,
Cylinder_2:,
Cylinder_3:,
Cylinder_4:
}

(list) writer: loop
{
for $ch in CylList:; #iterator
collect Diameter:;
};

(list) demandValue" {writer:};

 
Replies continue below

Recommended for you

Chris,
you are trying to access an external attribute named "Diameter:". You are not refering to any of the local data contained in the CylList: pointed out by $ch.

Regards,
Peter
 
Hello Chris,

Add a child list rule before you collect the data. I think this is the code you are looking for!!!

#! NX/KF 5.0

DefClass: CylinderAttributes (ug_base_part);

(Child List) cylist: {
Class, nx_cylinder;
quantity, 5;
};

(List Modifiable) writer: Loop {
For $Cylinder from 1 to length(cylist:);
For $Diameter is ref(nth($Cylinder,cylist:),"Diameter:");
For $Height is ref(nth($Cylinder,cylist:),"Height:");
For $Origin is ref(nth($Cylinder,cylist:),"Origin:");
For $Direction is ref(nth($Cylinder,cylist:),"Direction:");

Collect {$Diameter,$Height,$Origin,$Direction};
};

Regards,
JyothiBabu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor