Esempio n. 1
0
        public static bool SpecifyWindow(out Point3d?pt1, out Point3d?pt2, Editor adocEd)
        {
            pt1 = null;
            pt2 = null;
            Point3d _pt1 = new Point3d();
            Point3d _pt2 = new Point3d();

            PromptPointOptions ppo = new PromptPointOptions("\n\tУкажите первый угол рамки: ");
            PromptPointResult  ppr = adocEd.GetPoint(ppo);

            if (ppr.Status != PromptStatus.OK)
            {
                return(false);
            }
            PromptCornerOptions pco = new PromptCornerOptions("\n\tУкажите второй угол рамки: ", ppr.Value);
            PromptPointResult   pcr = adocEd.GetCorner(pco);

            if (pcr.Status != PromptStatus.OK)
            {
                return(false);
            }
            _pt1 = ppr.Value;
            _pt2 = pcr.Value;
            if (_pt1.X == _pt2.X || _pt1.Y == _pt2.Y)
            {
                adocEd.WriteMessage("\nНеправильно указаны точки");
                return(false);
            }

            pt1 = _pt1;
            pt2 = _pt2;
            return(true);
        }
Esempio n. 2
0
        public static Point3d?getPoint(string msg)
        {
            Point3d? r     = null;
            Document acDoc = Application.DocumentManager.MdiActiveDocument;

            Editor             ed  = acDoc.Editor;
            PromptPointOptions ppo = new PromptPointOptions(msg);

            ppo.AllowNone = true;
            PromptPointResult ppr = null;

            while (true)
            {
                ppr = ed.GetPoint(ppo);
                if (ppr.Status == PromptStatus.Cancel)
                {
                    //ed.WriteMessage("\n命令被取消");
                    return(null);
                }
                else if (ppr.Status == PromptStatus.OK)
                {
                    break;
                }
                else if (ppr.Status == PromptStatus.None)
                {
                    return(null);
                }
            }
            r = ppr.Value;
            return(r);
        }
Esempio n. 3
0
    protected override void SolveInstance(IGH_DataAccess DA)
    {
        string    file = null, mask = null;
        GH_Target target       = null;
        bool      reverse      = false;
        double    cuttingSpeed = 0;
        Point3d?  point        = null;

        if (!DA.GetData(0, ref file))
        {
            return;
        }
        if (!DA.GetData(1, ref target))
        {
            return;
        }
        if (!DA.GetData(2, ref mask))
        {
            return;
        }
        if (!DA.GetData(3, ref reverse))
        {
            return;
        }
        DA.GetData(4, ref cuttingSpeed);
        DA.GetData(5, ref point);

        var converter = new Toolpaths.CSVConverter(file, target.Value as CartesianTarget, mask, reverse, cuttingSpeed, point);

        DA.SetDataList(0, converter.Targets);
        DA.SetDataList(1, converter.ToolPath);
    }
Esempio n. 4
0
        public bool ChopLine(Line line, bool extend)
        {
            var forward = line.StartPoint.GetVectorTo(line.EndPoint);

            using (var intersection = IntersectWith(line, extend ? Intersect.ExtendArgument : Intersect.OnBothOperands))
            {
                Point3d?first          = null;
                var     shortestLength = double.PositiveInfinity;
                for (var i = 0; i < intersection.Count; ++i)
                {
                    var point = intersection[i];
                    if (line.StartPoint.GetVectorTo(point).DotProduct(forward) < 0)
                    {
                        continue;
                    }
                    var length = line.StartPoint.GetVectorTo(point).LengthSqrd;
                    if (length < shortestLength)
                    {
                        shortestLength = length;
                        first          = point;
                    }
                }
                if (first.HasValue)
                {
                    line.EndPoint = first.Value;
                }
                return(first.HasValue);
            }
        }
