I'm new to Knowledge Fusion, I'm trying to create a .dfa script that will add some values from a surface or solid to expressions, so I can then export to excel.
Here is what I have so far:
DefClass: centers (%nx_application %ui_comp);
(Boolean) %on_solid?: false;
(String Parameter) %ask_name: "Centers";
(string) %icon_name: "section_inertia";
(Integer) %edit_dialog: ug_invokeClassDialog(self:);
(List Uncached) %onObjectHighlight: centers:;
(Boolean) %atTimeStamp?: false;
(child) UI_Select: {
class, %ui_comp_selection;
Many, False;
Label, "Select surface or solid to analyse";
Tooltip, "Select the Surface or Solid to analyse";
FilterTriple, {{ 70, 0, 35 },{ 70, 0, 36 }};
};
(Instance) objet: ug_adoptObject(nth(1,UI_Select:SelectedObjects:));
This part finds the centers and add it to expressions:
(child uncached) x: {
Class, ug_expression;
Name, "x";
Value, localX(objet:centroid:);
};
(child uncached) y: {
Class, ug_expression;
Name, "y";
Value, localY(objet:centroid:);
};
(child uncached) z: {
Class, ug_expression;
Name, "z";
Value, localZ(objet:centroid:);
};
Now I'm trying to add surface area if the object selected is a surface, or volume is it is a solid body.
this is what I tried:
(child uncached) area: {
Class, ug_expression;
Name, "area";
Value, area(objet:surface_area:);
};
this didn't work, the application crashes, saying the is no class surface_area.
I also have no idea how to make an if statement in the language.
It has been super hard to create this, there is almost no info online and I couldn't find documentation on functions etc, everything so far as been trial and error.
would very much appreciate some help and guidance on this Thank so much
I find out to find areas and volumes if anyone has the same problem. Still could figure out how to do the if statement because I can't find a why to ask if object is a solid or surface.
However both work if both solids and surface, just give 0 for the volume of a surface obviously.
here is the code:
How it help anyone trying to create custom NX functions