Exemplo n.º 1
0
        void write_line()
        {
            Eldtype  eld  = new Eldtype();
            Linetype line = new Linetype();

            line.elatt = elatt;
            line.scatt = 1;
            line.layer = "$$$$_14";
            line.laatt = 1;
            line.x1    = x1;
            line.y1    = y1;
            line.z1    = 0;
            line.x2    = x2;
            line.y2    = y2;
            line.z2    = 0;
            line.color = 14;
            line.style = 1;
            line.width = 1;

            line.label = modnam + ":" + stglbl;

            eld.Code = 1;
            fp1.Write(eld.Code);
            line.ToStream(fp1);
        }
Exemplo n.º 2
0
        void write_drg()
        {
            Eldtype  eld  = new Eldtype();
            Linetype line = new Linetype();

            if (pnts != 0)
            {
                if (index == 0)
                {
                    line.elatt = 0;
                }
                else
                {
                    line.elatt = 1;
                }

                line.scatt = 1;
                line.layer = "$$$$_2";
                line.laatt = 1;
                line.x1    = last_sx;
                line.y1    = last_sy;
                line.z1    = last_sz;
                line.x2    = x2;
                line.y2    = y2;
                line.z2    = z2;
                line.color = 2;
                line.style = 1;
                line.width = (short)0.35;
                line.label = offmod + ":" + offstg;

                eld.Code = 1;
                fp3.Write(eld.Code);
                line.ToStream(fp3);

                index = 1;
            }

            last_sx = x2;
            last_sy = y2;
            last_sz = z2;

            pnts++;
        }
Exemplo n.º 3
0
        private void write_drg()
        {
            short    i        = 0;
            short    ELD_code = 0;
            Linetype line     = new Linetype();

            for (i = 1; i < ptsc; i++)
            {
                line.elatt = 0;
                if (i == 1)
                {
                    line.elatt = 0;
                }
                else if (i > 1)
                {
                    line.elatt = 1;
                }


                line.scatt = 1;
                line.layer = "$$_4";
                line.laatt = 1;
                line.x1    = x[i - 1];
                line.y1    = y[i - 1];
                line.z1    = 0.0;
                line.x2    = x[i];
                line.y2    = y[i];
                line.z2    = 0.0;
                line.color = 4;
                line.style = 1;
                line.width = 1;
                line.label = modnam;
                line.label = ":";
                line.label = stglbl;

                ELD_code = 1;

                fp3.Write(ELD_code);

                line.ToStream(fp3);
            }
        }
Exemplo n.º 4
0
        void write_drg()
        {
            Eldtype  eld  = new Eldtype();
            Linetype line = new Linetype();

            if (pts != 0)
            {
                if (index == 0)
                {
                    line.elatt = 0;
                }
                else
                {
                    line.elatt = 1;
                }

                line.scatt = 1;
                line.layer = "$$$$_4";
                line.laatt = 1;
                line.x1    = last_sx;
                line.y1    = last_sy;
                line.z1    = 0.0;
                line.x2    = sx;
                line.y2    = sy;
                line.z2    = 0.0;
                line.color = 4;
                line.style = 1;
                line.width = 1;
                line.label = modnam + ":" + stglbl;


                eld.Code = 1;
                fp3.Write(eld.Code);

                line.ToStream(fp3);

                index = 1;
            }
        }