Esempio n. 5
0
        public static Point3d?GetCentroid(IList <Point3d> points)
        {
            Point3d?result      = null;
            var     coordinates = new List <Coordinate>();

            foreach (var point in points)
            {
                var coordinate = new Coordinate()
                {
                    X = point.X,
                    Y = point.Y,
                    Z = 0
                };
                coordinates.Add(coordinate);
            }
            ICoordinateSequence coordinateSequence = CoordinateArraySequenceFactory.Instance.Create(coordinates.ToArray());

            var geometryF = new DwgWriter();
            var polygon   = geometryF.GeometryFactory.CreatePolygon(coordinateSequence.ToCoordinateArray());
            var coords    = Centroid.GetCentroid(polygon);

            if (coords != null)
            {
                result = new Point3d(coords.X, coords.Y, coords.Z);
            }
            return(result);
        }
Esempio n. 6
0
        public static Point3d Snap(Point3d?point)
        {
            var q = new CoSnapJig();

            q.Run();
            return(AcadProperties.ComputedCursor ?? point ?? AcadProperties.Default3d);
        }
Esempio n. 7
0
        public static Line GetOrthoNormalLine(this Line line, Point3d point, Plane plane = null, bool nullForOutOfRange = true)
        {
            if (plane == null)
            {
                plane = new Plane(line.StartPoint, Matrix3d.Identity.CoordinateSystem3d.Zaxis.Negate());
            }

            line  = (Line)line.GetOrthoProjectedCurve(plane);
            point = point.OrthoProject(line.GetPlane());

            Point3d?normalPoint = line.GetOrthoNormalPoint(point, plane, nullForOutOfRange);

            if (!normalPoint.HasValue)
            {
                return(null);
            }

            Point3d destPoint = point;

            if (!nullForOutOfRange)
            {
                if (normalPoint.Value.IsEqualTo(line.StartPoint, Tolerance.Global) ||
                    normalPoint.Value.IsEqualTo(line.EndPoint, Tolerance.Global))
                {
                    Vector3d lineVector = line.EndPoint - line.StartPoint;
                    Vector3d vector     = point - normalPoint.Value;
                    double   sin        = lineVector.GetSin2d(vector);
                    destPoint = normalPoint.Value.Add(lineVector.GetPerpendicularVector().MultiplyBy(sin * vector.Length));
                }
            }

            Line perpendicular = new Line(normalPoint.Value, destPoint);

            return(perpendicular);
        }
Esempio n. 8
0
        public static Line GetOrthoNormalLine(this Arc arc, Point3d point, bool nullForOutOfRange = true)
        {
            point = point.OrthoProject(arc.GetPlane());

            Point3d destPoint   = point;
            Point3d?normalPoint = arc.GetOrthoNormalPoint(point, nullForOutOfRange);

            if (!normalPoint.HasValue)
            {
                return(null);
            }

            if (!nullForOutOfRange)
            {
                if (normalPoint.Value.IsEqualTo(arc.StartPoint, Tolerance.Global) ||
                    normalPoint.Value.IsEqualTo(arc.EndPoint, Tolerance.Global))
                {
                    Vector3d vector = point - normalPoint.Value;
                    Vector3d radius = normalPoint.Value - arc.Center;
                    double   sin    = radius.GetCos2d(vector);
                    destPoint = normalPoint.Value.Add(radius.Normalize().MultiplyBy(sin * vector.Length));
                }
            }

            return(new Line(normalPoint.Value, destPoint));
        }
