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: 

Load family from a file server

7 REPLIES 7
Reply
Message 1 of 8
mizrachi_amir2
447 Views, 7 Replies

Load family from a file server

Hello,

 

Part of my plugin process is to load a pre-defined Revit family I prepared that my plugin uses.

2 options I was thinking of:

 

1. To copy this family from my file server once the plugin is begin installed and then to load it to the Revit project once plugin is executed. In this case - where do you think it is better to save this rfa file in my users' station? This family will have to be loaded to each new project in Revit so it will have to be saved in a safe place.

2. Load this rfa directly from my file server to the Revit project once plugin is executed. Is this even possible?

 

Do you think of any other way to tackle this?

 

Thank you!  

7 REPLIES 7
Message 2 of 8
Speed_CAD
in reply to: mizrachi_amir2

Hi mizrachi_amir2,

 

I made a small extension method to select two points and simulate a rubber band. The family I use is added to my resources and I copy it to a safe folder to make sure there are no write issues. If the family exists in the project, it does nothing. If it doesn't exist, it is copied and loaded, then I delete it. Maybe this approach can be useful for you.

 

https://github.com/SpeedCAD/SCADtools.Revit.UI.RubberBand 

Mauricio Jorquera
Message 3 of 8
mizrachi_amir2
in reply to: Speed_CAD

Hi @Speed_CAD,

 

So you're copying the rfa file from your resources to the user's temp folder, then load it to the Revit project and finally delete it from temp folder. Is that correct?

Message 4 of 8

Also, how would you solve it for different Revit version?
If I need my rfa for Revit 2021 and up I need to save 5 copies of it in resources (one per each Revit version)? and then in my plugin to load each one for the corresponding Revit version? 

[EDIT]:
I used the preprocessor directives #if/#elif/#endif and it's working good, was wondering if there's a more elegant way for that.

Message 5 of 8
Speed_CAD
in reply to: mizrachi_amir2


@mizrachi_amir2  ha escrito:

Hi @Speed_CAD,

 

So you're copying the rfa file from your resources to the user's temp folder, then load it to the Revit project and finally delete it from temp folder. Is that correct?


Yes, that's what I do

Mauricio Jorquera
Message 6 of 8
Speed_CAD
in reply to: mizrachi_amir2


@mizrachi_amir2  ha escrito:

Also, how would you solve it for different Revit version?
If I need my rfa for Revit 2021 and up I need to save 5 copies of it in resources (one per each Revit version)? and then in my plugin to load each one for the corresponding Revit version? 

[EDIT]:
I used the preprocessor directives #if/#elif/#endif and it's working good, was wondering if there's a more elegant way for that.



In that case, I would use the family for Revit 2021 over all other versions.

Mauricio Jorquera
Message 7 of 8
mizrachi_amir2
in reply to: Speed_CAD

In that case, user will experience a pop up window of the family being upgraded from 2021 to a newer version.
I don't think this is a good user experience.

Message 8 of 8

Using prefebs for different version is safer.

In the versions not English, keying anything by keyboard would cause crash after upgrading a model.

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

Post to forums  

Autodesk Design & Make Report