« Harvard Energy Model Survey | Main | External Command Replay »

July 13, 2009

Comments

Hi jeremy.
Once again, nice post.
Concerning Repeating Last Command, I can put a result of my research (thx to you). This is a video where you can see that I can repeat the last command (for the moment, only commands wich are in KeyBoardShortCuts. I use F4 to repeat last one.
Works on RAC2009..not yet in 2010

http://www.box.net/shared/t0bdghsxln

Cheers!

Dear Pierre,

Thanks for the appreciation, glad you like it!

Thank you also very much for the info on using the F4 key to repeat the last command.

I looked at your video, it looks impressively efficient.

I am really looking forward to a solution to send keystrokes or shortcut keys to Revit 2010.

Cheers, Jeremy.

Hi jereremy,

For helping you, you must know that I had problem with sending KeyStrokes to Revit Handle Application. I used "PostMessage" in USER32.DLL.

Have a nice Day.
Cheers!

Dear Pierre,

Thank you for the info, I saw the sample code on the discussion forum:

http://discussion.autodesk.com/forums/thread.jspa?messageID=6214765

If I ever have any spare time I would love to try it out with 2010.

I wish you a nice day too!

Cheers, Jeremy.

HI,

By the way, does the journals directory is the same with Revit2010. Cause, someone test my function in Revit2010 and had en error?

Cheers!
What time is it in the place you live?

Dear Pierre,

As far as I know, the journal file location is the same on all systems.

I live in Switzerland, with Central European Time CET, which is GMT+1.

Cheers, Jeremy.

Ok Jeremy, so, my windows error is not in opening myu journal. Anyway, I'll install 2010 environment to debug it.

An other stuff I'd like to tell you, I've noticed, that I've got problem of refreshing your page in FireFox. I've to refresh it 3 ou 4 times before it works..no problem with Ie.

So, you can speach french, don't you?
N'est-ce pas?

Cheers!

Cher Pierre,

Oui, je parle un peu français, mauvaisement. J'utilise aussi le FireFox sans aucun problème.

Cheers, Jeremy.

Dear Jeremy,
I am developping an application that should implement the OnDocumentOpened event when Revit starts Up.
It should retreive the links from the opened document and should get some data from inside the links and write these data into the opened document.
however, the OnstartUp takes a "ControlledApplication" as a parameter. I am not able to access the "Documents" from the "controlledApplication" instance.
Is there any way to access the "documents" or the "links" inside the opened document from the "ControlledApplication"?
or is there a way to cast or convert the "ControlledApplication" to an "Application"?

Dear Mira,

Basically, this is a very valid question which we have encountered a couple of times already in the past.

No, I am sorry to say that I do not know of any way to access the documents collection from the ControlledApplication instance, nor can you cast it to an Application instance.

Still, I do not quite see why this should be an issue for you?

In the OnStartup method, you can simply register to the DocumentOpened event. When the document is opened, this event is triggered and provides your application with a DocumentOpenedEventArgs instance, which provides the document that you need, doesn't it?

OnStartup is called at a point in time where no documents are yet open, so there are no links to analyse or document to update at that point.

Cheers, Jeremy.

Hi Jeremy,

Nice blog. Congratulation.
I'm really new in this field. Is it possible to develop application without start up Revit?
The idea is user just need to key in the name and location of the revit file and the application will read the file to extract the information from revit file and insert into database.

Thanks a lot.

Abidah

Dear Abidah,

Thank you.

Sorry, no, the Revit API is only accessible within a running Revit application, and only within the context of certain call-back methods:

http://thebuildingcoder.typepad.com/blog/2010/04/asynchronous-api-calls-and-idling.html

Cheers, Jeremy.

Thanks jeremy.

I read Revit 2011 Developer Guide and trying develop a sample code. Instead of using DocumentOpened I changed to DocumentSavedAs. It crash when I close Revit Software.
Is it any other way to debug why it crash(maybe using messagebox or try-catch)?

Thanks,
Abidah

Dear Abidah,

I use the Visual Studio debugger and set a breakpoint immediately before the problematic code, just as described in section 2.2.6 Debug the Add-in in the developer guide "Revit 2011 API Developer Guide.pdf". That always shows me exactly what is going on and is much more efficient than instrumenting the code with message boxes and stuff. Adding a top-level try-catch handler can also help, of course, but as soon as the exception has been thrown it takes you away from the problematic code location to the exception handler.

Cheers, Jeremy.

Jeremy, here you said:

[quote]
The argument provided to OnStartup is a ControlledApplication instance...It does not include access to the documents
[/quote]

Evidently it still does not include this access in Revit 2012. And my question is, why not?

I've spent quite a few hours trying to find a way around this. The journal file replay method is giving me the error one of your readers mentioned above, and I can think of no way to trace the cause. Also opening the file via command line, and triggering my OnDocumentOpened callback doesn't work, because my callback appears to get invoked *before* Revit grabs its floating license from the server (and um... why??) so it is unable to save the work it's done on the .rvt file opened. So I'm resorting to third-party window automation tools.

I'd like to request that your developers reconsider this design decision. As Rod Howarth notes in his project that tries to provide this functionality at https://github.com/RodH257/RevitRemoteBoot, it would be nice if Revit would make this sort of thing easier to do.

(And unfortunately, it looks like Howarth's approach may suffer from the same problem that my own attempt did; the floating license will not be checked out yet when OnDocumentOpened is invoked)

Dear Dave,

Are you an ADN member? If so, please submit a case for us to explore this in more detail. Otherwise, please ensure that your API wishes are properly logged, e.g. by AUGI or elsewhere. Thank you!

Cheers, Jeremy.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Your Information

(Name and email address are required. Email address will not be displayed with the comment.)

Jeremy Tammik

AboutTopicsIndexSource