Esempio n. 1
0
        private static Polyline Polyline2dToPolyline(Polyline2d polyline2d)
        {
            Document doc   = DatabaseUtil.GetActiveDocument();
            Database db    = doc.Database;
            Polyline oPoly = null;

            try
            {
                using (doc.LockDocument())
                {
                    using (Transaction tr = DatabaseUtil.GetTransaction(db))
                    {
                        oPoly = new Polyline();
                        Vertex2d[] oVtcies = polyline2d.Cast <Vertex2d>().ToArray();

                        for (int i = 0; i < oVtcies.Length; i++)
                        {
                            oPoly.AddVertexAt(i, GeometryUtil.ToPoint2d(oVtcies[i].Position), 0, 0, 0);
                        }

                        oPoly.Layer = polyline2d.Layer;
                        oPoly.Color = polyline2d.Color;
                    }
                }

                return(oPoly);
            }
            catch
            {
                return(null);
            }
        }