For my project, ‘elevated water tank,’ I’ve created a python script that generates a generic model family called ‘shaft,’ which I can duplicate multiple times depending on the number of levels. After that, I need to create rebars for each element, and for that, the family should be a valid rebar host. (I can’t find an option to designate the family as a rebar host during its creation. Additionally, I am unable to class the family as a structural category, which would enable it to automatically host rebars. ) … In this case, I am compelled to edit the family through the UI and enable the parameter 'Can host rebar ’ to create rebars.
.
I previously asked this question here and attempted to access the document to change the storage value of the built-in parameter BuiltInParameter.DPART_CAN_HOST_REBAR from 0 to 1, which would allow hosting rebar, unfortunately, this parameter is “read-only.”.
To resolve this issue, as recommended to me in the forum revit-api , I need to override this parameter and modify its constraints to be able to change its value. However, I’m struggling with how to do that…If it’s impossible, is there a way to directly create a structural family and bypass all these steps?
be kind to check below my code and the rvt file
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
Shaft_Id = ElementId(451597)
Shaft = doc.GetElement(Shaft_Id)
Host = Shaft.get_Parameter(BuiltInParameter.DPART_CAN_HOST_REBAR)
t = Transaction(doc, 'rebar_host')
t.Start()
Host.Set(1).AsInteger()
t.Commit()
OUT = Host
Instead of modifying a parameter, why not generate a structural family instead of a generic model? I don’t see where/how you are generating the generic model family in the code below, but converting your .rft from a Generic Model class to a structural category of some sort should work. If not you can look at modifying the rft to have the rebar hosting already set before you make the family which seems to work for me in a test using the UI.
It’s doable, but it would be dumb to do it as such.
Automation is faster than doing things via the UI, but if you only ever have to do something once and then just refer to it 10,000 times, don’t automate it as you are adding extra steps and processing time to the automation, slowing down the automation for everyone.
By manually processing it you not only reduce processing time, but you also ensure the QA is built into the process - after all the results of all this automation have to be manually reviewed.
I’ll look to post the automation results for educational purposes later tonight.
I agree with you when you say that it does not make sense to automate a task that is not often used. However, I am planning to create an Add-in tool that allows users to reinforce a tank. For this purpose, the Add-in will not work properly if, when the user is prompted to select an element to reinforce, a message appears indicating that the element is not a valid rebar host !!
I would like to address the issue at its source by implementing a structural element that prevents this manipulation, but I’m struggling with how I can achieve it.
By starting with a structural family template you should be all set. Since the default structural family template doesn’t work, I recommend building your own as I outlined above.