Nonmodal RPS window

84 views
Skip to first unread message

Ehsan Iran Nejad

unread,
Jul 13, 2014, 10:03:36 PM7/13/14
to revitpyt...@googlegroups.com
I'm new to the RPS. Does anyone know how to make the prompt window NON-modal so I can work with Revit and use the prompt at the same time??

Thanks

Daren Thomas

unread,
Aug 4, 2014, 4:48:17 AM8/4/14
to revitpyt...@googlegroups.com
This is slightly tricky, since you can only really use the Revit API at special times - check through Jeremy Tammiks discussions on non-modal windows for an idea of what is going on.

Basically, you could just create a script like this:

import code
code
.interact(None, None,
       
{
           
'__name__': '__console__',
           
'__doc__':None,
           
'__revit__': __revit__
       
})


That should open a non-modal output window that you can enter code in - but it won't be the nice interactive shell with code completion and syntax highlighting you get when you open the regular shell. Also, expect things to crash because you can't call the API directly.

There are some things that could be done about this. I have been wondering for quite a while if it is worth the effort to investigate this... So far, I'm not convinced.

Best,
Daren
Message has been deleted

Ehsan Iran Nejad

unread,
Aug 10, 2014, 2:52:57 PM8/10/14
to revitpyt...@googlegroups.com
Thanks for the response. It's be amazing if we can have a iron-python-based GUI console (similar to dreampie) communicating with Revit API. Although I understand that the inner working of the API are the main issue.

Thanks again

Ehsan Iran Nejad

unread,
Aug 19, 2014, 12:28:01 AM8/19/14
to revitpyt...@googlegroups.com
Daren,
When I change the gui.ShowDialog(); to gui.Show(); and compile, it gives me a perfectly nonmodal console!. The problem is that somehow it's on a separate process from Revit(?) and revit does not allow any transactions. But searching and filtering and data collection works as far as I have tested.

is there a way to create an external event handler (as described in nonmodal SDK examples) to run the code as an external event?? say the console checks the code and if it contains a transaction it uses a different method to run the code?? 

or somehow have the python engine under Revit connect to the GUI console through a random socket and communicate? (This is the way DreamPie (a powerful interactive python console) works. It runs itself on python27 and then calls the python engine it's supposed to work on as a subprocess and connects to it via a random port and socket. This way it connects to almost any type of python.

I'm sorry that I'm asking too many questions but I just don't have enough programming knowledge to make this happen. Having a nonmodal python console is really helpful for me on a daily basis to be able to interact with Revit intuitively and use my own pyRevit library to get/set data in Revit. It'll be my unfiltered eyes into Revit model.

Apologies again. You're the only one I know that can help.
Thanks!

Daren Thomas

unread,
Aug 22, 2014, 5:13:31 AM8/22/14
to revitpyt...@googlegroups.com
ehsan,

i'm working on a non-modal version right now. but i must tell you: it is difficult and buggy and i'm not sure it is really going to work.

i do see how it would be awesome, though!

one point that can't be fixed: in the interactive shell, starting a transaction, typing some lines and then committing the transaction won't work, because i need to roundtrip each statement through the revit api context - and that resets any transactions! so if i do get it up and running, then you'll have to do transactions in the code pane below, you know, the one where you can write some code and then run it all at once...

i'll send you a test-version as soon as i have one, but must finish other projects first.

best,
daren


--
You received this message because you are subscribed to the Google Groups "RevitPythonShell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to revitpythonshe...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ehsan Iran Nejad

unread,
Aug 27, 2014, 2:57:30 AM8/27/14
to revitpyt...@googlegroups.com
You're the best. Thanks for giving us such an amazing tool to work with. Writing a piece of python script to show Revit who's the boss is highlight of my day! Haha.

Daren Thomas

unread,
Aug 27, 2014, 7:40:51 AM8/27/14
to revitpyt...@googlegroups.com
Ehsan,


This installs the latest (unpublished) version of RPS with a new button "Non-modal Shell", below the normal "Interactive Python Shell" button. I'd really like to hear how this works for you. Some points:

- the shell window is set to stay on top of all other windows. You can turn this off with "__window__.Topmost = False"
- transactions only work in the IronPython pad (the bottom half of the shell's screen) - this is due to limitations in Revit

Best,
Daren


On Wed, Aug 27, 2014 at 8:57 AM, Ehsan Iran Nejad <eiran...@gmail.com> wrote:
You're the best. Thanks for giving us such an amazing tool to work with. Writing a piece of python script to show Revit who's the boss is highlight of my day! Haha.
Reply all
Reply to author
Forward
0 new messages