예제 #1
0
        private void Update()
        {
            var nodes = new ObservableCollection <ISSNode>();

            ss = ssDb.GetSheetSet();
            foreach (var item in SsToList(ss.GetSheetEnumerator(), e => e.Next()))
            {
                nodes.Add(GetNode(item));
            }

            Props = GetProps();
            Nodes = nodes;
        }
예제 #2
0
        public IList <AMRSheet> GetSheets()
        {
            IAcSmEnumComponent sheetEnumerator = _currentSheetSet.GetSheetEnumerator();

            sheetEnumerator.Reset();
            IList <AMRSheet> sheets  = new List <AMRSheet>();
            IAcSmPersist     curItem = sheetEnumerator.Next();

            while (curItem != null)
            {
                if (curItem is AcSmSheet)
                {
                    AcSmSheet comp = (AcSmSheet)curItem;
                    sheets.Add(new AMRSheet(comp));
                }
                curItem = sheetEnumerator.Next();
            }
            curItem         = null;
            sheetEnumerator = null;
            return(sheets);
        }
        static void Main(string[] args)
        {
            //*****parse the command-line arguments*****
            //for now, I will simply hard code these values.
            String nameOfSheetsetFile  = "C:\\work\\ec-18-013_les_schwab_397\\main_sheet_set.dst";
            String nameOfPdfOutputFile = "C:\\work\\ec-18-013_les_schwab_397\\out.pdf";
            //TO DO: parse and verify the real command-line arguments, compose a help message.

            //*****read the sheetset file and construct a dsd file accordingly*****

            //Console.WriteLine(Microsoft.VisualBasic.Information.TypeName(new AcSmSheetSetMgr()));
            //Console.WriteLine(Microsoft.VisualBasic.Information.TypeName(Activator.CreateInstance(Type.GetTypeFromProgID("AcSmComponents.AcSmSheetSetMgr.23"), true)));


            //IAcSmSheetSetMgr sheetSetMgr; = new AcSmSheetSetMgrClass();
            IAcSmSheetSetMgr sheetSetMgr;
            //sheetSetMgr = (IAcSmSheetSetMgr) new AcSmSheetSetMgr();
            //dynamic sheetSetMgr;

            ////Console.WriteLine(Type.GetTypeFromProgID("AcSmComponents.AcSmSheetSetMgr.23"));
            ////Console.WriteLine(Type.GetTypeFromProgID("AutoCAD.Application.23"));
            Type t = Type.GetTypeFromProgID("AcSmComponents.AcSmSheetSetMgr.23");

            sheetSetMgr = (IAcSmSheetSetMgr)Activator.CreateInstance(t, true);
            //dynamic sheetSetMgr = (dynamic)Activator.CreateInstance(Type.GetTypeFromProgID("AcSmComponents.AcSmSheetSetMgr.23"), true);


            ////try
            //{
            //    // Create a new instance of AcSmSheetSetMgr
            //    sheetSetMgr = (dynamic)Activator.CreateInstance(Type.GetTypeFromProgID("AcSmComponents.AcSmSheetSetMgr.23"), true);
            //}
            //catch
            //{
            //    // If an instance of AcSmSheetSetMgr is not created then message and exit
            //    Console.WriteLine("Instance of 'AcSmComponents.AcSmSheetSetMgr.23' could not be created.");
            //    Console.WriteLine("Press any key to exit.");
            //    Console.ReadKey();
            //    return;
            //}


            IAcSmDatabase sheetdb = sheetSetMgr.OpenDatabase(nameOfSheetsetFile, false);

            if (sheetdb.GetLockStatus() == 0)
            {
                sheetdb.LockDb(sheetdb);
            }                                                              //it may not be necessary tolock the sheetset, because I am only reading fromit, not writing to it.
            AcSmSheetSet sheetset = sheetdb.GetSheetSet();

            IAcSmEnumComponent myAcSmEnumComponent = sheetset.GetSheetEnumerator();
            IAcSmComponent     thisAcSmComponent;

            while ((thisAcSmComponent = myAcSmEnumComponent.Next()) != null)
            {
                Console.WriteLine(thisAcSmComponent.GetObjectId().GetPersistObject().GetTypeName());
            }

            if (sheetdb.GetLockStatus() != 0)
            {
                sheetdb.UnlockDb(sheetdb);
            }

            // Keep the console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }