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: 

How a Generic Model elements to host reinforcement by revit api ?

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
Anonymous
2191 Views, 7 Replies

How a Generic Model elements to host reinforcement by revit api ?

I tried to change a family file,which set the 'can host rebar' to true.

I get the information from this page:

 

http://help.autodesk.com/view/RVT/2014/ENU/?guid=GUID-482810DC-1C37-41CD-85B2-3EB89C33D5BC

 

the note:

"

Note: You can enable Generic Model elements to host reinforcement. Open the element in the Family Editor. On the Properties palette select Can Host Rebar in the Structural section. Reload the family into your project.
"
But I do not know how to make it by revit api.
Could anyone tell me anything about it?
Thanks very much!
7 REPLIES 7
Message 2 of 8
jeremytammik
in reply to: Anonymous

In the API, open the the family document, set the property, save, close and reload the family document into the project document.

 

The Building Coder shares code showing how to achieve some of those steps:

 

https://thebuildingcoder.typepad.com/blog/2011/06/reloading-a-family.html

 

Probably it includes code for the other steps also.

 

You just need to search a bit.

 

 

Cheers,

 

Jeremy

 



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

Message 3 of 8
Anonymous
in reply to: jeremytammik

Dear  jeremytammik,Thank you very much.

I will obey your rules.

Best wishes.

Message 4 of 8
Anonymous
in reply to: jeremytammik

Sorry distrub you again.

 

I tried search the key word "set property" in your blog.Get some programme,but it shows useless.

 

 I may understand  by a wrong way.

 

In my understand, I  think the parameter or property can change by setting  a value ,like false or true or something else.

Firstly, I try to get it by the way get_Parameter(),or Parameters and out put all the parameter's name.But I did not get the "can host rebar".

Also I tried the get_Parameter(BuiltInParameter.FAMILY_CAN_HOST_REBAR),(ps: the BuiltInParameter.FAMILY_CAN_HOST_REBAR , I think it may about what I want), return null.

 

So,I think the word "property" you mean ,I understand the wrong way, it is not a parameter.

 

And then, I think it may be a global setting of the document?

 

I tried to search the Setting class, tried to out put the Categories and TilePatternBuiltIn,it may not the way to set property.

 

Could any more tips?

Message 5 of 8
jeremytammik
in reply to: Anonymous

No problem. Thank you for sharing your research so far.

 

I do not know where the property you are looking for might be stored. I would have to search for it too.

 

You can do so using the Revit database exploration tool RevitLookup:

 

https://github.com/jeremytammik/RevitLookup

  

I very much hope you are aware of and using it it already.

  

You should first determine exactly where the property you are looking for appears in the user interface.

  

What element or document is hosting it, is it a built-in parameter, which built-in parameter, etc.

  

Then you can use RevitLookup to search for the exact path to retrieve and set its value via the API.

  

I hope this helps.

  

Cheers,

  

Jeremy

  



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

Message 6 of 8
Anonymous
in reply to: jeremytammik

Sorry distrub you again.

 

But this time is the good news(May the word news is not suitable).

 

Finaly,I get the "Can host rebar" Parameter by the tools you  provide.

From the DB data, I easy find it :

document(which is familydocument) -> OwnerFamily -> parameters -> can host rebar

the wrong thinkings about before:

document - > familymanager -> parameters -> wrong

And now,I want to change the value: I think I can complete it.

 

Thank you very much.

 

Thank you teach me how to catch fish by finshing net,which I was by hand before.

 

Cheers,

 

lan

 

Message 7 of 8
jeremytammik
in reply to: Anonymous

Brilliant!

 

Well done!

 

I wish you the best of luck completing it.

 

Thank you for your appreciation.

 

Cheers,

 

Jeremy

 



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

Message 8 of 8
Anonymous
in reply to: Anonymous

according to your last reply,I set the "family_can_host_rebar" whether in familyInstance or in family document ,for example :

Parameter parameter = box.get_Parameter(BuiltInParameter.FAMILY_CAN_HOST_REBAR);
parameter.Set(1);

or:Parameter parameter = familyDocument.OwnerFamily.get_Parameter(BuiltInParameter.FAMILY_CAN_HOST_REBAR);

parameter.Set(1);

but none of the settings work,still  "not a valid host" ( rebarhostdata.isvalidhost),do you have any advice to help me solve the problem ?

I will be very grateful!

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

Post to forums  

Autodesk Customer Advisory Groups


Rail Community