Closed GoogleCodeExporter closed 9 years ago
I can reproduce this. I am looking into it right now.
Original comment by dthomas.ch
on 13 Nov 2011 at 11:28
The following session in the interactive shell displays a hint at the problem:
>>> wallTypes = list(doc.WallTypes)
>>> wt = wallTypes[0]
>>> wt.Name
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: Name
>>> wt.get_Name
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'WallType' object has no attribute 'get_Name'
>>> wt.GetType().GetProperty('Name').GetGetMethod().Name
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'Name'
>>> wt.GetType().GetProperty('Name').GetSetMethod().Name
'set_Name'
>>>
It seems, there is no "getter" for the `Name` property. This is strange!
Original comment by dthomas.ch
on 13 Nov 2011 at 11:38
According to the RevitAPI 2012, this is correct behavior:
public override string Name { set; }
# (inherited from `ElementType`)
# Set the name for the ElementType.
# This method will assign the element type a new name.
Thus, `ElementType` overrides the `Element.Name` property. You can still access
it like this:
>>> wallTypes = list(doc.WallTypes)
>>> wt = wallTypes[0]
>>> Element.Name.__get__(wt)
'STB 30.0'
>>>
This tells IronPython to use the *getter* of the `Name` property of the
`Element` type on the object `wt`. It *is* a bit cumbersome, but not really a
bug (at least not in RPS, it might be considered a bug in IronPython, but I
think it is OK)!
Original comment by dthomas.ch
on 13 Nov 2011 at 11:49
WallType.Name
returns error
Original issue reported on code.google.com by
yssh...@gmail.com
on 13 Oct 2011 at 10:31