Hi, I am trying to get all subassembly components to top level by using solidworks api. (I want to make a standalone application).
I used
bool ch = swAssy.ReorganizeComponents(child, swAssy.GetEditTargetComponent());
but it is always giving false result.
Please let me know where I am wrong. I am attaching the code.
private static void dissolve(AssemblyDoc swAssy){
bool blnDone;
Object[] vComps;
Component2 swComp;
ModelDoc2 swCompModel;
blnDone = false;
while (!blnDone){
blnDone=true;
vComps=swAssy.GetComponents(true);
for (int i=0;i swComp= (Component2)vComps[i]; swCompModel = swComp.GetModelDoc2(); if (swCompModel!=null){ if (swCompModel.GetType()==(int)swDocumentTypes_e.swDocASSEMBLY){ object child = swComp.GetChildren(); bool ch = swAssy.ReorganizeComponents(child, swAssy.GetEditTargetComponent()); blnDone = false; } } } }
