/// <summary> /// Cuts through all childs of the node with the TopoDS_Shape passed as parameter. /// It returns a compund made from the affected shapes /// </summary> /// <param name = "root"></param> /// <param name = "cutPrismShape"></param> /// <param name = "affectedNodes"></param> /// <param name = "shapeList"></param> private static TopoDSShape CutThroughAll(Node root, TopoDSShape cutPrismShape, ICollection <SceneSelectedEntity> affectedNodes, IEnumerable <int> shapeList) { var compoundShape = new TopoDSCompound(); var shapeBuilder = new BRepBuilder(); shapeBuilder.MakeCompound(compoundShape); var resShape = (TopoDSShape)compoundShape; foreach (var childNodeIndex in shapeList) { var childNode = new NodeBuilder(root[childNodeIndex]); var topoShape = childNode.Shape; if (topoShape == null) { continue; } BRepAlgoAPICut cut; var filler = new BOPToolsDSFiller(); try { filler.SetShapes(topoShape, cutPrismShape); if (!filler.IsDone) { continue; } filler.Perform(); cut = new BRepAlgoAPICut(topoShape, cutPrismShape, filler, true); if (!cut.IsDone) { continue; } // Check if the shape was altered by the Cut //if ((cut.HasGenerated == false) && (cut.HasModified == false)) // continue; } catch (Exception) { continue; } TopoDSShape shapeCut = null; try { shapeCut = cut.Shape; } catch (Exception) { Log.Info("Exception on create cut shape"); } if ((shapeCut == null) || (shapeCut.IsNull)) { continue; } // If Cut succeeded hide the original shape NodeUtils.Hide(childNode.Node); // Show the new shape as a new Node shapeBuilder.Add(resShape, shapeCut); // Add the affceted node into the affectedNodes list affectedNodes.Add(new SceneSelectedEntity(childNode.Node)); } return(resShape); }
public BRepAlgoAPIFuse(TopoDSShape S1, TopoDSShape S2, BOPToolsDSFiller aDSF) : base(BRepAlgoAPI_Fuse_Ctor1641F7D4(S1.Instance, S2.Instance, aDSF.Instance)) { }
public BRepAlgoAPICut(TopoDSShape S1, TopoDSShape S2, BOPToolsDSFiller aDSF, bool bFWD) : base(BRepAlgoAPI_Cut_Ctor421BE7CD(S1.Instance, S2.Instance, aDSF.Instance, bFWD)) { }