Has the Try and catch function been enabled yet?
I am trying to check if a family has been loaded into the current document. If it is loadded I do not want to load it in from the default location in case changes have been made. I tried using an if statement with design script but it still fails. I can probably figure out how to do it with python but I can not find the API call for Family.ByName
I do not believe it has been, but others may know better.
To confirm what you’re after -
- Get a family by name.
- If it works great, move on.
- If it fails load a family from an external source.
That sound about right?
I think it’s possible to use an if statement for this single depth of catching, but I need to know what package your File.LoadFamily is from to know for certain.
Simple If statement has me pretty hopeful (obviously not in imperative form and a very simple use case):
Thanks for the quick turn around. File.LoadFamily is from the Orchid Package.
Copying what you have done the Code Block errors out but it does load the family. Do you know if there is a way to stop the error?
I am in Dynamo 220.127.116.1104 and Revit 2019
Sadly Orchid has become a bit difficult for me to work with… I’ll try to get it reinstalled on my current package library tomorrow.
Off the top of my head you could try to suppress this warning by wrapping the function in a list and using a List.GetItemAtIndex function on the list. If it works you can file that under ‘bug as a feature’. It will likely get fixed at some point but you’ll have a few years without the warning.
Associative IF code evaluates and runs both conditions but with an imperarive function, that’s not the case.
Thank you everyone for your help.
I found a good easy workaround after messing around with your suggestion Jacob.