Are there Immutable Family Type Parameters?

Are there Immutable Family Type Parameters?

Ryan_Daley
Participant Participant
258 Views
2 Replies
Message 1 of 3

Are there Immutable Family Type Parameters?

Ryan_Daley
Participant
Participant

I'm curious if there is a way to create immutable(unchangeable) Family Type Parameters from the API or otherwise.  I don't want the end user to be able to change the parameter. 

 

If the user downloads the .rfa file from my database, I want certain parameters to stay immutable.  Namely, I want to have my own GUID on the Family Type.  In this way, if the user clicks on a Family Instance, I could see if it is one of my Families.  I would check my immutable Ryan's Guid Parameter, and from there I can figure out which Family Type they downloaded from my database.   

0 Likes
259 Views
2 Replies
Replies (2)
Message 2 of 3

jeremy_tammik
Alumni
Alumni

There is no absolute protection, if that is what you are after. Immutable data can be attached to any Revit element by adding extensible storage data to it and restricting access to the creating application only. Check this out:

  

https://thebuildingcoder.typepad.com/blog/2018/09/protecting-a-family-from-tampering.html

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 3

Mohamed_Arshad
Advisor
Advisor

Hi @Ryan_Daley  

 

 Yes you can create a Immutable parameter in Share Parameter, While creating a Shared parameter set the user-Modifiable to false. Kindly check the below code for additional Reference

 

 //Create SharedParameter
            //You can use these in Family Template
            app.SharedParametersFilename = path;
            DefinitionFile defFile = app.OpenSharedParameterFile();
            DefinitionGroup group = defFile.Groups.Create("Demo Locking");
            ExternalDefinitionCreationOptions opt = new ExternalDefinitionCreationOptions("Content_Lock", ParameterType.Text);

            //Parameter Locking
            opt.UserModifiable = false;
            Definition def = group.Definitions.Create(opt);

 

Hope this will helps 🙂

 


Mohamed Arshad K
Software Developer (CAD & BIM)