Showing results for 
Search instead for 
Do you mean 
Reply

KF: create linked object in an assembly by ug_extract_XXX. How to describe position?_

[ Edited ]

1)I work with existing assembly in nx4, need to execute some functions like ug_askMinimumDistance when objects belong to different components with different locale frames. I try to create linked object 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..."

 

Any ideas how to solve described problems will be highly appreciated.