Skip to content

Commit

Permalink
fix(parameter): fix wrong parameter type in set method
Browse files Browse the repository at this point in the history
  • Loading branch information
marcantondahmen committed Jul 29, 2021
1 parent 921a0d9 commit 31630e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion revitron/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def isType(self):
or className == 'BrowserOrganization' or className == 'TilePattern'
)

def set(self, paramName, value, paramType='Text'):
def set(self, paramName, value, paramType=False):
"""
Sets a parameter value.
Expand Down
14 changes: 8 additions & 6 deletions revitron/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def getElementId(self):
return self.parameter.AsElementId()
return 0

def set(self, value, paramType='Text'):
def set(self, value, paramType=False):
"""
Set a parameter value for an element. The parameter will be automatically created if not existing.
The parameter type can be specified. If not type is given, it will be determined automatically in
Expand Down Expand Up @@ -275,14 +275,16 @@ def set(self, value, paramType='Text'):
Args:
value (string): The value
paramType (string, optional): The `parameter type <https://www.revitapidocs.com/2019/f38d847e-207f-b59a-3bd6-ebea80d5be63.htm>`_. Defaults to "Text".
paramType (string, optional): The `parameter type <https://www.revitapidocs.com/2019/f38d847e-207f-b59a-3bd6-ebea80d5be63.htm>`_
"""
if not self.name:
return False
if isinstance(value, numbers.Integral):
paramType = 'Integer'
if isinstance(value, float):
paramType = 'Number'
if not paramType:
paramType = 'Text'
if isinstance(value, numbers.Integral):
paramType = 'Integer'
if isinstance(value, float):
paramType = 'Number'
if self.parameter == None:
from revitron import _
if Parameter.bind(
Expand Down

0 comments on commit 31630e5

Please sign in to comment.