Esempio n. 9
0
 public static Func <ObjectId> AddBlock(string entityID, Point3d?position = null, double rotation = 0, bool align = false)
 {
     return(() =>
     {
         var def = EntityManager.Entities[entityID];
         var scale = EntityManager.GetGlobalScaleFactor();
         if (position == null)
         {
             position = Interaction.GetPoint("\n指定插入点");
             if (position.Value.IsNull())
             {
                 return ObjectId.Null;
             }
         }
         if (align)
         {
             var end = Interaction.GetLineEndPoint("\n指定旋转方向,或直接退出", position.Value);
             if (!end.IsNull())
             {
                 rotation = Math.Atan2(end.Y - position.Value.Y, end.X - position.Value.X);
             }
         }
         return Draw.Insert(def.BlockName, position.Value, rotation, scale);
     });
 }
        /// <summary>
        /// Основной метод выводв данных
        /// </summary>
        /// <param name="axisVector"></param>
        /// <param name="ucs"></param>
        /// <param name="onlyOnce"></param>
        /// <returns></returns>
        public static PromptStatus DrawWallArrows(Vector3d axisVector, Matrix3d ucs, bool onlyOnce = false)
        {
            object mirrorTextValue = SetMirrorTextValue(1);

            try
            {
                Point3d?insertPoint = Point3d.Origin;
                while ((insertPoint = GetInsertPoint(axisVector, ucs)).HasValue)
                {
                    PromptStatus res = PromptStatus.Cancel;

                    WallDeviationArrows2 mainBlock = new WallDeviationArrows2(axisVector, ucs);
                    mainBlock._insertPointUcs = insertPoint.Value;
                    if ((res = mainBlock.JigDraw()) != PromptStatus.OK)
                    {
                        return(res);
                    }
                    if (onlyOnce)
                    {
                        break;
                    }
                }

                return(PromptStatus.OK);
            }
            catch (Exception ex)
            {
                Tools.GetAcadEditor().WriteMessage(ex.Message);
                return(PromptStatus.Error);
            }
            finally
            {
                SetMirrorTextValue(mirrorTextValue);
            }
        }
Esempio n. 11
0
 public bool Equals(Point3d?other)
 {
     return(other is object &&
            X == other.X &&
            Y == other.Y &&
            Z == other.Z);
 }
Esempio n. 12
0
        public void ExecuteCommand()
        {
            barDiameter = TryGetBarDiameter("\nŚrednica pręta [mm] : ");
            if (!barDiameter.HasValue)
                return;

            spanStep = TryGetSpanStep("\nRozstaw [mm] : ");
            if (!spanStep.HasValue)
                return;

            barPoint1 = TryGetPoint("\nPokaż pręt 1 : ");
            if (!barPoint1.HasValue)
                return;

            barPoint2 = TryGetPoint("\nPokaż pręt 2 : ", barPoint1);
            if (!barPoint2.HasValue)
                return;

            firstBarLine = GetRoundBarLine(roundValue);
            if (TryDisplayBarLadder())
            {
                string blockName = CreateBlockRecord();
                Handle handle = InsertBlock(blockName);
                SetXData(handle);
            }
            else
            {
                return;
            }
        }
Esempio n. 13
0
        private static bool ChopLine(Line line, Entity entity, bool extend)
        {
            var forward = line.StartPoint.GetVectorTo(line.EndPoint);

            using (var intersection = new Point3dCollection())
            {
                line.IntersectWith(entity, extend ? Intersect.ExtendThis : Intersect.OnBothOperands, intersection, IntPtr.Zero, IntPtr.Zero);
                Point3d?first          = null;
                var     shortestLength = double.PositiveInfinity;
                for (var i = 0; i < intersection.Count; ++i)
                {
                    var point = intersection[i];
                    if (line.StartPoint.GetVectorTo(point).DotProduct(forward) < 0)
                    {
                        continue;
                    }
                    var length = line.StartPoint.GetVectorTo(point).LengthSqrd;
                    if (length < shortestLength)
                    {
                        shortestLength = length;
                        first          = point;
                    }
                }
                if (first.HasValue)
                {
                    line.EndPoint = first.Value;
                }
                return(first.HasValue);
            }
        }
Esempio n. 14
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            string    file   = null;
            GH_Target target = null;
            Point3d?  point  = null;

            if (!DA.GetData(0, ref file))
            {
                return;
            }
            if (!DA.GetData(1, ref target))
            {
                return;
            }
            DA.GetData(2, ref point);

            var alignment = Vector3d.XAxis;

            if (point.HasValue)
            {
                alignment = (Vector3d)point.Value;
            }

            var toolpath = new Model.Toolpaths.Milling.GCodeToolpath(file, target.Value as CartesianTarget, alignment);

            var(tool, mcs, rapidStarts, ignored) = toolpath.Toolpath;

            DA.SetData(0, toolpath);
            DA.SetData(1, tool);
            DA.SetData(2, mcs.Plane);
            DA.SetDataList(3, rapidStarts);
            DA.SetDataList(4, ignored);
        }
