Questions tagged [pyrevit]

Use this tag to ask questions about the pyRevit project. pyRevit is a library designed to setup a Rapid Application Development environment inside Autodesk Revit®. It provides a collection of useful scripts and extensions.

pyRevit blog : https://ein.sh/pyRevit/

pyRevit Issue tracker : https://github.com/eirannejad/pyRevit/issues

pyRevit project: https://github.com/eirannejad/pyRevit

104 questions
1
vote
2 answers

Revit API - How to check for open Transactions, Sub-transactions, or Group Transactions

I'm working on a button where I have a project document open and a family document open. I'm trying to close the family document however I'm getting an error saying: Autodesk.Revit.Exceptions.InvalidOperationException: 'Close is not allowed when…
Cflux
  • 1,423
  • 3
  • 19
  • 39
1
vote
1 answer

Revit API - Remove family completely from Revit project

I'm running into a problem trying to remove a family from a project. I'm able to delete the family types but it seems like the family is still loaded in the project. Is there a way to remove it completely? so far, i've looked at these sources: 1)…
Cflux
  • 1,423
  • 3
  • 19
  • 39
1
vote
2 answers

Revit using Python, Filter by families (Family Symbol)

I've just started workin with Revit API and I have one question. I've been looking for a way now to filter Revit elements by Family. Here's my procedure: First I do a filtered element Collector to obtain all family symbos Ids. Families =…
1
vote
2 answers

Revit API - New Wall Type - How to arrange layers?

I'm working on creating new wall types from scratch through the Revit API and I've gotten far (in my eyes) however I have one final problem to solve. How do I arrange the layers of the wall the way I want? the wall gets created with all of the…
Cflux
  • 1,423
  • 3
  • 19
  • 39
1
vote
1 answer

Revit API: Maintaining a code for multiple API versions

I have some Revit add-ins that are written for Revit 2019 or the versions below. Now I'm trying to upgrade the tools for Revit 2020, but it seems like there are some significant changes in API methods. Fortunately, some of them are backward…
Yongjoon Kim
  • 107
  • 1
  • 8
1
vote
1 answer

Change family and type of an element with Revit API

I'm trying to build a script that changes the family and the type of an element from a selected element in the model in Revit. I've tried what I've been doing for the rest of the paramaters of the element: from Autodesk.Revit.DB import…
1
vote
1 answer

PickObjects with ISelectionFilter will not allow me to select anything, why?

I am trying to enable selecting one single space for use in Revit MEP 2019 by using the GUI and store the selection for further use in scripts. The code is written in pyRevit. The script runs both from the shell and from the addin button, but when…
1
vote
1 answer

How can I use NumPy in IronPython for Revit API?

I'm writing a script in Revit API by using python. I'm looking to use NumPy since I'm trying to generate a lattice grid of points to place families to. However, I know NumPy is not compatible with IronPython since it's written in CPython. Is there a…
Yongjoon Kim
  • 107
  • 1
  • 8
1
vote
1 answer

PyRevit / RevitPythonShell Custom Tools - How to disable Alt-Click "View Code" functionality?

I've begun developing some tools for my firm using RPS and thus would like to know how to disable the alt-click "view code" functionality as shown in PyRevit. I've gone through the documentation and scoured the web but I haven't seen any kind of…
Cflux
  • 1,423
  • 3
  • 19
  • 39
1
vote
1 answer

RevitPythonShell - IronPython.Runtime.UnboundNameException: global name 'doc' is not defined

im writing my first button in RPS but it seems like the init file is not being read on startup or when the button is clicked. this is the error I'm getting when trying to follow the tutorials provided on…
Cflux
  • 1,423
  • 3
  • 19
  • 39
1
vote
1 answer

How to pick up a certain plane in an element to mirror it?

I'm working with Revit API and the revit python shell to make a tool, and a part of the tool's operation includes mirroring the selected element(desk) shown in the screenshot. In order to pick up a plane to mirror the desk, I'm trying to pick up a…
Yongjoon Kim
  • 107
  • 1
  • 8
1
vote
2 answers

How do I get Space info on objects above the space's ceiling?

I'm a MEP engineer and I want to add space information on mechanical equipment, duct accessories and pipe accessories above the (room bounding) ceilings. My first idea was to use BoundingBoxIntersectsFilter with an Outline with a modified…
Kyrre
  • 85
  • 1
  • 5
1
vote
2 answers

Advanced Filtering of Elements in Revit API

I was following example shown in this youtube video (https://www.youtube.com/watch?v=WU_D2qNnuGg&index=7&list=PLc_1PNcpnV5742XyF8z7xyL9OF8XJNYnv) which illustrates superiority of filtering methods in Revit API over usual iteration. But my code is…
shahabaz sha
  • 61
  • 1
  • 9
1
vote
1 answer

Revit API collector: Could not cast value:spaces to target_type:

I don't understand why my code, which works fine with other revit categories: # -*- coding: utf-8 -*- import rpw from rpw import revit, db, ui, DB, UI dd1 = rpw.db.Collector(of_category='Spaces') produces this error: IronPython…
user3808752
  • 169
  • 4
  • 14
1
vote
3 answers

How to get the bounding box from a Revit Element with Revit API, then call to center of that bounding box

I am trying to rotate Revit elements about their center points. In order to do that, I need to select a Revit element and find its center point, then create a line with the coordinates at that elements center point. My best idea to accomplish this…
Christian Gentry
  • 811
  • 3
  • 10
  • 15