Submitted by beginnernx on Thu, 12/08/2016 - 04:24
Forums:
Hi
the input to below function curv is some drafting (curve,face,line etc) from drafting view
static tag_t ask_subassy(tag_t curv)
{
tag_t part_occ=NULL_TAG;
tag_t
*children;
int n,ii;
bool found=false;
//tag_t root_comp=NULL_TAG;
tag_t part = UF_PART_ask_display_part();
tag_t root_assy=UF_ASSEM_ask_root_part_occ(part);
int irc=UF_ASSEM_ask_parent_component(curv,&part_occ);
n= UF_ASSEM_ask_all_part_occ_children(root_assy,&children);
for ( ii = 0; ii < n; ii++)
{
if(part_occ==children[ii])
{
found=true;
return part_occ;
}
}
if (n > 0) UF_free(children);
if(!found)
{ask_subassy(part_occ);}
//return NULL_TAG;
}
i am looking for tag of first level subassembly.facing some prob. please have a look
re: subassy
If I understand correctly, you are trying to get the component that the drafting curve was generated from?
If so, you may find some useful discussion and code here:
http://nxjournaling.com/comment/3651#comment-3651
If I have misunderstood your intent, please post back with more information.
Hi,
Hi,
I have the tool that reads attribute(CALLOUT) from drafting curve selected,
i am using
if (UF_ASSEM_is_occurrence(curve))
{
comp = UF_ASSEM_ask_part_occurrence(curve);
}
UF_ATTR_find_attribute(comp, UF_ATTR_any, "CALLOUT", &type_found);
currently it gives the attribute of the component selected.
I want the attribute of 1st level component.
eg:
Dwg_Assy callout
-85965/B
-12345-A 1
-45897-B 2
-98756-B 3
-98567-c 4
-45698-b 5
12345(45897 is child of 12345) & 98756(98567&45698 are child of 98756) are 2 subassemblies
Suppose if i select 45698-b it should return me no. 3 which is callout of(98756-B )
Hope i am clear
re: component parent
If you have a reference to a component, you can query its .Parent property. Does this help in your situation?