Esempio n. 1
0
        public static AcadLWPolyline DrawDonut(AcadBlock space,
                                               double inRad,
                                               double outRad,
                                               double cenPt1,
                                               double cenPt2)
        {
            double width, radius, PI;

            double[]       tmp = new double[2];
            double[]       v   = new double[4];
            AcadLWPolyline pl;

            double[] basePnt = new double[3];

            try
            {
                //Switch to terminals layer
                gbl_doc.ActiveLayer = TerminalsLayer;

                basePnt[0] = cenPt1;
                basePnt[1] = cenPt2;
                basePnt[2] = 0.0;
                PI         = Math.Atan(1) * 4;
                width      = (outRad - inRad) / 2;
                radius     = (inRad + width) / 2;
                tmp        = (double[])gbl_doc.Utility.PolarPoint(basePnt,
                                                                  PI, radius);

                v[0] = tmp[0];
                v[1] = tmp[1];
                tmp  = (double[])gbl_doc.Utility.PolarPoint(basePnt,
                                                            0, radius);
                v[2] = tmp[0];
                v[3] = tmp[1];
                pl   = space.AddLightWeightPolyline(v);



                pl.Closed = true;
                pl.SetWidth(0, width, width);
                pl.SetBulge(0, -1);
                pl.SetWidth(1, width, width);
                pl.SetBulge(1, -1);

                //Switch to other layer
                gbl_doc.ActiveLayer = SwitchLayer;

                return(pl);
            }

            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(null);
            }
        }
Esempio n. 2
0
 public AcadLWPolyline AddLightWeightPolyline(object vvarVerticesList, string nvstrHandle = "")
 {
     return(mobjAcadBlock.AddLightWeightPolyline(RuntimeHelpers.GetObjectValue(vvarVerticesList), nvstrHandle));
 }
Esempio n. 3
0
        public static AcadLWPolyline DrawDonut(AcadBlock space,
                                                double inRad,
                                                double outRad,
                                                double cenPt1,
                                                double cenPt2)
        {
            double width, radius, PI;
            double[] tmp = new double[2];
            double[] v = new double[4];
            AcadLWPolyline pl;
            double[] basePnt = new double[3];

            try
            {
                //Switch to terminals layer
                gbl_doc.ActiveLayer = TerminalsLayer;

                basePnt[0] = cenPt1;
                basePnt[1] = cenPt2;
                basePnt[2] = 0.0;
                PI = Math.Atan(1) * 4;
                width = (outRad - inRad) / 2;
                radius = (inRad + width) / 2;
                tmp = (double[])gbl_doc.Utility.PolarPoint(basePnt,
                                                       PI, radius);

                v[0] = tmp[0];
                v[1] = tmp[1];
                tmp = (double[])gbl_doc.Utility.PolarPoint(basePnt,
                                                        0, radius);
                v[2] = tmp[0];
                v[3] = tmp[1];
                pl = space.AddLightWeightPolyline(v);

                pl.Closed = true;
                pl.SetWidth(0, width, width);
                pl.SetBulge(0, -1);
                pl.SetWidth(1, width, width);
                pl.SetBulge(1, -1);

                //Switch to other layer
                gbl_doc.ActiveLayer = SwitchLayer;

                return pl;
            }

            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
                return null;

            }
        }