Modify Key Source Parameter

Modify Key Source Parameter

Anonymous
Not applicable
2,111 Views
3 Replies
Message 1 of 4

Modify Key Source Parameter

Anonymous
Not applicable

Hello,

 

I'm new to C# and the Revit API.  My question is about modifying the value of the "Key Source" parameter (KEY_SOURCE_PARAM) for Keynote Tags.

 

Basically what happened is we were using Material Keynotes, but then something came up and now a decision has been made that we should switch to using Element Keynotes instead.  We have a workaround for this, but I thought this would be a good opportunity to learn a bit of C#.  I've tried modifying the parameter using Dynamo and Python but it's saying that the parameter is read only.

 

It seems like it's the same for C#, but I just wanted to throw this out there in case someone might know of a way to modify this parameter.

 

Attached is the code I used to try to modify the parameter + the manifest file for the add-in.  (Won't let me upload the manifest so i'll put it at the bottom of this post)

 

I was also using RevitLookup to check out the parameters and saw the "AsString" Method of the Key Source parameter.  I am looking into this right now to see if it's something I can modify somehow. (Image attached)

 

I saw on a Dynamo forum saying that if it can't be done through the UI then it probably can't be done by code - hoping this could be the exception to that.

 

Thanks for any advice/direction on this.

 

Manifest:

<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Name>KeynoteTagRehost</Name>
<FullClassName>KeynoteTagRehost.Class1</FullClassName>
<Text>KeynoteTagRehost</Text>
<Description>Keynote Rehoster Test</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<Assembly>C:\Users\rquiambao\source\repos\KeynoteTagRehost\KeynoteTagRehost\bin\Debug\KeynoteTagRehost.dll</Assembly>
<AddInId>7c1d4806-96ea-44d7-ad0c-72e0b175aad1</AddInId>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, Inc, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>

0 Likes
Accepted solutions (1)
2,112 Views
3 Replies
Replies (3)
Message 2 of 4

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @Anonymous ,

 

In API, if the parameter is read-only, you can get the value of parameter but you can't set the value to the parameter.

 

In API, If the Parameter's User-modifiable value is true, it indicates that the interactive user can modify the value of this parameter.

(i.e)Via UI the value can be modified.

 

In your case, I think Key source parameter is read-only and user-modifiable.

(i.e)the value cannot be changed via API but can be changed via UI.

 

I hope this helps.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 4

Anonymous
Not applicable

Thanks for the clarification Naveen!

0 Likes
Message 4 of 4

echeverrimontes
Explorer
Explorer

Naveen, thank you for the explanation. That means that in the case of Area Type for areas I can't set the BuiltInParameter.OST_Area_Type which is readonly through the API, and therefore I can only change it throuhg the menu in Revit by selecting each area and selecting from the dropdown? Thank you very much,

Paula Echeverri Montes

0 Likes