Exemplo n.º 1
0
        private EntityObject ExportBlock(GeoObject.Block blk)
        {
            List <EntityObject> entities = new List <EntityObject>();

            for (int i = 0; i < blk.Children.Count; i++)
            {
                EntityObject entity = GeoObjectToEntity(blk.Child(i));
                if (entity != null)
                {
                    entities.Add(entity);
                }
            }
            string name = blk.Name;

            if (name == null || doc.Blocks.Contains(name) || !TableObject.IsValidName(name))
            {
                name = GetNextAnonymousBlockName();
            }
            netDxf.Blocks.Block block = new netDxf.Blocks.Block(name, entities);
            doc.Blocks.Add(block);
            return(new netDxf.Entities.Insert(block));
        }