RFA Version and Context, Grey Commands, RDB Link

Here are some recent issues that cropped up in case queries and other information:

  1. RFA file version.
  2. Greyed out commands in the ribbon.
  3. Project versus Family editor context.
  4. RDB Link Tool for Revit Family.

1. RFA file version

Question:
When loading an RFA file, i.e. through LoadFamily, is there any way to know the Revit version that was used to create it, or at least to know that this RFA file has been converted to the current Revit version format?

Answer:
I am not aware of any Revit API methods for determining the Revit version used to create or last save an RFA file.
However, I did implement and discuss a stand-alone command line utility

rvtver.py

to extract the Revit version information from a project file.
I just tested rvtver.py on an RFA file.
I selected the door family M_Single-Flush.rfa from the folder
‘C:Documents and SettingsAll UsersApplication DataAutodeskRAC 2010Metric LibraryDoors’.
Running rvtver.py on that file reports


> rvtver.py M_Single-Flush.rfa
Build string found in 'M_Single-Flush.rfa'
at offset 16470: Build: 20090224_0900

The

post on rvtver.py

explains some of the background on the file structure.
If you look at the RFA file in a binary or hexadecimal editor, you may be able to glean further information.

2. Greyed out commands in the ribbon

Question:
In Revit 2010, what are the reasons for commands being disabled?
My commands are active when I switch to family template or family file.
In previous versions, external commands were greyed out in 3D view and family editor mode.
What could be the reasons in this case?

I’ve created some external commands and they appear in the menu.
The commands are disabled, i.e. greyed out, until I open a family template or family file.
Opening a new existing project does not enable the commands as it should.
What might I check as possible causes of the problem?
Note that if I open a family template or file, the commands are enabled and I can execute them.

Answer:
One possible reason is that the focus is not in the current view.
For example, after left clicking an item in project browser, for instance plan view, the external command item is grey.
You need to click any place in the region of the current view to make them active.
Other reasons why they might be greyed out are:

  • You are in a tool other than the main selection tool.
  • You are in a perspective view.
  • You are in a schedule view.

None of these modes permit API commands to run at this time.

3. Project versus Family editor context

Question:
My command works well when it is executed from within a project but not when executed from the family editor.
Is there any way to know if the command is being executed from the family editor or from a project context?
In any case, how can I obtain the Family object of the current family in the family editor?

Answer:
You can check if the current document is a Family document using the Document.IsFamilyDocument property. The owner family is accessible through Document.OwnerFamily.

Please have a look at the family creation samples in the FamilyCreation subdirectory of the Revit SDK samples folder. The most comprehensive of these in the WindowWizard sample.

Thanks to Adam Nagy for handling this case.

4. RDB Link Tool for Revit Family

A brand new

RDB Link Tool for Revit Family

is now available on

Autodesk Labs
.
In case you are interested, please check it out.


Comments

7 responses to “RFA Version and Context, Grey Commands, RDB Link”

  1. I have a question about grayed out commands. I am looking at my first application to create a family and was looking at the DWG family creation sample. This sample is set up to check to make sure the active document is a family document. However, when I go into Revit and create a family document, all the external commands are grayed out and I can’t get to them. I have tried all modes and none seem to work. How do you run an external command from the family editor?

  2. Dear Steve,
    I do nothing special at all to run a command in the family editor. Just create a new or open an existing family document and activate the Add-Ins panel. If the commands were greyed out, which they never are, I think, I might select some element in the current view and then hit escape a few times or something like that.
    Cheers, Jeremy.

  3. Nevermind, I should have mentioned that I was trying in 2009. After more investigation I don’t think 2009 is capable of working with family documents, correct? I tried it in 2010 and it works fine…
    thanks,
    Steve

  4. Dear Steve,
    Haha, 2009. Never mind indeed. Yes, you should have mentioned that. As you say, there is no API support whatsoever in the family editor context in Revit 2009.
    Cheers, Jeremy.

  5. some facts I found about “grayed out external commands”
    in revit 2010, the problem occured to me today, i searched half day , I reinstalled Revit 2010, (solved temporarily the problem), then it came back after using my commands. compared the content of the registry when there was no problem, and when the external commands are greyed out. I do debug my dll, then sometimes i force quit revit because i found what i was after. The thing is, revit2009 worked great with this, but 2010 do not seem to apppreciate those manners.
    the solution for me was in the windows registry.
    the “HKEY_USER …. Software\Autodesk\Revit\Autodesk Revit Architecture 2010...\Repository\Statistics\CleanClose key” is greying out the external commands when it’s value is different from 0xC (mine was 0x5)
    when changing it’s value you can correct this otherwise it seems stuck greyed out forever.

  6. Dear Jean-François,
    Thank you very much for this interesting information. Strangely enough, I have never run into this problem, even though I do start Revit from the Visual Studio debugger all the time, and just stop debugging at any time I like, so Revit almost never gets a chance to shut down properly. Still the problem does not occur. But it will certainly be extremely useful to have this information provided by you if I should run into the problem some day. Thank you!
    Cheers, Jeremy.

  7. Great post here. Useufl information to help people who are new to this software too.

Leave a Reply to Jeremy TammikCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading