Powershell to run macros in Revit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am experiencing some issues with trying to initiate a macro through power shell for Revit. In Excel it seems rather simple based on this
$excel = new-object -comobject excel.application $excelFiles = Get-ChildItem -Path C:\fso -Include *.xls, *.xlsm -Recurse Foreach($file in $excelFiles) { $workbook = $excel.workbooks.open($file.fullname) $worksheet = $workbook.worksheets.item(1) $excel.Run("CreateChart") $workbook.save() $workbook.close() } $excel.quit()
However Revit.Application is not an object on my computer even though the executable is there. Due to Revit changing their API in 2024 we have a mirroring issue that I am trying to work around. If any of you could help me figure this out I would be forever in your debt.
here is a reference to a comment so you do not have to scroll further.
logicaldiagram I have the macro written. I just need Powershell to open the document run the macro and close the document. To give more of a highlight to what is happening Autodesk's Revit changed their api in 2024 which caused a major flaw in our feature. What is needed now is to utilize a post command that Revit has today (this is what the Macro does) however post commands can not run until all the code has completed. So the idea of putting this in a loop is out of the question
When trying this I am unable to get the script to work