/// <summary> /// 设置边界 /// </summary> /// <param name="conditions"></param> public void SetBoundary(params BoundaryModel[] conditions) { NXOpen.CAM.FaceMillingBuilder builder1; builder1 = workPart.CAMSetup.CAMOperationCollection.CreateFaceMillingBuilder(this.Oper); builder1.FeedsBuilder.SetMachiningData(); Boundary boundary = builder1.BlankBoundary; BoundarySetList list = boundary.BoundaryList; List <BoundaryMillingSet> boundarySet = new List <BoundaryMillingSet>(); foreach (BoundaryModel bc in conditions) { boundarySet.Add(OperationUtils.CreateBoundaryMillingSet(bc.ToolSide, bc.Types, bc.BouudaryPt, boundary, bc.Edges.ToArray())); } list.Append(boundarySet.ToArray()); try { NXOpen.NXObject nXObject1; nXObject1 = builder1.Commit(); } catch (NXException ex) { LogMgr.WriteLog("PlanarMillingModel.SetBoundary 错误" + ex.Message); } finally { builder1.Destroy(); } }
public void SetBoundary(params Face[] conditions) { NXOpen.CAM.FaceMillingBuilder builder1; builder1 = workPart.CAMSetup.CAMOperationCollection.CreateFaceMillingBuilder(this.Oper); builder1.FeedsBuilder.SetMachiningData(); Boundary boundary = builder1.BlankBoundary; BoundarySetList list = boundary.BoundaryList; List <BoundarySet> boundarySet = new List <BoundarySet>(); foreach (Face face in conditions) { BoundarySet[] set = boundary.AppendFaceBoundary(face, true, false, false, NXOpen.CAM.BoundarySet.ToolSideTypes.InsideOrLeft); boundarySet.AddRange(set); } list.Append(boundarySet.ToArray()); try { NXOpen.NXObject nXObject1; nXObject1 = builder1.Commit(); } catch (NXException ex) { LogMgr.WriteLog("PlanarMillingModel.SetBoundary 错误" + ex.Message); } finally { builder1.Destroy(); } }
/// <summary> /// 设置边界 /// </summary> /// <param name="floorPt"></param> /// <param name="conditions"></param> public void SetBoundary(Point3d floorPt, params BoundaryModel[] conditions) { NXOpen.CAM.PlanarMillingBuilder planarMillingBuilder1; planarMillingBuilder1 = workPart.CAMSetup.CAMOperationCollection.CreatePlanarMillingBuilder(this.Oper); planarMillingBuilder1.FeedsBuilder.SetMachiningData(); BoundaryPlanarMill boundary = planarMillingBuilder1.PartBoundary; BoundarySetList list = boundary.BoundaryList; List <BoundarySetPlanarMill> boundarySet = new List <BoundarySetPlanarMill>(); foreach (BoundaryModel bc in conditions) { boundarySet.Add(OperationUtils.CreateBoundaryPlanarMill(bc.ToolSide, bc.Types, bc.BouudaryPt, boundary, bc.Edges.ToArray())); } list.Append(boundarySet.ToArray()); Vector3d normal = new NXOpen.Vector3d(0.0, 0.0, 1.0); Plane plane = workPart.Planes.CreatePlane(floorPt, normal, NXOpen.SmartObject.UpdateOption.AfterModeling); planarMillingBuilder1.Geometry.FloorPlane = plane; try { NXOpen.NXObject nXObject1; nXObject1 = planarMillingBuilder1.Commit(); } catch (NXException ex) { LogMgr.WriteLog("PlanarMillingModel.SetBoundary 错误" + ex.Message); } finally { planarMillingBuilder1.Destroy(); } }