Modified Type Parameters

Hi !

I’m new dynamo user and i easily succes to do something i didn’t arrive with vb net API. I would like to do this actions :

I get a specific type by selection and then automatically asign the value 66 to the shared type parameter “SD1”. I would like to do it with vb net /c # but i failed at the first step : get the type by visual selection.

Can you help me ?

I just arrived to change instance parameter value with that :

 

’ Select some elements in Revit before invoking this command

’ Get the handle of current document.

Dim uidoc AsUIDocument = commandData.Application.ActiveUIDocument

Dim doc AsDocument = uidoc.Document

’ Get the element selection of current document.

Dim selection AsSelection = uidoc.Selection

Dim selectedIds AsICollection(OfElementId) = uidoc.Selection.GetElementIds()

If 0 = selectedIds.Count Then

’ If no elements selected.

TaskDialog.Show(“Revit”, “You haven’t selected any elements.”)

Else

Dim info As[String] = "Ids of selected elements in the document are: "

Dim vbLf AsDouble

Dim vbTab AsDouble

ForEach id AsElementIdIn selectedIds

Dim e AsElement = uidoc.Document.GetElement(id)

Using y AsNewTransaction(doc, “Rens SD”)

If y.Start = TransactionStatus.Started Then

Dim RYparam AsString = “SD1”

Dim RYidparam AsIList(OfParameter) = e.GetParameters(RYparam)

Dim RYparamvalue AsParameter = RYidparam.First

RYparamvalue.Set(“66”)

EndIf

y.Commit()

EndUsing

'info += vbLf & vbTab + id.IntegerValue

Next

 

 

Thanks Sylvain