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.



Tuesday, 20 January 2009

Checking your displayed units

To find out what units your document is displaying you can use this:

Document.DisplayUnitSystem

This will return zero for metric, and 1 for imperial. It would be handy (for me at least) for this to be changeable through the API, but unfortunately its a readonly property.

I had a bit of a play with my unit settings (Settings > Project Units) to clarify how this property behaves, and confirmed that if I make Area and Volume imperial but leave Length metric, then we still have a metric '0' setting. This is what I was expecting, but I had to make sure!

Monday, 5 January 2009

Revit failing to load - 0xc06d007e

I'm posting this to help anyone who might have the same rather strange problem. On my machine at home Revit would fail to load if I tried to add any External Command. All my syntax and naming was correct, all files were present and correct, but Revit would still silently fall over when booting up, without an error message. If I changed the ECCount back to zero then it would boot up fine.

Looking at the journal files (C:\Program Files\Revit Architecture 2009\Journals) for the load failure revealed the following:

Exception occurred
ExceptionCode=0xc06d007e ExceptionFlags=0x00000000 ExceptionAddress=7C812AEB


I sought help from Autodesk but they were stumped too, and a long support ticket ended in an internal change request being submitted which I thought was a little odd as if they fail to diagnose a problem how do they know what to change?

I was left with my home machine unable to run any EC's, and this was the status for several weeks until I looked into the issue again. I discovered that on another machine that was working fine if I removed RevitAPI.dll from the Program folder then started Revit I could replicate the same behaviour - silent load failure and exactly the same entry in the journal file.

So I went back to my home machine and renamed RevitAPI.dll to RevitAPI.old (the same as removing it), started Revit (it failed as expected), then renamed it back again to its proper name, started Revit again, and now it works fine.

I have no idea why this works or what was wrong in the first place. But if you have the same problem hopefully your google search will point you this way and your problem will take minutes to solve rather than weeks!