Revit 2017.1.1 x64
Hi,
It is common practice to check the input parameters of the methods. But I see that Revit SDK examples don't do it.
Does it mean that the Application and Document instances which are transferred into my external command through the ExternalCommandData instance always will not be null and will be initialized completely? Am I to check ExternalCommandData and its properties before to use them in my external command?
Thank you.
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
I wouldn't check the commandData parameter itself, but the current active document is another story.
You can use a class that implements IExternalCommandAvailability to do those checks, if you want to leave the Execute method cleaner.
Thank you.
> but the current active document is another story.
Does it mean that active document can be null or initialized when the external command is invoked?
Dear Andrey,
Yes, absolutely.
You can run an external command in null document state, aka zero document state.
In that case, the current document provided by the external command data argument will obviously be null.
If you wish to enable your external application user interface in that state as well, you need to fiddle around a bit to make it usable:
http://thebuildingcoder.typepad.com/blog/2011/02/enable-ribbon-items-in-zero-document-state.html
I hope this helps.
Best regards,
Jeremy