コード例 #1
0
ファイル: Block.cs プロジェクト: seasailor/designscript
        /// <summary>
        /// Lists all available blocks in the current drawing
        /// </summary>
        /// <returns></returns>
        public static DSBlock[] AvailableBlockDefinitions()
        {
            IBlockHelper helper = HostFactory.Factory.GetBlockHelper();

            if (null == helper)
            {
                throw new InvalidOperationException(string.Format(Properties.Resources.OperationFailed, "DSBlock.AvailableBlockDefinitions"));
            }

            string[]       blockNames = helper.ListAllBlocksInCurrentDocument();
            List <DSBlock> blocks     = new List <DSBlock>();

            foreach (var name in blockNames)
            {
                DSBlock block = new DSBlock(name);
                blocks.Add(block);
            }
            return(blocks.ToArray());
        }