Revit Journal Scripting Example
I've tried making new file from revit and adding worksets in it using journal file. Here's an example code I've used. I will later use this journal file with Excel VBA to create folder structures and Revit files automatically.
' 0:< Initial VM: Avail 8388359 MB, Used 21 MB, Peak 45; RAM: Avail 11334 MB, Used 48 MB, Peak 45 Dim Jrn Set Jrn = CrsJournalScript Jrn.Command "Internal" , "Create a new project , ID_FILE_NEW_CHOOSE_TEMPLATE" Jrn.ComboBox "Modal , New Project , Dialog_Revit_NewProject" _ , "Control_Revit_TemplateCombo" _ , "SelEndOk" , "<None>" Jrn.ComboBox "Modal , New Project , Dialog_Revit_NewProject" _ , "Control_Revit_TemplateCombo" _ , "Select" , "<None>" Jrn.PushButton "Modal , New Project , Dialog_Revit_NewProject" _ , "OK, IDOK" Jrn.Directive "DocSymbol" _ , "[Project1]" Jrn.Data "TaskDialogResult" _ , "Which system of measurement do you want to use in your project?", _ "Metric", "1002" Jrn.Data "Transaction Successful", "Create Type Previews" Jrn.Directive "AllowPressAndDrag", 0 'workset setup Jrn.RibbonEvent "TabActivated:Collaborate" Jrn.Command "Internal" , "Workset control , ID_SETTINGS_PARTITIONS" Jrn.Edit "Modal , Worksharing , Dialog_Revit_PartitionsEnable", "Control_Revit_PartitionsEnableOthersEdit", "ReplaceContents", "Test1" Jrn.PushButton "Modal , Worksharing , Dialog_Revit_PartitionsEnable", "OK, IDOK" Jrn.Data "Transaction Successful", "Worksets" Jrn.PushButton "Modal , Worksets , Dialog_Revit_Partitions", "New, Control_Revit_New" Jrn.Edit "Modal , New Workset , Dialog_Revit_NewPartition", "Control_Revit_NewPartitionName", "ReplaceContents" , "Test2" Jrn.PushButton "Modal , New Workset , Dialog_Revit_NewPartition", "OK, IDOK" Jrn.PushButton "Modal , Worksets , Dialog_Revit_Partitions", "New, Control_Revit_New" Jrn.Edit "Modal , New Workset , Dialog_Revit_NewPartition", "Control_Revit_NewPartitionName", "ReplaceContents" , "Test3" Jrn.PushButton "Modal , New Workset , Dialog_Revit_NewPartition", "OK, IDOK" Jrn.PushButton "Modal , Worksets , Dialog_Revit_Partitions", "New, Control_Revit_New" Jrn.Edit "Modal , New Workset , Dialog_Revit_NewPartition", "Control_Revit_NewPartitionName", "ReplaceContents" , "Test4" Jrn.PushButton "Modal , New Workset , Dialog_Revit_NewPartition", "OK, IDOK" 'closing workset window Jrn.PushButton "Modal , Worksets , Dialog_Revit_Partitions", "OK, IDOK" Jrn.Data "Transaction Successful", "Worksets" 'save Jrn.Command "Internal" , "Save the active project , ID_REVIT_FILE_SAVE" Jrn.Data "File Name", "IDOK", "C:\1\hi.rvt" Jrn.Command "SystemMenu" , "Quit the application; prompts to save projects , ID_APP_EXIT"
댓글