Wednesday, 28 January 2009

instance.name and families with no types

I was using instance.name to establish whether users had placed a particular detail component or not, but discovered I'd made an assumption that that turned out to be incorrect, because I based my coding conditions on research with typeless families only.

Take the 'Dbl Tri Wall tie -Section' for instance (Metric Library\Detail Components\F - Masonry\F30). On inspection, this is a family with no types. Click 'Family Types' in the Family Editor and you'll see in the dialog that 'Name' is greyed out unless you add a type.



Compare this with  'C Joist - Section' (Imperial Library\Detail Components\Div 05-Metals\054200-Cold-Formed Metal Joist Framing), and you'll see there's lots of types, all named by their size, and all with the same parameters with different values.



When you use these elements in your model, and look at the element properties, you'll see that the family with types (the C Joist) populates the 'Type' field with the type name:



But the family with no types (the wall tie) just uses the family name again:



It is this that is returned by instance.name. When my code came across an instance of an element with types, and was expecting to see the family name, it didn't, and made the wrong decision. A few mods later and it was fine.

Note to self: do more research before making assumptions.



No comments:

Post a Comment

Comments are moderated, so you'll have to wait a little bit before they appear!