Manuel486
(Manuel Faust)
June 12, 2023, 11:12am
1
Hello everybody.
I would like to integrate the plan output/changes command into my own toolbar.
With a script in a pushbutton it would work. But it takes a very, very long time.
Here is the Script:
from pyrevit import revit, UI
doc = revit.doc
Command_ID = UI.RevitCommandId.LookupCommandId(‘ID_SETTINGS_REVISIONS’)
UI.UIApplication(doc.Application).PostCommand(Command_ID)
Is there another way here?
Greets
I have been following your issues as I have been having the same. I have read up about invoke buttons and even tried your method to call on an external dll with no success. I am getting the command ID is null which is filled in. If you get any luck let me know. Thank you
Jean-Marc
(Jean-Marc Couffin)
June 15, 2023, 3:36pm
3
When putting this script in a pushbutton it works fast on my side. No real delay between click and rev table compared to the builtin button
Manuel486
(Manuel Faust)
June 15, 2023, 4:07pm
4
My revit version is 2021.1.8. In which version did you test it?
Jean-Marc
(Jean-Marc Couffin)
June 15, 2023, 6:17pm
5
The same one.
But also in 2024
Manuel486
(Manuel Faust)
June 16, 2023, 8:05am
6
Jean-Marc
(Jean-Marc Couffin)
June 16, 2023, 8:45am
7
you could add a timer between each line to see where it takes the most time
Basically doing performance profiling.
Also ou could try with a different command that requires a window to open.
Do you have any particular hook or addins attach to revit? That could slow it down.
What you could also do, is importing Autodesk modules directly. It might be slightly faster.
and doing it with the LookupPostableCommandId
from Autodesk.Revit.UI import UIApplication, RevitCommandId, PostableCommand
doc = __revit__.ActiveUIDocument.Document
uiapp = UIApplication(doc.Application)
Command_ID=RevitCommandId.LookupPostableCommandId(PostableCommand.SheetIssuesOrRevisions)
uiapp.PostCommand(Command_ID)
Manuel486
(Manuel Faust)
June 16, 2023, 9:12am
8
This is how it works.
I would say it takes about 1-2 seconds longer than using the original revit button.
Jean-Marc:
from Autodesk.Revit.UI import UIApplication, RevitCommandId, PostableCommand
doc = revit .ActiveUIDocument.Document
uiapp = UIApplication(doc.Application)
Command_ID=RevitCommandId.LookupPostableCommandId(PostableCommand.SheetIssuesOrRevisions)
uiapp.PostCommand(Command_ID)
What is the easiest way to get the name of the revit command, i.e. the PostableCommand?
This?
Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018
I use a lot of addins:
ArchilizerTinyTools-1.0.11
AECTechDependentView-2.2
BIM42Align-1.8.0
BIMcollab Installer 1.0 build 16
DiRoots.AppManager_1110
DiRoots.DiStem_0960
DiRoots.One_1310
DiRoots.ProSheets_12180
ModPlusInstaller_v.24.0
pyRevit_4.8.12.22247_signed
TwentyTwoElementSelectorPro-1.0.6
TwentyTwoTransferLegend-1.1.5
TwentyTwoTransferTemplate-1.0.5
XrevFreebiesSetup_2.9.0_x64
BIMinteropTools
ReluxCADforRevit-2022.2.12.0
EF_Tools
Jean-Marc
(Jean-Marc Couffin)
June 16, 2023, 12:03pm
9
Journal file entries are the only way that I know for non-system postable commands
Manuel486
(Manuel Faust)
June 18, 2023, 9:55am
10
What could the postable command be for this tool:
0:< API_SUCCESS { Added pushbutton Id: 7055, name: Xrev.Freebies.Revit.UpRev.UpRevCommand, text: Up Rev, class: Xrev.Freebies.Revit.UpRev.UpRevCommand, assembly: C:\Program Files\Xrev Freebies\Xrev.Freebies.2021.dll, parentId: CustomCtrl_%Add-Ins%Xrev.Freebies }
Jrn.RibbonEvent “Execute external command:CustomCtrl_%CustomCtrl_%Add-Ins%Xrev.Freebies%Xrev.Freebies.Revit.UpRev.UpRevCommand:Xrev.Freebies.Revit.UpRev.UpRevCommand”
Manuel486
(Manuel Faust)
June 18, 2023, 11:45am
12
from Autodesk.Revit.UI import UIApplication, RevitCommandId, PostableCommand
doc = revit .ActiveUIDocument.Document
uiapp = UIApplication(doc.Application)
Command_ID=RevitCommandId.LookupPostableCommandId(PostableCommand.CustomCtrl_%CustomCtrl_%Add-Ins%Xrev.Freebies%Xrev.Freebies.Revit.UpRev.UpRevCommand:Xrev.Freebies.Revit.UpRev.UpRevCommand)
uiapp.PostCommand(Command_ID)
After pushing the button i get this message:
This works fine:
from pyrevit import revit, UI
doc = revit.doc
Command_ID = UI.RevitCommandId.LookupCommandId(‘CustomCtrl_%CustomCtrl_%Add-Ins%Xrev.Freebies%Xrev.Freebies.Revit.UpRev.UpRevCommand’)
UI.UIApplication(doc.Application).PostCommand(Command_ID)
But it takes a long time to open.
Manuel486
(Manuel Faust)
June 18, 2023, 1:26pm
14
This works:
from pyrevit import HOST_APP, UI
uiapp = HOST_APP.uiapp
uiapp.PostCommand(UI.RevitCommandId.LookupCommandId(“CustomCtrl_%CustomCtrl_%Add-Ins%Xrev.Freebies%Xrev.Freebies.Revit.UpRev.UpRevCommand”))
But the addin takes 37 seconds to open…
That works as well:
from pyrevit import revit, UI
doc = revit.doc
Command_ID = UI.RevitCommandId.LookupCommandId(‘CustomCtrl_%CustomCtrl_%Add-Ins%Xrev.Freebies%Xrev.Freebies.Revit.UpRev.UpRevCommand’)
UI.UIApplication(doc.Application).PostCommand(Command_ID)
But the addin takes 32 seconds to open…
it’s frustrating that there isn’t an easier way to create your own tollbar.
revit needs a function like the quick access toolbox, in its own toolbar.
Manuel486
(Manuel Faust)
June 26, 2023, 8:49am
15
Update:
I tested this code:
from pyrevit import revit, UI
doc = revit.doc
Command_ID = UI.RevitCommandId.LookupCommandId('CustomCtrl_%CustomCtrl_%Add-Ins%Xrev.Freebies%Xrev.Freebies.Revit.UpRev.UpRevCommand')
UI.UIApplication(doc.Application).PostCommand(Command_ID)
in a script.py in a pushbutton and in Revit 2020 and it opened the tool right away.
Then I saw that ReluxCADforRevit-2023.1.5.0 is not installed in this version. So I uninstalled it everywhere.
Now my button also opens in Revit 2021 and 2022 in a few seconds.
I will write to the manufacturer and see if he can fix the problem.
1 Like
Manuel486
(Manuel Faust)
June 27, 2023, 12:47pm
17
Answer from Relux:
It seems that there is a conflict between pyRevit and ReluxCAD for Revit with one of the additional components used by both. ReluxCAD for Revit uses a newer version of the component than pyRevit, which leads to the problem mentioned.
Since we were planning to get rid of this component anyway, please be patient until we can publish a new version.
1 Like