Exemplo n.º 1
0
        public override void OnDraw(GeometryBuilder dc)
        {
            dc.Clear();
            dc.Color = McDbEntity.ByObject;//color will be taken from object properties and object will be redrawn after color change
            //dc.DrawPolyline(new Point3d[] { _pnt, _pnt1, _pnt2, _pnt3, _pnt });
            //dc.DrawPolyline(poly.GetTrimmedOffset(Height)[0]);

            BendingShape shape1 = new BendingShape(_pnt, _pnt1, Height, Thickness, Gap);
            BendingShape shape2 = new BendingShape(_pnt1, _pnt2, Height, Thickness);
            BendingShape shape3 = new BendingShape(_pnt2, _pnt3, Height, Thickness, Gap);
            BendingShape shape4 = new BendingShape(_pnt3, _pnt, Height, Thickness);

            Polyline3d poly = new Polyline3d(new List <Point3d> (shape1.Shape));

            poly.AddPoliline(new Polyline3d(new List <Point3d>(shape2.Shape)));
            poly.AddPoliline(new Polyline3d(new List <Point3d>(shape3.Shape)));
            poly.AddPoliline(new Polyline3d(new List <Point3d>(shape4.Shape)));
            poly.SetClosed(true);

            //CircArc3d test = new CircArc3d(_pnt1, new Vector3d(), new Vector3d(), 0.25, ((180 + _pnt.AngleTo(_pnt1)) * Math.PI / 180), (_pnt.AngleTo(_pnt1) * Math.PI / 180));
            //dc.DrawArc(test);

            //dc.DrawArc(_pnt1, 0.25, ((180+_pnt1.AngleTo(_pnt2)) * Math.PI/180), (_pnt1.AngleTo(_pnt2) * Math.PI/180));

            Polyline3d.VertexDataOfPolyline polyVertecies = poly.Vertices;
            for (int i = 0; i < polyVertecies.Count; i++)
            {
                polyVertecies.MakeFilletAtVertex(i + 1, Radius);
            }
            dc.DrawPolyline(poly);
        }
Exemplo n.º 2
0
        public override hresult PlaceObject(PlaceFlags lInsertType)
        {
            InputJig    jig = new InputJig();
            InputResult res = jig.GetPoint("Select first point:");

            if (res.Result != InputResult.ResultCode.Normal)
            {
                return(hresult.e_Fail);
            }
            poly = new Polyline3d();
            poly.Vertices.AddVertex(res.Point);
            poly.Vertices.AddVertex(res.Point);
            _textPoint = new Point3d(res.Point.X, res.Point.Y - 5 - Thickness, 0);
            Polyline3d.VertexDataOfPolyline polyVertecies = poly.Vertices;

            //_points.Add(res.Point);
            //_points.Add(res.Point); //Bug double?
            DbEntity.AddToCurrentDocument();
            //Exclude this from osnap to avoid osnap to itself
            jig.ExcludeObject(ID);
            //Monitor mouse move
            jig.MouseMove = (s, a) => {
                TryModify();
                //_points[_points.Count-1] = a.Point;
                //polyVertecies[polyVertecies.Count - 1].Point = a.Point;
                polyVertecies.RemoveVertexAt(uint.Parse((polyVertecies.Count - 1).ToString()));
                polyVertecies.AddVertex(a.Point);

                DbEntity.Update();
            };
            while (res.Result == InputResult.ResultCode.Normal)
            {
                res = jig.GetPoint("Select next point(" + polyVertecies.Count + "):", res.Point);
                //_points.Add(res.Point);
                poly.Vertices.AddVertex(res.Point);
            }
            DbEntity.Erase();

            polyVertecies.RemoveVertexAt(uint.Parse((polyVertecies.Count - 1).ToString()));
            polyVertecies.RemoveVertexAt(uint.Parse((polyVertecies.Count - 1).ToString()));
            DbEntity.AddToCurrentDocument();

            return(hresult.s_Ok);
        }
Exemplo n.º 3
0
        public override void OnDraw(GeometryBuilder dc)
        {
            dc.Clear();
            dc.Color = McDbEntity.ByObject;

            BendingShape shape1 = new BendingShape(_pnt1, _pnt2, Height, Thickness, Gap);
            //BendingShape shape2 = new BendingShape(_pnt1, _pnt2, Height, Thickness);

            Polyline3d poly = new Polyline3d(new List <Point3d>(shape1.Shape));

            //poly.SetClosed(true);

            Polyline3d.VertexDataOfPolyline polyVertecies = poly.Vertices;
            for (int i = 0; i < polyVertecies.Count; i++)
            {
                polyVertecies.MakeFilletAtVertex(i + 1, Radius);
            }
            dc.DrawPolyline(poly);
        }