Hi Erik, thanks for all of your work :). I would like to warn users when they are tring to delete elements. Ex. Levels or Slabs or such important model elements. I found the ID_BUTTON_DELETE that works fine with many element types, but if I want to prevent sheet deletion, it only works when the red X delete button is used but not the delete button on the keyboard or the right-clic delete sheet button. Also in the same idea, preventing drag (move) or drag-copy deon't respond to the ID_EDIT_MOVE or ID_EDIT_MOVE_COPY. anything I am missing ?
I haven't used these commands that you've mentioned, but sometimes there are many commands that sound the same, but have slightly different use. That might be the case. You might also want to check if you use event Before/After as it might affect the logic as well.
Hi Erik, I really enjoy the videos! The quality is just amazing 🎉 I have one more question: Which hook could be used in order to have the function done before the window of the family closed with the “x”(close option) just press the cross . I think it works only through selected close/save/save as buttons.
Thanks, happy to help! You would need to go through the list of Events and see what is more appropriate. There is definetely something like Close Family Document or Close Document. Maybe you would need to add a check what kind of document is being closed to ensure it only works for families. I hope you will find your answer!
I am curious, can this be used to set up a “parameter pairing” function. I’ve been looking for ways to do something similar to Rushforth tools parameter linker but with a much friendlier user interface. I’m still very inexperienced but any tips/ pointers or even a video tutorial would be great.
Never heard of Rushforth tools, but I think you would need IUpdater. It's an interface that acts like a hook and it monitors Revit for any changes and allows to make additional changes in the same Transaction. e.g. You move window, and you can execute IUpdater that will write its coordinates to a certain parameter so it's always updated. I see some interest for it, so I will eventually make a video about it too ;)
You might need to explore events triggers. The event you mentioned: This event is raised when Revit is just about to reload latest changes from a central model. I would recommend to start very simple and just make some print statement when it's triggered. If you can't get it to print, then either your event is not triggering, or you have an error in your event handler and therefore nothing happens. As I've mentioned errors happened during the events won't be shown to us, so we need to make sure our code is working good and we handle all the errors ourselves.
6 місяців тому
@@ErikFrits Thanks for the reply! I tried and tried and couldn’t get that particular event to ever fire. However, I was able to use WorksharedOperationProgressChanged event. It has a property called “ReloadLatestFinished”. The event triggers a bunch of times during reload latest, but you can track the status using that property.
Not sure about that one. There is a command called 'OpenFamily'. That might work, but you need to think how to determine if it was executed from correct place. I would check user selection with uidoc.Selection.GetElementIds() and see if an instance of the same family is selected. So you still can open it from the Project Browser, but not from double clicking on a family. Just giving you an idea of the top of my head. You would probably need to refine it or find an alternative Event ;) Happy Coding!
@@ErikFrits in my case is almost the same. Most of the things in Revit can be done more than 1 way. In my case i would like to avoid the user to insert families in a model. I have seen that i can block Load Family, Load Autodesk Family, Load as Group, Load into Project and Close but Load Into Project i did not find a cmd-ID
Hi Erik, thanks for all of your work :). I would like to warn users when they are tring to delete elements. Ex. Levels or Slabs or such important model elements. I found the ID_BUTTON_DELETE that works fine with many element types, but if I want to prevent sheet deletion, it only works when the red X delete button is used but not the delete button on the keyboard or the right-clic delete sheet button. Also in the same idea, preventing drag (move) or drag-copy deon't respond to the ID_EDIT_MOVE or ID_EDIT_MOVE_COPY. anything I am missing ?
I haven't used these commands that you've mentioned, but sometimes there are many commands that sound the same, but have slightly different use. That might be the case.
You might also want to check if you use event Before/After as it might affect the logic as well.
Hi Erik, I really enjoy the videos!
The quality is just amazing 🎉
I have one more question:
Which hook could be used in order to have the function done before the window of the family closed with the “x”(close option) just press the cross . I think it works only through selected close/save/save as buttons.
Thanks, happy to help!
You would need to go through the list of Events and see what is more appropriate. There is definetely something like Close Family Document or Close Document. Maybe you would need to add a check what kind of document is being closed to ensure it only works for families.
I hope you will find your answer!
I am curious, can this be used to set up a “parameter pairing” function. I’ve been looking for ways to do something similar to Rushforth tools parameter linker but with a much friendlier user interface. I’m still very inexperienced but any tips/ pointers or even a video tutorial would be great.
Never heard of Rushforth tools, but I think you would need IUpdater.
It's an interface that acts like a hook and it monitors Revit for any changes and allows to make additional changes in the same Transaction.
e.g. You move window, and you can execute IUpdater that will write its coordinates to a certain parameter so it's always updated. I see some interest for it, so I will eventually make a video about it too ;)
i will definitely be on the lookout for this!@@ErikFrits
how about to stop "drag and drop" ? ;)
Haven't seen events in Revit API for that, but I think there should be a way to stop it.
I will look around later, maybe someone has a hint
Awsome, similar to import CAD event I would like to do for changing the link settings (ie workset, pin/unpin, etc). Is that also possible? Thank you
Also can you please tell me if it would work for central - local network model vs ACC cloud model?
cool stuff! will be great if you can create another video for IUpdater in Python (instead of C#), not sure if pyRevit covered this specific topic?
Thanks.
Yes, pyRevit also has a hook for IUpdater called doc-updater.py
I will make a note about IUpdater.
What about the DocumentReloadingLatest event? I think i have correctly subscribed to it, but it never seems to trigger....
You might need to explore events triggers.
The event you mentioned: This event is raised when Revit is just about to reload latest changes from a central model.
I would recommend to start very simple and just make some print statement when it's triggered. If you can't get it to print, then either your event is not triggering, or you have an error in your event handler and therefore nothing happens.
As I've mentioned errors happened during the events won't be shown to us, so we need to make sure our code is working good and we handle all the errors ourselves.
@@ErikFrits Thanks for the reply! I tried and tried and couldn’t get that particular event to ever fire. However, I was able to use WorksharedOperationProgressChanged event. It has a property called “ReloadLatestFinished”. The event triggers a bunch of times during reload latest, but you can track the status using that property.
Wow. Amazing
But I wondered - How can I block the “Edit Family” button in the same way? Couldn't find cmd-ID. Help(
Not sure about that one.
There is a command called 'OpenFamily'. That might work, but you need to think how to determine if it was executed from correct place.
I would check user selection with uidoc.Selection.GetElementIds() and see if an instance of the same family is selected. So you still can open it from the Project Browser, but not from double clicking on a family.
Just giving you an idea of the top of my head. You would probably need to refine it or find an alternative Event ;)
Happy Coding!
@@ErikFrits in my case is almost the same. Most of the things in Revit can be done more than 1 way. In my case i would like to avoid the user to insert families in a model. I have seen that i can block Load Family, Load Autodesk Family, Load as Group, Load into Project and Close but Load Into Project i did not find a cmd-ID
это мой друг
😂
@@ErikFrits продаю совместные фотографии