Exemplo n.º 5
0
        public static void ExportToDRG(IHeadsApplication app, string strPath)
        {
            CCfgtype cfg = app.ActiveDocument.ConfigParam;

            CBox box = app.ActiveDocument.BoundingBox;

            double[] Arr = new double[] { box.BottomRight.X, box.BottomRight.Y, box.TopLeft.X, box.TopLeft.Y };

            cfg.XLate_X = Arr[0];
            cfg.XLate_Y = Arr[1];
            cfg.hs      = (297 / (Arr[2] - cfg.XLate_X));

            BinaryWriter bw  = new BinaryWriter(new FileStream(strPath, FileMode.Create), Encoding.Default);
            Eldtype      eld = new Eldtype();

            eld.Code = 99;
            bw.Write(eld.Code);
            cfg.ToStream(bw);
            IHdEntity[] allEntities = app.ActiveDocument.Entities;
            foreach (IHdEntity entity in allEntities)
            {
                if (entity.EntityName == "LINE")
                {
                    IHdLine hdline = (IHdLine)entity;
                    eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 91 : 1);
                    bw.Write(eld.Code);

                    Linetype line = new Linetype();

                    line.elatt = 0;
                    line.scatt = 1;
                    line.layer = hdline.Layer;
                    line.laatt = 1;

                    line.x1 = hdline.StartPoint.X;
                    line.y1 = hdline.StartPoint.Y;
                    line.z1 = hdline.StartPoint.Z;

                    line.x1 = line.x1 / cfg.XMetric;
                    line.y1 = line.y1 / cfg.YMetric;

                    line.x2 = hdline.EndPoint.X;
                    line.y2 = hdline.EndPoint.Y;
                    line.z2 = hdline.EndPoint.Z;

                    line.x2 = line.x2 / cfg.XMetric;
                    line.y2 = line.y2 / cfg.YMetric;

                    line.color = entity.ColorIndex;

                    if (hdline.Label == "")
                    {
                        line.label = "$$$$$$$$:****";
                    }
                    else
                    {
                        line.label = hdline.Label;
                    }

                    line.ToStream(bw);
                }
                else if (entity.EntityName == "ELLIPSE")
                {
                    IHdEllipse hdEllipse = (IHdEllipse)entity;
                    eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 93 : 3);
                    bw.Write(eld.Code);

                    Circletype circle1 = new Circletype();

                    circle1.elatt = 0;
                    circle1.scatt = 1;
                    circle1.Layer = hdEllipse.Layer;
                    circle1.laatt = 1;

                    circle1.xc = hdEllipse.CenterPoint.X;
                    circle1.yc = hdEllipse.CenterPoint.Y;

                    circle1.xc     = circle1.xc / cfg.XMetric;
                    circle1.yc     = circle1.yc / cfg.YMetric;
                    circle1.Radius = hdEllipse.Radius;

                    circle1.color = entity.ColorIndex;

                    if (hdEllipse.Label == "")
                    {
                        circle1.Label = "$$$$$$$$:****";
                    }
                    else
                    {
                        circle1.Label = hdEllipse.Label;
                    }

                    circle1.ToStream(bw);
                }
                else if (entity.EntityName == "ARC")
                {
                    IHdArc hdArc = (IHdArc)entity;
                    eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 94 : 4);
                    bw.Write(eld.Code);

                    Arctype arc = new Arctype();

                    arc.elatt = 0;
                    arc.scatt = 1;
                    arc.Layer = hdArc.Layer;
                    arc.laatt = 1;

                    arc.xc = hdArc.CenterPoint.X;
                    arc.yc = hdArc.CenterPoint.Y;
                    arc.xc = arc.xc / cfg.XMetric;
                    arc.yc = arc.yc / cfg.YMetric;

                    arc.xs     = (arc.xc + hdArc.Radius * Math.Cos(hdArc.StartAngle)) / cfg.XMetric;
                    arc.ys     = (arc.yc + hdArc.Radius * Math.Sin(hdArc.StartAngle)) / cfg.YMetric;
                    arc.xe     = (arc.xc + hdArc.Radius * Math.Cos(hdArc.EndAngle)) / cfg.XMetric;
                    arc.ye     = (arc.yc + hdArc.Radius * Math.Sin(hdArc.EndAngle)) / cfg.YMetric;
                    arc.Radius = hdArc.Radius;

                    arc.Color = entity.ColorIndex;
                    if (hdArc.Label == "")
                    {
                        arc.Label = "$$$$$$$$:****";
                    }
                    else
                    {
                        arc.Label = hdArc.Label;
                    }
                    arc.ToStream(bw);
                }
                else if (entity.EntityName == "POLYLINE3D")
                {
                    IHdPolyline3D hdPline      = (IHdPolyline3D)entity;
                    CPoint3D[]    Coord        = hdPline.Coordinates;
                    int           NumVerticies = Coord.Length - 2;
                    for (int j = 0; j <= NumVerticies; j++)
                    {
                        eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 91 : 1);
                        bw.Write(eld.Code);

                        Linetype line = new Linetype();

                        if (j == 0)
                        {
                            line.elatt = 0;
                        }
                        else
                        {
                            line.elatt = 1;
                        }

                        //line.elatt = X;
                        line.scatt = 1;
                        line.layer = hdPline.Layer;
                        line.laatt = 1;

                        line.x1 = Coord[j].X;
                        line.y1 = Coord[j].Y;
                        line.z1 = Coord[j].Z;

                        line.x1 = line.x1 / cfg.XMetric;
                        line.y1 = line.y1 / cfg.YMetric;

                        line.x2 = Coord[j + 1].X;
                        line.y2 = Coord[j + 1].Y;
                        line.z2 = Coord[j + 1].Z;

                        line.x2    = line.x2 / cfg.XMetric;
                        line.y2    = line.y2 / cfg.YMetric;
                        line.color = entity.ColorIndex;

                        if (hdPline.Label == "")
                        {
                            line.label = "$$$$$$$$:****";
                        }
                        else
                        {
                            line.label = hdPline.Label;
                        }

                        line.ToStream(bw);
                    }
                }
                else if (entity.EntityName == "TEXT")
                {
                    IHdText hdTxt = (IHdText)entity;
                    eld.Code = (short)((Constants.BuildType == eHEADS_RELEASE_TYPE.DEMO) ? 90 : 9);
                    bw.Write(eld.Code);

                    TEXTtype text = new TEXTtype();

                    text.Length = 1;
                    text.scatt  = 1;
                    text.Layer  = hdTxt.Layer;
                    text.laatt  = 1;

                    text.x1 = hdTxt.InsertionPoint.X;
                    text.y1 = hdTxt.InsertionPoint.Y;

                    text.x1    = text.x1 / cfg.XMetric;
                    text.y1    = text.y1 / cfg.YMetric;
                    text.Size  = hdTxt.Height;
                    text.rotn  = hdTxt.Rotation * 180 / Math.PI;
                    text.text  = hdTxt.Text;
                    text.Color = entity.ColorIndex;
                    if (hdTxt.Label == "")
                    {
                        text.Label = "$$$$$$$$:****";
                    }
                    else
                    {
                        text.Label = hdTxt.Label;
                    }
                    text.ToStream(bw);
                }
            }

            bw.Close();
        }