Exemplo n.º 1
0
        /// <summary>
        /// Provides access to the entities of the layout with the given name.
        /// </summary>
        /// <param name="name">The name of the layout.</param>
        /// <returns>An EntityContainer to access the layout's entities.</returns>
        public EntityContainer PaperSpace(string name)
        {
            Require.NotDisposed(Database.IsDisposed, nameof(AcadDatabase));
            Require.ParameterNotNull(name, nameof(name));
            Require.NameExists <Layout>(Layouts.Contains(name), nameof(name));

            var layout = Layouts.Element(name);

            Require.IsTrue(layout.ModelType, $"{name} is not a paper space layout");

            return(new EntityContainer(Database, transaction, layout.BlockTableRecordId));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Provides access to the entities of the layout with the given name.
        /// </summary>
        /// <param name="name">The name of the layout.</param>
        /// <returns>An EntityContainer to access the layout's entities.</returns>
        public EntityContainer PaperSpace(string name)
        {
            if (name == null)
            {
                throw Error.ArgumentNull("name");
            }

            try
            {
                var layout = Layouts.Element(name);
                if (layout.ModelType)
                {
                    throw Error.Generic("Not a paper space layout");
                }

                return(new EntityContainer(Database, transaction, layout.BlockTableRecordId));
            }
            catch (Exception e)
            {
                throw Error.AutoCadException(e);
            }
        }