revitpythonshell

IronPython WPF withe RevitPythonShell

一笑奈何 提交于 2019-12-06 03:25:34
I've written this script based on the snippets I found here on stackoverflow but get this error at runtime: System.InvalidOperationException: Cannot create more than one System.Windows.Application instance in the same AppDomain. I know it's got something to do with the fact that the last statement is creating a new Application instance within the same AppDomain but I don't know how to fix this. Here is the script: clr.AddReference('PresentationCore') clr.AddReference("PresentationFramework") clr.AddReference('Microsoft.Dynamic') clr.AddReference('Microsoft.Scripting') clr.AddReference('System'

Accessing Revit API from outside Revit

最后都变了- 提交于 2019-12-05 12:12:23
I've used RevitPythonShell and Dynamo, but would like to use my existing Python IDE (Eclipse) where I have my configuration for logging, debugging, GitHub integration, etc. I'm comfortable with transactions and the overall API, and I've invested some time in reading about the Revit API and modeless connections, and others asking similar questions. Some of them are a few years old. Is it currently possible to interact with Revit from Python executed outside Revit? For example, I've tried; import clr clr.AddReference(r'C:\Program Files\Autodesk\Revit 2016\RevitAPI') import Autodesk.Revit.DB as

Coding with Revit API: tips to reduce memory use?

半腔热情 提交于 2019-12-04 15:14:20
I have a quite 'general' question. I am developing with Revit API (with python), and I am sometimes observing that the Revit session gets slower during my tests and trials (the longer Revit stays open, the more it seems to happen). It's not getting to the point where it would be really problematic, but it made me think about it anyway.. So, since I have no programming background, I am pretty sure that my code is filled with really 'unorthodox' things that could be far better. Would there be some basic 'tips and tricks' that I could follow (I mean, related to the Revit API) to help the speed of

Revit Python Pick Object / Select Object

爷,独闯天下 提交于 2019-12-01 13:10:42
I'm fairly new to coding, so this might be obvious. Why do I get an error "name 'ObjectType' not defined" when I run this code: picked = uidoc.Selection.PickObject(ObjectType.Element) I'm using revit python shell (IronPython) You should import ObjectType into the current scope: >>> from Autodesk.Revit.UI.Selection import ObjectType >>> picked = uidoc.Selection.PickObject(ObjectType.Element) I have just tried this out in the RevitPythonShell and have noticed, that it doesn't work, because the shell is still in the foreground. So, this technique will work for scripts that you add to the Ribbon,

Revit Python Pick Object / Select Object

无人久伴 提交于 2019-12-01 10:11:45
问题 I'm fairly new to coding, so this might be obvious. Why do I get an error "name 'ObjectType' not defined" when I run this code: picked = uidoc.Selection.PickObject(ObjectType.Element) I'm using revit python shell (IronPython) 回答1: You should import ObjectType into the current scope: >>> from Autodesk.Revit.UI.Selection import ObjectType >>> picked = uidoc.Selection.PickObject(ObjectType.Element) I have just tried this out in the RevitPythonShell and have noticed, that it doesn't work, because