Exemplo n.º 1
0
        /// <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();
            }
        }