Set a Type parameter in a loadable family

Set a Type parameter in a loadable family

Anonymous
Not applicable
1,806 Views
1 Reply
Message 1 of 2

Set a Type parameter in a loadable family

Anonymous
Not applicable

Hi everybody !

 

I'm actually trying to set type parameter value in my Revit API. This parameters are declared as shared paramter.

I try something but it only able to change instance paramter...

 

 ' Get the handle of current document.
            Dim uidoc As UIDocument = commandData.Application.ActiveUIDocument
            Dim doc As Document = uidoc.Document

            ' Get the element selection of current document.
            Dim selection As Selection = uidoc.Selection
            Dim selectedIds As ICollection(Of ElementId) = uidoc.Selection.GetElementIds()

           
                For Each id As ElementId In selectedIds
                    Dim e As Element = uidoc.Document.GetElement(id)
                    Using y As New Transaction(doc, "Rens R")

                        If y.Start = TransactionStatus.Started Then
                            'SD1
                            Dim Rparam1 As String = "Name_Of_Parameter"
                            Dim Ridparam1 As IList(Of Parameter) = e.GetParameters(Rparam1)
                            Dim Rparamvalue1 As Parameter = Ridparam1.First
                            Rparamvalue1.Set(GlobalVariables.Param_Value)



                        y.Commit()

                    End Using
                Next

 

 

 

I almost sure that it's possible because i realised it with dynamo in Revit and it works.

settype-parameter.png

 

Thank you for you precious help.

 

Best regards,

 

Yves

0 Likes
1,807 Views
1 Reply
Reply (1)
Message 2 of 2

jeremytammik
Autodesk
Autodesk

Dear Yves,

 

The type paramter lives in the type, not the instance element.

 

Use the Element.GetTypeId method to access the type and modify the parameter on that.

 

Cheers,

 

Jeremy



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