Esempio n. 15
0
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            GH_Toolpath toolpath = null;
            Mesh        surface = null, guide = null;
            Point3d?    point = null;

            if (!DA.GetData(0, ref toolpath))
            {
                return;
            }
            DA.GetData(1, ref surface);
            if (!DA.GetData(2, ref guide))
            {
                return;
            }
            DA.GetData(3, ref point);

            var alignment = Vector3d.XAxis;

            if (point.HasValue)
            {
                alignment = (Vector3d)point.Value;
            }

            var orientedToolpath = new Model.Toolpaths.OrientToolpath(toolpath.Value, guide, alignment, surface).Toolpath;

            DA.SetData(0, orientedToolpath);
        }
Esempio n. 16
0
 public static Point3d SnapIfEnabled(Point3d?point)
 {
     if (AcadProperties.IsOSnapEnabled == false)
     {
         return(point ?? AcadProperties.Default3d);
     }
     return(Snap(point));
 }
 public SectionAddVertexGrip(Section section, Point3d?leftPoint, Point3d?rightPoint)
 {
     Section                = section;
     GripLeftPoint          = leftPoint;
     GripRightPoint         = rightPoint;
     GripType               = GripType.Plus;
     RubberBandLineDisabled = true;
 }
Esempio n. 18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinearEntityAddVertexGrip"/> class.
 /// </summary>
 /// <param name="smartEntity">Instance of <see cref="Base.SmartEntity"/> that implement <see cref="ILinearEntity"/></param>
 /// <param name="leftPoint">Точка слева</param>
 /// <param name="rightPoint">Точка справа</param>
 public LinearEntityAddVertexGrip(SmartEntity smartEntity, Point3d?leftPoint, Point3d?rightPoint)
 {
     SmartEntity            = smartEntity;
     GripLeftPoint          = leftPoint;
     GripRightPoint         = rightPoint;
     GripType               = GripType.Plus;
     RubberBandLineDisabled = true;
 }
Esempio n. 19
0
 public Tool(Plane tcp, string name = null, double weight = 0, Point3d?centroid = null, Mesh mesh = null)
 {
     this.Name     = name;
     this.Tcp      = tcp;
     this.Weight   = weight;
     this.Centroid = (centroid == null) ? tcp.Origin : (Point3d)centroid;
     this.Mesh     = mesh ?? new Mesh();
 }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinearEntityAddVertexGrip"/> class.
 /// </summary>
 /// <param name="intellectualEntity">Instance of <see cref="Base.IntellectualEntity"/> that implement <see cref="ILinearEntity"/></param>
 /// <param name="leftPoint">Точка слева</param>
 /// <param name="rightPoint">Точка справа</param>
 public LinearEntityAddVertexGrip(IntellectualEntity intellectualEntity, Point3d?leftPoint, Point3d?rightPoint)
 {
     IntellectualEntity     = intellectualEntity;
     GripLeftPoint          = leftPoint;
     GripRightPoint         = rightPoint;
     GripType               = GripType.Plus;
     RubberBandLineDisabled = true;
 }
Esempio n. 21
0
        public static Point3d?GetOrthoNormalPointEx(this Arc arc, Point3d point, bool nullForOutOfRange = true)
        {
            point = point.OrthoProject(arc.GetPlane());

            Point3d? normalPoint = null;
            Point3d  center      = arc.Center;
            Vector3d startVector = arc.StartPoint - center;
            Vector3d endVector   = arc.EndPoint - center;
            Vector3d vector      = point - center;

            double startAngle = Matrix3d.Identity.CoordinateSystem3d.Xaxis.GetAngle2d(startVector);
            double endAngle   = Matrix3d.Identity.CoordinateSystem3d.Xaxis.GetAngle2d(endVector);
            double angle      = Matrix3d.Identity.CoordinateSystem3d.Xaxis.GetAngle2d(vector);


            if (angle < Math.Max(startAngle, endAngle) &&
                angle > Math.Min(startAngle, endAngle))
            {
                double pointAngle = Math.Abs(startAngle - angle);
                double dist       = pointAngle * (arc.StartPoint - center).Length;
                normalPoint = arc.GetPointAtDist(dist);
                return(normalPoint);
            }
            else
            {
                if (nullForOutOfRange)
                {
                    return(null);
                }
                else
                {
                    if (endAngle < startAngle)
                    {
                        if (angle > startAngle)
                        {
                            return(arc.StartPoint);
                        }
                        if (angle < endAngle)
                        {
                            return(arc.EndPoint);
                        }
                    }
                    else if (endAngle > startAngle)
                    {
                        if (angle < startAngle)
                        {
                            return(arc.StartPoint);
                        }
                        if (angle > endAngle)
                        {
                            return(arc.EndPoint);
                        }
                    }
                }
            }

            return(null);
        }
