예제 #1
-6
        public override void Draw(DatabaseToAcad block)
        {
            // ======================== 基本几何操作 ====================================
            /// 点和向量的计算
            Point3d structPt1 = new Point3d(0, -5000, 0);

            Vector3d vect = new Vector3d(3, 9, 0);      ///
            Vector3d vectUnit = vect.GetNormal();       ///取单位向量
            Vector3d vectPer = vectUnit.RotateBy(Math.PI * 0.5, Vector3d.ZAxis);  ///向量的垂直,顺时针方向转90度

            Point3d structPt2 = structPt1 + vectUnit.MultiplyBy(2000);      ///点可以是点和向量相加
            Point3d structPt3 = structPt1 + vectPer.MultiplyBy(2000);

            /// 直线
            TxLine line1 = new TxLine(new Point3d(0, 0, 0), new Point3d(500, 500, 0));
            TxLine line2 = AcadAssist.GetOffsetLineToLeft(line1, 200);                  //线的偏移
            TxLine line3 = new TxLine(new Point3d(100, -500, 0), new Point3d(100, 5000, 0));
            TxLine line4 = new TxLine(new Point3d(1000, -500, 0), new Point3d(1000, 5000, 0));
            List<Point3d> xpnt = AcadAssist.GetIntersectionPoints(line1, line3); /// 两条线求交

            /// 圆弧
            TxArc arc = new TxArc(new Point3d(), new Point3d(100, 100, 0), new Point3d(200, 0, 0));///三点确定圆弧

            /// 圆弧转化为多义线
            TxPolyline pl2 = AcadAssist.ConvertToTxPolyline(arc);

            /// 多义线
            TxPolyline pl1 = new TxPolyline();
            pl1.AddVertexAt(0, new Point2d(0, 0), 0, 0, 0);
            pl1.AddVertexAt(1, new Point2d(0, 500), 0, 0, 0);
            pl1.AddVertexAt(2, new Point2d(500, 500), 0, 0, 0);
            pl1.AddVertexAt(3, new Point2d(300, 100), 0.5, 0, 0); /// 这个参数不是0,则是曲线
            pl1.AddVertexAt(4, new Point2d(0, 0), 0, 0, 0);

            // ======================== 基本图形的运算  AcadAssist.() ====================================
            /// 多义线裁剪和对称
            TxPolyline pl3 = AcadAssist.TrimPolylineGetFront(pl2, new Point3d(500, 500, 0));  ///  裁剪,求线的前面部分
            pl3 = AcadAssist.MillarTxPolyline(pl3, 0);

            // ======================== 绘制图形 ====================================
            /// -------- 绘制线 -----------
            block.AddLine(new Point3d(0, 0, 0), new Point3d(500, 500, 0), CommonLayer.zerolayer);
            /// --------绘制线  ----------------------- 图层说明 -- 构造有四个图层,  加入的对象颜色和线型都是随层的
            block.AddLine(line1, CommonLayer.gz1layer);  ///粗实线
            block.AddLine(line2, CommonLayer.gz2layer);  ///细实线
            block.AddLine(line3, CommonLayer.gz3layer);  ///粗虚线
            block.AddLine(line4, CommonLayer.gz4layer);  ///细虚线

            /// --------- 绘制其它基本图形
            block.AddCircle(new Point3d(0, 0, 0), 500, CommonLayer.zerolayer);
            block.AddCurve(arc, CommonLayer.dimlayer);

            //public void AddSectionLineHori(Point3d midPoint, string name, bool isTextUp, bool isArrowLeft);       /// 剖断线
            //public void AddSectionLineVert(Point3d midPoint, string name, bool isTextLeft, bool isArrowUpside);   /// 剖断线

            /// --------绘制线  ----------------------- 图层说明 -- 构造有四个图层,  加入的对象颜色和线型都是随层的
            block.AddCurve(pl1);
            block.AddCurve(pl2);
            block.AddCurve(pl3);

            ///标注文字和线 [带指引线的文字]
            block.AddTextDim(new Point3d(0, 500, 0), CommonSimbel.ConvertToDimStr(1000) + CommonSimbel.multipliSymbol + CommonSimbel.ConvertToDimStr(500), 2); /// 最后一个参数表示是哪个象限[1,2,3,4]
            block.AddTextDimAngle(new Point3d(0, 1500, 0), "sss", new Point3d(2500, 5000, 0), 250);

            ///加阴影部分
            TxPolyline plx = AcadAssist.CloneTxPolyline(pl1);
            block.AddHatch(plx, 1, CommonLayer.gz1layer);

            // -------- 绘制文字 ------
            block.AddText(new Point3d(800, 800, 0), "Hello1");
            block.AddText(new Point3d(900, 900, 0), "Hello2", block.style.RealTextHeigth, Math.PI * 0.25, CommonLayer.dimlayer, TxTextHorizontalMode.TextRight, TxTextVerticalMode.TextTop);

            ///加标题
            block.AddTitle(new Point3d(500, 500, 0), "图块标题"); /// 应该考虑图块放在上面还是下面
            ///  CommonSimbel.IsDownTitle

            ///加折断线 ,有三种,单折断线,双折断线,圆柱折断线
            //block.AddBreakLine()

            // ======================== 标注 ====================================
            //block.AddDimContinueAlign_AutoAdjust( ,);/// 自动向外调整位置
            //block.AddDimension_UserTextPoint()///  一般情况下文字位置自定处理的,但是也可以设定

            // ======================== 绘制钢筋 ====================================

            /// ------ 绘制点钢筋 ---------
            double BHC = 30;
            ISteelBar ist_dot = new ISteelBar("1", 12, SteelBarType.HRB400, "水平钢筋", 101);
            SteelDotByLine st_dot = SteelFactory.CreateSteelDots(ist_dot, structPt1, structPt2, BHC);
            block.AddSteelEntity(st_dot);

            /// ------ 绘制线钢筋 ---------
            ISteelBar ist_line = new ISteelBar("1", 12, SteelBarType.HRB400, "水平钢筋", 101);
            SteelLines st_line = SteelFactory.CreateSteelParalLine(ist_line, structPt1, structPt3, BHC, 45, 2000);
            block.AddSteelEntity(st_line);
        }