// Called when a PropertyManagerPageButton is pressed. In our case, that's only the export button for now void IPropertyManagerPage2Handler9.OnButtonPress(int Id) { if (Id == Button_export_ID) //If the export button was pressed { saveActiveNode(); if (checkIfNamesAreUnique((LinkNode)tree.Nodes[0]) && checkNodesComplete(tree)) // Only if everything is A-OK, then do we proceed. { pm_Page.Close(true); //It saves automatically when sending Okay as true; AssemblyDoc assy = (AssemblyDoc)ActiveSWModel; //This call can be a real sink of processing time if the model is large. Unfortunately there isn't a way around it I believe. int result = assy.ResolveAllLightWeightComponents(true); // If the user confirms to resolve the components and they are successfully resolved we can continue if (result == (int)swComponentResolveStatus_e.swResolveOk) { // Builds the links and joints from the PMPage configuration LinkNode BaseNode = (LinkNode)tree.Nodes[0]; automaticallySwitched = true; tree.Nodes.Remove(BaseNode); Exporter.createRobotFromTreeView(BaseNode); AssemblyExportForm exportForm = new AssemblyExportForm(swApp, BaseNode); exportForm.Exporter = Exporter; exportForm.Show(); } else if (result == (int)swComponentResolveStatus_e.swResolveError || result == (int)swComponentResolveStatus_e.swResolveNotPerformed) { MessageBox.Show("Resolving components failed. In order to export to URDF, this tool needs all components to be resolved. Try resolving lightweight components manually before attempting to export again"); } else if (result == (int)swComponentResolveStatus_e.swResolveAbortedByUser) { MessageBox.Show("In order to export to URDF, this tool needs all components to be resolved. You can resolve them manually or try exporting again"); } } } }
// Called when a PropertyManagerPageButton is pressed. In our case, that's only the export button for now void IPropertyManagerPage2Handler9.OnButtonPress(int Id) { if (Id == Button_export_ID) //If the export button was pressed { saveActiveNode(); if (checkIfNamesAreUnique((LinkNode)tree.Nodes[0]) && checkNodesComplete(tree)) // Only if everything is A-OK, then do we proceed. { pm_Page.Close(true); //It saves automatically when sending Okay as true; AssemblyDoc assy = (AssemblyDoc)ActiveSWModel; //This call can be a real sink of processing time if the model is large. Unfortunately there isn't a way around it I believe. int result = assy.ResolveAllLightWeightComponents(true); // If the user confirms to resolve the components and they are successfully resolved we can continue if (result == (int)swComponentResolveStatus_e.swResolveOk) { // Builds the links and joints from the PMPage configuration LinkNode BaseNode = (LinkNode)tree.Nodes[0]; automaticallySwitched = true; tree.Nodes.Remove(BaseNode); Exporter.createRobotFromTreeView(BaseNode); AssemblyExportForm exportForm = new AssemblyExportForm(swApp, BaseNode); exportForm.Exporter = Exporter; exportForm.Show(); } else if (result == (int)swComponentResolveStatus_e.swResolveError || result == (int)swComponentResolveStatus_e.swResolveNotPerformed) { MessageBox.Show("Resolving components failed. In order to export to URDF, this tool needs all components to be resolved. Try resolving lightweight components manually before attempting to export again"); } else if (result == (int)swComponentResolveStatus_e.swResolveAbortedByUser) { MessageBox.Show("In order to export to URDF, this tool needs all components to be resolved. You can resolve them manually or try exporting again"); } } } }