Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Selective AddinCommandBinding blocking?

1 REPLY 1
Reply
Message 1 of 2
erikeriksson5686
283 Views, 1 Reply

Selective AddinCommandBinding blocking?

Hi,

 

so Im trying to lock some of revits commands selectivly depending what user is pushing the buttons.
I know how to lock them using the executed event of the commandbinding. However how can I let it be when the "right" user comes?
I've tried to unsubscribe to the executed event when during the BeforeExecuted event, but it seems like that is too late.

Is there a way to just say "as-you-were" in my executed event handler when I just want it to execute normally?


This is also relevant when the user changes document to a document that I dont want to limit to the users...

I guess I could use Jeremy Tammiks implementation of the active document changed event, but isnt there a more elegant way of allowing it to run?

 

 

Another idea is that I dont subscribe to the event at all for the users that are allowed.
But I want the allowed users to differ depending on the document... Back to active document changed?

 

Any thoughts?

 

/Erik

Erik Eriksson
White
1 REPLY 1
Message 2 of 2

Dear Erik,

 

I probably cannot suggest anything that you have not thought of yourself...

 

I believe it might be possible to redefine an existing Revit built-in command and then use PostCommand to invoke the original built-in implementation from your own external command. Is that along the lines of what you are thinking of? I believe something like that was demonstrated at one of the DevDays when the PostCommand functionality was introduced.

 

Then, of course, there is the IExternalCommandAvailability interface. It would be pretty cool if it were possible to somehow hack your way into the existing Revit ribbon push button elements, determine the widget associated with the command of interest, and attach your own command availability class to that using, e.g., the PushButtonData.AvailabilityClassName property. Probably not possible, though.

 

That is all that comes to mind off-hand.

 

Please let us know how you get on with this, and looking forward to hear about others' ideas as well!

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community