Exemplo n.º 1
0
        public static void ExportViewsProcessLoopNew(
            UIApplication uiapp, string source_path,
            List <List <string> > category_colors, string target_folder)
        {
            Application app = uiapp.Application;
            //app.FailuresProcessing += FaliureProcessor;

            //copy from server
            string moved_path = FileManager.MoveAndRecord(source_path);

            moved_path = ReviFileManager.saveNewCentral(app, source_path, moved_path);

            //open and activate
            //UIDocument uidoc = uiapp.OpenAndActivateDocument(moved_path);
            Document doc;

            //todo add dialog hooks here.
            //do exports
            //SheetsToJpeg(doc, target_folder, "---base");
            //ExportSheetsProcessLoop(doc, moved_path, category_colors, target_folder);
            //SheetsToJpeg(doc, target_folder, "---mask");

            //
            //UIDocument uidoc2 = uiapp.OpenAndActivateDocument(init_path);

            //doc.Close(false);
        }
Exemplo n.º 2
0
        public static void ExportViewsProcessLoopNew(
            UIApplication uiapp, string source_path,
            List <List <string> > category_colors, string target_folder)
        {
            Application app = uiapp.Application;

            //copy from server
            string moved_path = FileManager.MoveAndRecord(source_path);

            moved_path = ReviFileManager.saveNewCentral(app, source_path, moved_path);

            //open and activate
            UIDocument uidoc = uiapp.OpenAndActivateDocument(moved_path);
            Document   doc   = uidoc.Document;

            JpegsFromSheets(doc, target_folder, category_colors);
            UIDocument uidoc2 = uiapp.OpenAndActivateDocument(init_path);

            doc.Close(false);
        }
Exemplo n.º 3
0
        private static void ViewToDxf(UIApplication uiapp, string source_path,
                                      string target_folder)
        {
            Application app = uiapp.Application;
            //copy from server
            string moved_path = FileManager.MoveAndRecord(source_path);

            moved_path = ReviFileManager.saveNewCentral(app, source_path, moved_path);

            //open and activate
            UIDocument uidoc = uiapp.OpenAndActivateDocument(moved_path);

            Document doc = uidoc.Document;
            //uiapp.DialogBoxShowing += new EventHandler<DialogBoxShowingEventArgs>(OnDialogBoxShowing);

            DXFExportOptions opt  = new DXFExportOptions();
            var dwgSettingsFilter = new ElementClassFilter(typeof(ExportDWGSettings));

            var fc = new FilteredElementCollector(doc)
                     .WherePasses(dwgSettingsFilter);

            foreach (ExportDWGSettings element in fc)
            {
                var options    = element.GetDWGExportOptions();
                var layerTable = options.GetExportLayerTable();
                foreach (var layerItem in layerTable)
                {
                    var layerInfo = layerItem.Value;
                    //layerItem.
                    if (layerInfo.CategoryType == LayerCategoryType.Model)
                    {
                        layerInfo.ClearCutLayerModifiers();
                        // layerInfo.LayerName =

                        var modifiers = layerInfo.GetLayerModifiers();
                        foreach (var modifier in modifiers)
                        {
                            // get modifier type
                            var modifierType = modifier.ModifierType;
                            // get separator
                            var separater = modifier.Separator;
                        }
                    }
                }
            }
            //string filename;

            using (Transaction tx = new Transaction(doc))
            {
                tx.Start("Transaction Name");

                // foreach (ElementId id in ids)
                // {
                //  Element e = doc.GetElement(id);

                // . . .

                // view.IsolateElementTemporary(partId);

                // doc.Export(target_folder, filename, viewIds, opt);
                // }

                // We do not commit the transaction, because
                // we do not want any modifications saved.
                // The transaction is only created and started
                // because it is required by the
                // IsolateElementTemporary method.
                // Since the transaction is not committed,
                // the changes are automatically discarded.

                tx.Commit();
            }
        }