Esempio n. 22
0
 /// <summary>
 /// Set Instruction Input Variables
 /// </summary>
 /// <param name="M"></param>
 /// <param name="K"></param>
 /// <param name="C_bool">Coloraize? </param>
 /// <param name="A_bool">Calculate ANgle of Approach?</param>
 /// <param name="Pos_pt">Scan Position as Point3d</param>
 public Instr_MeshCompare(Mesh M, string K, Boolean C_bool, Boolean A_bool, Point3d?Pos_pt, string angleKey)
 {
     insV_Mesh          = M;
     insV_Key           = K;
     insV_Colorize      = C_bool;
     insV_ApproachAngle = A_bool;
     insV_PositionPt    = Pos_pt;
     insV_AngleKey      = angleKey;
 }
Esempio n. 23
0
        public void Update()
        {
            if (!expected.HasValue)
            {
                throw new Exception("None expected value");
            }

            this.position = expected.Value;
            this.expected = null;
        }
Esempio n. 24
0
        private Point3d?getInnerBoPoint()
        {
            Point3d?innerP = Utility2d.getPoint("\n请指定内边界内一点:");

            if (innerP == null)
            {
                return(null);
            }
            return(innerP);
        }
Esempio n. 25
0
        public void GetRoadStation(DocumentModifier docMdf, SelectionSet impliedSelection)
        {
            _docMdf = docMdf;
            Curve baseCurve = null;

            if (impliedSelection != null)
            {
                foreach (var id in impliedSelection.GetObjectIds())
                {
                    baseCurve = docMdf.acTransaction.GetObject(id, OpenMode.ForRead) as Curve;
                    if (baseCurve != null)
                    {
                        break;
                    }
                }
            }
            if (baseCurve == null)
            {
                baseCurve = PickOneCurve(docMdf);
            }
            if (baseCurve == null)
            {
                return;
            }

            // 在界面中选择一个点,并生成对应位置处曲线的垂线
            bool    setStation = false;
            Point3d?pt         = PickPoint(docMdf.acEditor, baseCurve, ref setStation);


            // 以只读方式打开块表   Open the Block table for read
            var acBlkTbl = docMdf.acTransaction.GetObject(docMdf.acDataBase.BlockTableId, OpenMode.ForRead) as BlockTable;

            // 以写方式打开模型空间块表记录   Open the Block table record Model space for write
            var acBlkTblRec =
                docMdf.acTransaction.GetObject(baseCurve.BlockId, OpenMode.ForWrite) as
                BlockTableRecord;

            while (pt != null)
            {
                // MessageBox.Show(setStation.ToString());

                if (setStation) // 将指定的里程值绘制到曲线上
                {
                    DBPoint dbPt = DrawStation(docMdf, acBlkTblRec, pt.Value);
                }
                else // 读取指定点的里程
                {
                    WriteStation(docMdf.acEditor, baseCurve, pt.Value);
                }
                //
                pt = PickPoint(docMdf.acEditor, baseCurve, ref setStation);
            }
        }
