Comments (11)
I just posted a pull request that should fix this. It basically mimics how pyRevit imports wpf. I will leave it to the team to decide whether or now we want to intentionally leave the rpw stale in order to move off of it over time or not. I know this update caused some pain for my company who was relying heavily on rpw forms.
from pyrevit.
Thanks for this, I had trouble with rpw, because IPY2711PR engine had pyRevitLabs.IronPython.Wpf
so clr.AddReference('IronPython.Wpf')
threw an exception
from pyrevit.
NOTE: below is just an investigation on the original issue, which seems to be solved by the related PR
Okay, so the original issue of LoadComponent
is happening in Revit 2022, but in 2023, 2024 it breaks with the IOException
when trying to load the IronPython.Wpf
assembly. Anyone knows why does it act differently?
Edit:
found the reason: IronPython.Wpf is already preloaded by Dynamo, so clr
finds it and it doesn't try to load from pyrevit bin
IronPython.Wpf 2.7.9.0 C:\Program Files\Autodesk\Revit 2022\AddIns\DynamoForRevit\IronPython.Wpf.dll
Thats why we have IronPython.Wpf in 2022, that breaks, but nothing in 2023, 2024
from pyrevit.
For reference
https://discourse.pyrevitlabs.io/t/selectfromlist-error/2080/2
https://stackoverflow.com/questions/32013933/ironpython-wpf-withe-revitpythonshell
from pyrevit.
I will check this out
from pyrevit.
fixed by #2188
from pyrevit.
tried it in 2024 2023 2021
I will try it in 2022 then
from pyrevit.
tried the pychilizer room data sheet tool from that
from pyrevit import revit, DB, script, forms
from rpw.ui.forms import FlexForm, Label, TextBox, Button, ComboBox, CheckBox, Separator
import rdslocator, rdsui
from itertools import izip
import sys
from pychilizer import units, select, geo, database
from Autodesk.Revit import Exceptions
ui = rdsui.UI(script)
ui.is_metric = units.is_metric
doc = __revit__.ActiveUIDocument.Document
output = script.get_output()
logger = script.get_logger() # helps to debug script, not used
selection = select.select_with_cat_filter(DB.BuiltInCategory.OST_Rooms, "Pick Rooms for Room Data Sheets")
# collect all view templates for plans and sections
viewsections = DB.FilteredElementCollector(doc).OfClass(DB.ViewSection) # collect sections
ui.viewsection_dict = {v.Name: v for v in viewsections if v.IsTemplate} # only fetch the IsTemplate sections
viewplans = DB.FilteredElementCollector(doc).OfClass(DB.ViewPlan) # collect plans
ui.viewplan_dict = {v.Name: v for v in viewplans if v.IsTemplate} # only fetch IsTemplate plans
ui.viewport_dict = {database.get_name(v): v for v in
database.get_viewport_types(doc)} # use a special collector w viewport param
ui.set_vp_types()
# add none as an option
ui.viewsection_dict["<None>"] = None
ui.viewplan_dict["<None>"] = None
ui.set_viewtemplates()
ui.set_viewtemplates()
# collect titleblocks in a dictionary
titleblocks = DB.FilteredElementCollector(doc).OfCategory(
DB.BuiltInCategory.OST_TitleBlocks).WhereElementIsElementType().ToElements()
if not titleblocks:
forms.alert("There are no Titleblocks loaded in the model.", exitscript=True)
ui.titleblock_dict = {'{} : {}'.format(tb.FamilyName, revit.query.get_name(tb)): tb for tb in titleblocks}
ui.set_titleblocks()
view_scale = 50
# get units for Crop Offset variable
if units.is_metric(doc):
unit_sym = " [mm]"
else:
unit_sym = " [decimal feet]"
components = [
Label("Select Titleblock"),
ComboBox(name="tb", options=sorted(ui.titleblock_dict), default=database.tb_name_match(ui.titleblock, doc)),
Label("Sheet Number"),
TextBox("sheet_number", Text=ui.sheet_number),
Label("Crop offset" + unit_sym),
TextBox("crop_offset", Text=str(ui.crop_offset)),
Label("Titleblock (internal) offset" + unit_sym),
TextBox("titleblock_offset", Text=str(ui.titleblock_offset)),
Label("Layout orientation"),
ComboBox(name="layout_orientation", options=ui.layout_orientation, default=ui.layout_ori),
CheckBox("el_rotation", 'Rotate elevations', default=ui.rotated_elevations),
CheckBox("el_as_sec", 'Elevations as Sections', default=ui.el_as_sec),
Label("Titleblock orientation"),
ComboBox(name="tb_orientation", options=ui.tblock_orientation, default=ui.titleblock_orientation),
Separator(),
Label("View Template for Plans"),
ComboBox(name="vt_plans", options=sorted(ui.viewplan_dict), default=database.vt_name_match(ui.viewplan, doc)),
Label("View Template for Reflected Ceiling Plans"),
ComboBox(name="vt_rcp_plans", options=sorted(ui.viewplan_dict),
default=database.vt_name_match(ui.viewceiling, doc)),
Label("View Template for Elevations"),
ComboBox(name="vt_elevs", options=sorted(ui.viewsection_dict), default=database.vt_name_match(ui.viewsection, doc)),
Label("Viewport Type"),
ComboBox(name="vp_types", options=sorted(ui.viewport_dict), default=database.vp_name_match(ui.viewport, doc)),
Separator(),
Button("Select"),
]
form = FlexForm("Set Sheet Number", components)
ok = form.show()
from pyrevit.
it works fine in 2022... @thumDer
from pyrevit.
Sorry for the confusion but I was talking about the situation before the related pull request, how the original rpw wpf referencing worked, just wanted to investigate. I should have been more specific.
from pyrevit.
for reference, interactions with ipy3, rps, ipy2, wpf
architecture-building-systems/revitpythonshell#155 (comment)
from pyrevit.
Related Issues (20)
- show view range - enable for other view types (Sections, Details, etc. HOT 2
- show view range - account for Plan Regions HOT 3
- Add option to "Toggle All Grids Bubbles" to toggle bubbles at the sides of the view (top|bottom, left|right) HOT 2
- Automatically reduce the number of model faces HOT 6
- [Bug]: Installer installs an incorrect .addin file HOT 3
- Match properties does not work with text overides [Bug]:
- [Bug]: Sync View and Make Pattern tool not working properly HOT 5
- [Bug]: Pyrevit Error Load HOT 5
- [Bug]: Failure to Launch in Revit 2025 HOT 1
- Won't install in Revit 2024 HOT 2
- CLI Launches the wrong version of Revit [Bug]: HOT 6
- [Bug]: pyrevit Transaction crashes Revit 2024 when canceling occurred failure message HOT 4
- PyRevit does not work anymore HOT 5
- [Bug]: Make (Model) Pattern maker fail HOT 4
- [Bug]: Rename PDF Sheets not working
- Water and Airflow parameters - Sum total tool unit fix
- [Bug]: Color Splasher HOT 4
- [Bug]: Crash List installed Revits.
- Wipe Option: Purge unused Revit Sheets which deletes all Sheets without Viewport on them except for the Sheet that I have open
- [Bug]: List Family Size error. crashes on Revit 2024 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyrevit.