revitpythonshell

How to access all the family types through revit API?

泄露秘密 提交于 2021-02-08 04:13:59
问题 Is it possible to access all the family types of a certain category (e.g. Windows, Doors, ...) with Revit API? In contrast with the instances. For what I know, using FilteredElementCollector(doc).OfCategory(...).ToElements() or FilteredElementCollector(doc).OfClass(...).ToElements() point to the instances of that class/type, but I want to check if a particular type is already loaded within Revit, even if it hasn't been instantiated yet. (I'm using pyRevit, Revit 2017) Thanks a lot! 回答1: In

How to access all the family types through revit API?

孤者浪人 提交于 2021-02-08 04:12:15
问题 Is it possible to access all the family types of a certain category (e.g. Windows, Doors, ...) with Revit API? In contrast with the instances. For what I know, using FilteredElementCollector(doc).OfCategory(...).ToElements() or FilteredElementCollector(doc).OfClass(...).ToElements() point to the instances of that class/type, but I want to check if a particular type is already loaded within Revit, even if it hasn't been instantiated yet. (I'm using pyRevit, Revit 2017) Thanks a lot! 回答1: In

Starting a transaction from an external application running outside of API context is not allowed

江枫思渺然 提交于 2020-01-25 12:35:20
问题 Starting a transaction from an external application running outside of API context is not allowed. cannot start transaction. 回答1: Using my magic psychic crystal ball to guess you are asking how to avoid getting this error message in your Revit / RPS plugins, here is a short bit of extra information: all Revit API calls should happen inside the "API context" this "API context" lives in a special thread you are probably accessing the API from another thread this often happens when you make a

Revit: Modifying is forbidden because the document has no open transaction

梦想的初衷 提交于 2019-12-25 08:48:10
问题 Modifying is forbidden because the document has no open transaction. The document has no open transaction. In Revit Document. 回答1: You have 2 options: change the TransactionMode to Automatic at the class attribute [Transaction(TransactionMode.Automatic)] open a transaction within your command Transaction tr = new Transaction(commandData.Application.ActiveUIDocument.Document); tr.Start("Command name here"); // your code tr.Commit(); 回答2: Since you tagged this as revitpythonshell : try:

Python Code-While loop never end

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-25 08:05:46
问题 I am new to Python.Trying to learn it. This is my Code: import sys my_int=raw_input("How many integers?") try: my_int=int(my_int) except ValueError: ("You must enter an integer") ints=list() count=0 while count<my_int: new_int=raw_input("Please enter integer{0}:".format(count+1)) isint=False try: new_int=int(new_int) except: print("You must enter an integer") if isint==True: ints.append(new_int) count+=1 The code is executing but the loop is always repeating and is not allowing me to enter

IronPython WPF withe RevitPythonShell

筅森魡賤 提交于 2019-12-22 09:48:21
问题 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")

Specify the specific heat of a material with Revit 2017 Python API

柔情痞子 提交于 2019-12-12 02:34:22
问题 With Revit 2017 Python API, I am trying to create new materials, and then assembling some of these to create new type of walls. It goes pretty well for all properties, except for the specific heat! Basically, what I do is: create a thermalAsset: themalA = ThermalAsset('Test', ThermalMaterialType.Solid) Set the different thermal properties for that thermal asset (dummy values): thermalA.ThermalConductivity = 0.01 thermalA.SpecificHeat = 0.001 thermalA.Density = 1000.0 Then I create a

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

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;

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