Esempio n. 26
0
        //获取起始矢量
        public Vector2d?getStartVector(Point3d?startP)
        {
            Vector2d?ret = null;

            /*double leftMost = 0; int i = 0;
             * Point3d? leftMostPoint = null;
             * KeyValuePair<Point3d, List<Line>> kp0 = new KeyValuePair<Point3d,List<Line>>();
             * foreach(KeyValuePair<Point3d,List<Line>> kp in this){
             *  double x=kp.Key.X;
             *  if (i++ == 0||x < leftMost)
             *  {
             *      leftMost = x;
             *      leftMostPoint = kp.Key;
             *      kp0=kp;
             *
             *  }
             * }*/
            Point3d?leftMostPoint = startP;

            if (leftMostPoint != null)
            {
                //List<Line> ll = kp0.Value as List<Line>;
                List <LineSegment3d> ll = this[leftMostPoint.Value];
                Vector2d?            v  = null;
                //Point3d? p=null;

                double minIncludedAngle = Math.PI + 1;
                foreach (LineSegment3d l in ll)
                {
                    Point3d endPoint = l.EndPoint;
                    if (leftMostPoint == l.EndPoint)
                    {
                        endPoint = l.StartPoint;
                    }
                    //ng:找到和(0,-1)的夹角最小的矢量,v2一定位于1 4象限
                    Vector2d v2            = new Vector2d(endPoint.X - leftMostPoint.Value.X, endPoint.Y - leftMostPoint.Value.Y);
                    double   includedAngle = v2.Angle - 3 * Math.PI / 2;
                    if (includedAngle < 0)
                    {
                        includedAngle += 2 * Math.PI;
                    }
                    if (includedAngle < minIncludedAngle)
                    {
                        minIncludedAngle = includedAngle;
                        v = v2;
                    }
                }
                if (v != null)
                {
                    ret = v.Value;
                }
            }
            return(ret);
        }
Esempio n. 27
0
        //获取最左端的起点和起始矢量
        public KeyValuePair <Point3d, Vector2d>?getLeftMost()
        {
            Point3d? startP = getStartPoint();
            Vector2d?startV = getStartVector(startP);

            if (startV == null)
            {
                return(null);
            }
            return(new KeyValuePair <Point3d, Vector2d>(startP.Value, startV.Value));
        }
Esempio n. 28
0
        public static Point3d?GetCentroid(ObjectId polylineId)
        {
            Point3d?result = null;

            using (var transaction = polylineId.Database.TransactionManager.StartTransaction())
            {
                var entity = (Entity)transaction.GetObject(polylineId, OpenMode.ForRead);
                result = GetCentroid(entity, transaction);
                transaction.Commit();
            }
            return(result);
        }
Esempio n. 29
0
 public bool Equals(Point3d?other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z));
 }
Esempio n. 30
0
        public static double?GetPointParameter(Curve curve, Point3d?point)
        {
            if (point == null)
            {
                return(null);
            }

            Point3d closestPoint = curve.GetClosestPointTo(point.Value, true);
            double  param        = curve.GetParameterAtPoint(closestPoint);

            return(param);
        }
