KF Code Error for ug_askminimumdistance function.
KF Code Error for ug_askminimumdistance function.
(OP)
HI All,
using NX 8.5.3.3 and TC 8.
I have assembly where number of components are assembled. Now I have a specific list of component(Flanges) which I am getting through KF Code.
Now, I have to get the minimum distance between two closest flanges. For that I am comparing each flange with remaining list of flanges. (That's what my intention is !!)
But when code is entering into "ug_askminimumdistance" function. It is displaying me "Datatype Mismatch (Function Argument)" error. I have attached error hereby.
Is there a problem using ug_askminimumdistance function directly on components ?? If yes, then what is alternative?
any help/suggestion appreciated.
using NX 8.5.3.3 and TC 8.
I have assembly where number of components are assembled. Now I have a specific list of component(Flanges) which I am getting through KF Code.
Now, I have to get the minimum distance between two closest flanges. For that I am comparing each flange with remaining list of flanges. (That's what my intention is !!)
But when code is entering into "ug_askminimumdistance" function. It is displaying me "Datatype Mismatch (Function Argument)" error. I have attached error hereby.
Is there a problem using ug_askminimumdistance function directly on components ?? If yes, then what is alternative?
any help/suggestion appreciated.





RE: KF Code Error for ug_askminimumdistance function.
RE: KF Code Error for ug_askminimumdistance function.
I work with quite similar issue now. First question for you - are you sure that your objects are Ug_component(it's not clear from code you provided) If it's so - it's the reason of error, because ug_askminimumdistance works with points, curves, datum_planes, edges, faces, solids, sheets or features (Including UDFS) only. I think you guessed it by now :)
But it is only first difficulty. Next is geometry in assembly itself, when objects belong to different components with different locale frames.
I work with existing assembly in nx4, need to execute some functions like ug_askMinimumDistance. I try to create linked objects this way:
#! UGNX/KF 2.0
DefClass: a_list_90_asm_extract (ug_base_part);
(list Parameter) Sel_Edge1_old: {};
(List) Sel_Edge1_old_Mode: {xform_path};
(List) Sel_Edge1_old_Mask: {Edge, Any_in_Assembly};
(any) Sel_edge1_host: First(Flatten(Sel_edge1_old:));
(any) Sel_edge1_path: ug_adoptObject(Second(Flatten(Sel_edge1_old:)));
(Child) Sel_edge1_Linked:
{
Class, ug_extract_curve;
File_Name, nth(3,(Flatten(Sel_edge1_old:)));
Object_Name, Sel_edge1_host:;
FromPath, {Root,ug_askCurrentWorkPart(),Sel_edge1_path:};
};
(list) Sel_edge1: {Sel_edge1_Linked:};
(Point) Sel_point1: ug_curve_askStartPoint(nth(1,Sel_Edge1:));
but received the error "Component Instance in Path Not Found"
What is wrong? As i understand, FromPath has to be a list of 3 members: Root, filename of component file and instance of component, which determines frame of my object. When i avoid parameter FromPath, programm made linked object at wrong place, so it has to be provided.
2) How to work with ug_extract_curve then? All geometry functions demand ug_curve, but ug_extract_curve is a child of ug_feature, so functions raise errors "missing type..."
Mayby you or anybody know?