Knowledge Fusion Loop to Collect Cylinder Attributes
Knowledge Fusion Loop to Collect Cylinder Attributes
(OP)
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:};
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:};





RE: Knowledge Fusion Loop to Collect Cylinder Attributes
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
RE: Knowledge Fusion Loop to Collect Cylinder Attributes
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