Esempio n. 31
0
        public static List <Point3d> getBo(DBObjectCollection dbCol)
        {
            if (dbCol == null)
            {
                return(null);
            }
            List <Point3d> plist = new List <Point3d>();

            try
            {
                List <Autodesk.AutoCAD.DatabaseServices.Line> ll = new List <Autodesk.AutoCAD.DatabaseServices.Line>();
                PLDictionary plDic = new PLDictionary();
                for (int i = 0; i < dbCol.Count; i++)
                {
                    ll.Add(dbCol[i] as Autodesk.AutoCAD.DatabaseServices.Line);
                }
                ll = ll.Distinct(new My.CompareLine()).ToList();
                plDic.Add(ll);
                KeyValuePair <Point3d, Vector2d>?kvp = plDic.getLeftMost();
                if (kvp == null)
                {
                    return(null);
                }
                Point3d  startP = kvp.Value.Key;
                Point3d  curP   = kvp.Value.Key;
                Vector2d curV   = kvp.Value.Value;

                plist.Add(curP);
                int maxLoopCount = plDic.Count;
                while (maxLoopCount-- > 0)
                {
                    Point3d?p = plDic.getMaxAnglePoint(curP, curV);
                    //ed.DrawVectors()
                    if (p == null)
                    {
                        break;
                    }
                    if (p.Value == startP)
                    {
                        break;
                    }
                    curV = new Vector2d(curP.X - p.Value.X, curP.Y - p.Value.Y);
                    curP = p.Value;

                    plist.Add(p.Value);
                }
            }
            catch (System.Exception ex)
            {
            }
            return(plist);
        }
        public bool StartDraw(out bool status)
        {
            status = false;
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            Database db = HostApplicationServices.WorkingDatabase;
            if (this.startPoint == null)
            {

                PromptPointOptions opt = new PromptPointOptions("\n 选择管道的初始点");
                PromptPointResult res = ed.GetPoint(opt);
                if(res.Status == PromptStatus.Cancel)
                {
                    status = true;
                }
                if (res.Status != PromptStatus.OK)
                {
                    return false;
                }
                this.startPoint = res.Value;
            }
            mline = new Mline();
            using(Transaction tr = db.TransactionManager.StartTransaction())
            {
                DBDictionary mlineStyleDic = (DBDictionary)tr.GetObject(db.MLStyleDictionaryId, OpenMode.ForRead);
                mline.Style = mlineStyleDic.GetAt("MLINEJIG");
            }
            mline.Normal = Vector3d.ZAxis;
            mline.Scale = PipeLine.GetScale();
            mline.AppendSegment((Point3d)this.startPoint);
            mline.AppendSegment((Point3d)this.startPoint);
            PromptResult res2 = ed.Drag(this);
            if (res2.Status == PromptStatus.OK)
            {
                return true;
            }
            else if (res2.Status == PromptStatus.Cancel || res2.Status == PromptStatus.None)
            {
                if(res2.Status == PromptStatus.Cancel)
                {
                    status = true;
                }
                return false;
            }
            return true;
        }
Esempio n. 33
0
        public void ExecuteCommand()
        {
            barNumber = TryGetBarNumber("\nNumer pręta : ");
            if (!barNumber.HasValue)
                return;

            barDiameter = TryGetBaDiameter("\nŚrednica pręta [mm] : ");
            if (!barDiameter.HasValue)
                return;

            widthPoint1 = TryGetPoint("\nWskaż pierwszą, dłuższą krawędź belki : ");
            if (!widthPoint1.HasValue)
                return;

            widthPoint2 = TryGetPoint("\nWskaż drugą, dłuższą krawędź belki : ");
            if (!widthPoint2.HasValue)
                return;

            lengthPoint1 = TryGetPoint("\nWskaż pierwszą, krótszą krawędź belki : ");
            if (!lengthPoint1.HasValue)
                return;

            lengthPoint2 = TryGetPoint("\nWskaż drugą, krótszą krawędź belki : ");
            if (!lengthPoint2.HasValue)
                return;

            densitySpan = TryGetDensitySpan("\nZagęszczenie na : ");
            if (!densitySpan.HasValue)
                return;

            additionalStirrups = TryGetAdditionalStirrups("\nDodatkowe strzemiona przy podporach [TAK/NIE] : ");
            if (!additionalStirrups.HasValue)
                return;

            IEnumerable<Handle> allDescriptionParts = CreateAllStirrups();
            adaptator.Adaptate(allDescriptionParts);
            acMark.RemoveMarks();
        }
Esempio n. 34
0
        private bool TryDisplayBarLadder()
        {
            Handle firstBarLineHandle = DrawBarLine(firstBarLine);
            IEnumerable<Handle> handles = null;
            PromptPointOptions options = new PromptPointOptions("\nWskaż rozrzut : ");
            options.Keywords.Add("K");
            options.Keywords.Default = "K";
            PromptPointResult result = editor.GetPoint(options);
            RemoveFirstBarLine(firstBarLineHandle);

            while (result.Status != PromptStatus.Keyword && result.Status != PromptStatus.Cancel && result.Status != PromptStatus.Error)
            {
                if (result.Status == PromptStatus.OK)
                {
                    spanPoint = result.Value;
                    RemoveBarLeader(handles);
                    handles = CreateOffsetLines();
                    result = editor.GetPoint(options);
                }
            }
            RemoveBarLeader(handles);

            if (result.Status == PromptStatus.Keyword && spanPoint.HasValue)
                return true;
            else
                return false;
        }
 public PipeJig(Point3d? _startPoint)
 {
     this.startPoint = _startPoint;
 }