Monday, February 23, 2009
Parameter.Set - Unexpected Behaviour
This is something I ran into today working on a Revit API External Command. The program I was trying to make, involves changing the 'Mark' parameter on beams/columns. I was using the Parameter.Set(string) boolean, which returns true if the parameter was set successfully to the new value, otherwise false. I decided to use the T/F value to determine if it had been successful or not, before incrementing a certain value. It turns out however, that the Set method only returns True if it has been set to a new value. So if you assign the same value that was already in the mark, it returns false! So my program was thinking that the method had failed, when really, it just had set the same value as was already there. So keep in mind that if you are going to use the T/F value of this method, make sure you also compare the value which you are setting, with the current value of the parameter.
Labels: API, Parameters, Revit
Subscribe to: Post Comments (Atom)
Post a Comment