×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Knowledge Fusion Loop to Collect Cylinder Attributes

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:};

RE: Knowledge Fusion Loop to Collect Cylinder Attributes

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

RE: Knowledge Fusion Loop to Collect Cylinder Attributes

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources