Made a shinny new development toy, I though it might be useful to a few of you;
allows you to launch an interactive console from a breakpoint anywhere in your python code.
Hi @Racel_Williams. Sorry I missed your second msg. I don’t really know C# well enough to be able to contribute to Core at this time, but anyone is more than welcome to borrow from this and create better implementations.
A few people asked me for clarification on how to use the Console, so I am adding more details below:
How to use RPW’s Console to debug python code:
1. Install RevitPythonWrapper (rpw) through the package manager
Note: Note that rpw package ships with a GettingStarted.dyn you can use to familiarize yourself with how it’s used withing Dynamo.
2. Build the graph below using RPW_GetFilePath and python node.
import sys
sys.path.append(IN[0]) # Assumes RPW_GetFilePath output is IN[0]
from rpw.ui.forms import Console
for i in range(10):
if i ==5:
Console(context=locals())
import sys
sys.path.append(IN[0]) # Assumes RPW_GetFilePath output is IN[0]
from rpw.ui.forms import Console
for i in range(10):
if i ==5:
Console(context=locals())
I can’t reproduce this error here, so I will need someone who is having this problem to help us find the issue.
Here the source code of the GetFilePath node.
For some reason its not finding the file Path for the rpw library.
It assumes somewhere within ‘appdata/Dynamo’ it can find a folder called ‘RevitPythonWrapper’. The folder should be created when the package is installed:
import clr
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import os
appdata_path = os.getenv('appdata')
dynamo_path = os.path.join(appdata_path, 'Dynamo')
module_path = None
for root, subfolders, files in os.walk(dynamo_path):
if 'RevitPythonWrapper' in subfolders:
extra_path = os.path.join(root, 'RevitPythonWrapper', 'extra')
module_path = os.path.join(extra_path, 'rpw.zip')
I assume that’s only if you use the default Dynamo location? If i store my packages in a different location I’ll probably have to change the path, correct?
EDIT: Yup, that’s it! I moved the package to the default location and it worked fine.