Example #1
0
 public AbstractCylinderBody(StepBuilder builder)
 {
     this.Builder = builder;
     this.Builder.CylFeater.Sort();
     this.GetDirection();
     this.GetStartAndEndPt();
 }
        public static AbstractCylinderBody Create(StepBuilder builder)
        {
            int count = builder.CylFeater.Count;
            AbstractCylinderBody abs = null;

            switch (count)
            {
            case 1:
                abs = new CylinderBody(builder);
                break;

            case 2:
                abs = new CylinderTwoStepBody(builder);
                break;

            default:
                break;
            }
            return(abs);
        }
 /// <summary>
 /// 判断是否事圆柱体
 /// </summary>
 /// <returns></returns>
 public bool IsCylinderBody(out StepBuilder step)
 {
     GetStepBuilder();
     if (this.steps.Count == 1)
     {
         double     rid                 = this.steps[0].CylFeater[0].Cylinder.Radius;
         Matrix4    mat                 = this.steps[0].CylFeater[0].Cylinder.Matr;
         Matrix4    inv                 = mat.GetInversMatrix();
         Point3d    centerPt            = new Point3d();
         Point3d    disPt               = new Point3d();
         NXObject[] obj                 = { this.body };
         CartesianCoordinateSystem csys = BoundingBoxUtils.CreateCoordinateSystem(mat, inv);
         BoundingBoxUtils.GetBoundingBoxInLocal(obj, csys, mat, ref centerPt, ref disPt);
         if (UMathUtils.IsEqual(disPt.X, rid) && UMathUtils.IsEqual(disPt.Y, rid))
         {
             step = this.steps[0];
             return(true);
         }
     }
     step = null;
     return(false);
 }
 public CylinderTwoStepBody(StepBuilder builder) : base(builder)
 {
 }