revit-api

Creating a Roof function

天涯浪子 提交于 2020-02-06 03:37:49
问题 I'm having trouble to create a roof via code. I know how to create a stairs for example : I start a StairsEditScope and use CreateSketchedLanding with all the right parameters to create my stairs and just commit the StairsEditScope, but for a roof i cant find a clue on how to create it from scratch, any leads? 回答1: Revit provides different kinds of roofs. It is best to understand the various types from an end user point of view before starting to drive them programmatically. The simplest one

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

Same code to create parameters in Revit 2015 + 2016

浪尽此生 提交于 2020-01-06 20:05:02
问题 So the ExternalDefinitionCreationOptions had a spelling error in the Revit 2015 API that was corrected in the 2016 API. I try to make my app as compatible as possible with the current version + previous, but this time I'm not even able to compile it since I can only reference one of the two API DLL's, and the ExternalDefinitionCreationOptions plays a big role in the process. The code is the following: private static Definition GetSimpleParameterDefinition(UIApplication uiApp, Document doc,

Revit API - Possible NewtonSoft.Json conflict

∥☆過路亽.° 提交于 2020-01-03 01:51:29
问题 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

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:

Revit to Pdf Conversion

徘徊边缘 提交于 2019-12-25 08:14:03
问题 I am trying to automate the process of pdf printing in Revit 2017 using Revit API with Idling event handler. I am opening the revit document using OpenDocumentFile method and not using ActiveUIDocument anywhere. This process is generating Invalid Operation Exception. I am not sure why is it giving the exception or whether it is allowed using Revit API. Please help. Thanks. Journal Output: ' 1:< 0 <-pushSettingsIntoDriver ' C 27-Sep-2016 14:45:22.641; 1:< ExportToRequestedFormat() : Pdf Print

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")

System.BadImageFormatException An attempt was made to load a program with an incorrect format

ε祈祈猫儿з 提交于 2019-12-17 10:38:34
问题 I'm writing a plug-in for another program that is based on a public .NET API. Typically these plugins are made by creating a class library DLL that references the API assembly. Then a command class is created by inheriting from a base command class in the API assembly. The application is then set to reference the plug-in DLL file, and is then also responsible for actually firing up the custom command class when the user requests it. However, now I'm trying to automate some code generation

Deserialize Json XYZ Point

泄露秘密 提交于 2019-12-12 07:01:42
问题 Autodesk Revit Development I serialized an XYZ point form a class (Points) from a container (Points and Tags) to a file. public class Serialize_pack { public View_3D_Data v3ddata; public Tag_Class tg; } through this Method public static void serializeme(object classme) { string coor_file = constants.SenddDir() + constants.filename(); using (StreamWriter file = File.CreateText(coor_file)) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(file, classme); } } and i got

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