knowledge fusion, centroid from CSYS

Hello Everyone,

I'm writing a function on knowledge fusion to get the centroid of an object and put it in the expression.

Then if the object changes, the expression values updates.

Now I need some help, I'm trying to modified the function to use a selected CSYS to measure the Centroid.
if I then update the CSYS or the body, the values should update in the expressions.

What I need help on is:
- How to make the selection Filter for CSYS
- how to use it for the centroid

Here is what I have so far:

DefClass: centroid (%nx_application %ui_comp);

(Boolean) %on_solid?: false; # this feature will create an independent solid
(String Parameter) %ask_name: "Centroid"; # feature name
(string) %icon_name: "section_inertia"; # icon in MNT
(Integer) %edit_dialog: ug_invokeClassDialog(self:); # edit feature allowed
(List Uncached) %onObjectHighlight: Centroid:;
(Boolean) %atTimeStamp?: false;

###### Create the interface for user selection ######

### main group of user interface ###
(child) UI_group:{
class, %ui_comp_group;
title, "Body Centroid";
Members, {UI_Select:,UI_Label:,UI_SelectDatum:};
Column, 0;
Group, True;
};

#select solid or a surface body, only 1 item per selection #
(child) UI_Select: {
class, %ui_comp_selection;
Many, False;
Label, "Solid or Surface to Analyse";
Tooltip, "Select the Solid or Surface to analyse";
FilterTriple, {{ 70, 0, 35 },{ 70, 0, 36 }};
};

#user text box for expression names#
(child) UI_Label:{
class, %ui_comp_string;
Value, "";
PresentationStyle, 1;

#select CSYS #
(child) UI_SelectDatum: {
class, %ui_comp_selection;
Many, False;
Label, "Coordinate System";
Tooltip, "Select the Coordinate System";
FilterTriple, {{ 70, 0, 35 },{ 70, 0, 36 }};
};

# make the selected object into the string #
(Instance) object: ug_adoptObject(nth(1,UI_Select:SelectedObjects:));
(Instance) datum: ug_adoptObject(nth(1,UI_SelectDatum:SelectedObjects:));

# Create the expressions with reference to the centroids of X, Y, Z of the solid or sheet selected
# the 'child uncached' allows expressions to be recalculated automatically when geometry changes

(child uncached) x: {
Class, ug_expression;
Name, UI_Label:Value: + "_x";
Value, localX(object:centroid:);
};
(child uncached) y: {
Class, ug_expression;
Name, UI_Label:Value: + "_y";
Value, localY(object:centroid:);
};
(child uncached) z: {
Class, ug_expression;
Name, UI_Label:Value: + "_z";
Value, localZ(object:centroid:);
};

# Creates a Point at the object Centroid
(child) centre_de_gravite_point: {
Class, ug_point;
position, object:centroid:;
};

Personally, I don't know enough KF to answer your question. Perhaps the other forum members do; however, there have been very few discussions on KF at this forum. If you don't get any response here, you might want to try at the Siemens community forum.

Looks like the FilterTriple is wrong in your Coordinate System selection. You're using the same one you used to select a solid body, which can't be correct. I can't remember the object type for a CSYS, but that's what you need to put in your FilterTriple.

You'll probably find it hard to get KF help. Not very many people use it, these days.