PDA

View Full Version : Yes/No


r.vetrano
2005-09-11, 04:18 AM
Hi
Have column base plate. Have a Yes/No parameter "Anchor bolts". If I uncheck in properties it will turn off the visibility of the anchor bolts. Created a form called "baseplate" with a checkbox. Can not get the Checkbox to trigger the parameter. Baseplate name is BP1-4 Bolts.

Public Function ChangeBasePlateParam(ByVal elem As Revit.Element)
'
Dim params As Revit.ParameterSet = elem.Parameters
Dim Parameter As Autodesk.Revit.Parameter
Dim ParamElem As Double
Dim ParamQty As Integer
Dim ParamStr As String
For Each Parameter In params

If (Parameter.Definition.Name = "H Width") Then
ParamElem = Val(baseplate.PltHorzWidthBox.Text)
Parameter.Set(ParamElem)
End If
If (Parameter.Definition.Name = "V Width") Then
ParamElem = Val(baseplate.PltVWidthBox.Text)
Parameter.Set(ParamElem)
End If

If (Parameter.Definition.Name = "Anchor bolts") Then
If baseplate.AnchorChkBox.Checked = True Then

Else

End If
End If
Next
End Function


Other parameters work fine.

Thanks
bob v

Danny Polkinhorn
2005-09-11, 05:26 AM
Bob,

There's a couple things to check. First, you need a sub not a function. Functions return values and you don't need to return anything. Second, you're missing code from the "If baseplate.AnchorChkBox.Checked = True Then" section. You're not actually changing anything. Also, I would suggest a Select Case...End Select structure instead of the series of If..Then statements. You're code will run slightly faster.

Hope that helps,

r.vetrano
2005-09-11, 01:33 PM
Danny
Thought I did want to return a value for "Anchor bolts" which is the parameters name. Something like Anchor bolts.checked = true or Anchor bolts="Yes"

I didn't put anything after the "if" because everything I tried didn't work.

What triggers the checkbox in Yes/No? Is it a number 0 or 1, "Yes" "NO" or Checked,Unchecked?

Thanks for the CASE suggestion always looking for ways to speed things up.

bob v

Danny Polkinhorn
2005-09-15, 05:08 AM
What triggers the checkbox in Yes/No? Is it a number 0 or 1, "Yes" "NO" or Checked,Unchecked?Robert,

Sorry to get back late. Yes/No parameters are stored as integers so that's what you need to set it with:
parameter.Set(0) 'No
parameter.Set(1) 'Yes

Any other integer, like 7, will appear as though you haven't selected Yes or No (greyed out check box).

Hope that helps,

r.vetrano
2005-09-21, 01:36 PM
Danny
No apologies necessary. Thanks and I will give that a try.

bob v