revit-api

ImportError: No module named wpf (in Revit environment only) - User interface

℡╲_俬逩灬. 提交于 2019-12-11 06:45:32
问题 I'm able to make a simple working UI on VS launched with ipy interpreter but when I try to launch it in Revit environment (revit python shell or macro), I got the following error : ImportError: No module named wpf wpf is a built-in module, so I don't think I forgot any reference or pythonpath. I checked both sys.version (idea from a post on stackoverflow): import sys print sys.version and got the same result on revitpythonshell and Ironpython console : 2.7.4 (IronPython 2.7.4 (2.7.0.40) on

Revit: Set type parameter in linked models

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 05:52:14
问题 Our Revit Add-In lets the user browse and set type parameters, including those in linked models. It worked fine in Revit 2011 and earlier, but in Revit 2012 and 2013 we can no longer set these. When constructing the transaction on the linked document I get: "Autodesk.Revit.Exceptions.ArguementException: Document is a linked file. Transactions can only be used in primary documents (projects or families.)" OK, so we can't use transactions on linked models. So I tried setting the parameter

Revit API: How to create Element Keynote for a wall and Material Keynote?

天涯浪子 提交于 2019-12-11 01:49:50
问题 I'm trying to create Element Keynote for a wall and Material Keynote for it's materials (to make it like in this image bit I'm completely stuck with it. I tried to create a tag how it was shown in this blog post: http://thebuildingcoder.typepad.com/blog/2010/06/set-tag-type.html But I can't change a keynote tag to OST_KeynoteTags and to associate it with wall or material: FamilySymbol keynoteTagType = GetFirstFamilySymbol(doc, BuiltInCategory.OST_KeynoteTags); IndependentTag newTag = doc

revitapi ironpython ToRoom returns “indexer # object”

一曲冷凌霜 提交于 2019-12-10 22:46:20
问题 in revit api i am trying to access the ToRoom / FromRoom properties for doors. the simplified code snippet in ironpython: fc = FilteredElementCollector(doc) doors = fc.OfCategory(BuiltInCategory.OST_Doors).WhereElementIsNotElementType().ToElements() for door in doors: froom = door.FromRoom my result is an "indexer # object at 0x0000000000035" how can i access the room object from here? 回答1: This is an IronPython / funky Revit API issue. Basically, the way FromRoom is defined, it can be either

Accessing Revit API from outside Revit

元气小坏坏 提交于 2019-12-10 09:36:22
问题 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;

Revit API - Possible NewtonSoft.Json conflict

爷,独闯天下 提交于 2019-12-08 12:47:28
I'm trying to create an extension that goes to the cloud and retrieve data, simple request. It works flawless when using the Add-In Manager, but when I distribute to other users, there seems to be a conflict with the version of the NewtonSoft.Json I'm using (7.0.1) and the version I found in Revit Program Files (5.0.8). Full error message is: [Window Title] Command Failure for External Command [Main Instruction] Revit could not complete the external command. Contact the provider for assistance. Information they provided to Revit about their identity: icubY. [Expanded Information] Revit

Coding with Revit API: tips to reduce memory use?

江枫思渺然 提交于 2019-12-06 11:33:44
问题 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

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