Good afternoon. I can not solve the problem. I ask for help.
I need to delete the sketch that remains after deleting the selected body in the part. Please tell me how to do this.
I quote the macro code:
SldWorks swApp;
ModelDoc2 swModel;
SelectionMgr swSelMgr;
Edge swEdge = null;
object[] vFace = null;
AssemblyDoc swAssy = default(AssemblyDoc);
Body2 swBody = swEdge.GetBody();
string NameBodi;
string NameBodiKromk;
Component2 swComp;
string NameModel = null;
string NameComp;
swApp = (SldWorks)Marshal.GetActiveObject("SldWorks.Application");
swModel = (ModelDoc2)swApp.ActiveDoc;
swAssy = (AssemblyDoc)swModel;
swSelMgr = swModel.SelectionManager;
swEdge = swSelMgr.GetSelectedObject6(1, -1);
vFace = swEdge.GetTwoAdjacentFaces2();
NameBodi = swBody.Name;
NameBodiKromk = NameBodi;
swComp = swEnt.GetComponent();
string PPPPP = swComp.Name2;
if (PPPPP.IndexOf("^") != -1)
{
PPPPPP = PPPPP.Remove(0, PPPPP.IndexOf("^") + 1);
}
NameModel = swModel.GetPathName();
NameModel = NameModel.Remove(NameModel.LastIndexOf("."));
NameModel = NameModel.Remove(0, NameModel.LastIndexOf("\\") + 1);
swComp = swEnt.GetComponent();
NameComp = NameComp + "@" + NameModel;
NameBodiKromk = NameBodiKromk + "@" + NameComp;
boolstatus = swModel.Extension.SelectByID2(NameBodiKromk, "BODYFEATURE", 0, 0, 0, false, 0, null, 0);
swModel.EditDelete();
After removing the body, a sketch remains. Tell me how to remove it?
Delete "Базовая кромка20"
Remains "Эскиз102"
How to delete this sketch?
Use swModel.Extension.DeleteSelection2(swDeleteSelectionOptions_e.swDelete_Absorbed
+ swDeleteSelectionOptions_e.swDelete_Children);
rather than swModel.EditDelete();