Coder Social home page Coder Social logo

Comments (11)

jbf1212 avatar jbf1212 commented on August 12, 2024 2

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.

thumDer avatar thumDer commented on August 12, 2024 1

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.

thumDer avatar thumDer commented on August 12, 2024 1

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.

jmcouffin avatar jmcouffin commented on August 12, 2024

For reference

https://github.com/eirannejad/pyRevit/blob/23b58850070b549ca1128c414ec8eb018d0dfc13/pyrevitlib/rpw/ui/forms/resources.py#L36-L48

https://discourse.pyrevitlabs.io/t/selectfromlist-error/2080/2

https://stackoverflow.com/questions/32013933/ironpython-wpf-withe-revitpythonshell

IronLanguages/main#1273

from pyrevit.

jmcouffin avatar jmcouffin commented on August 12, 2024

I will check this out

from pyrevit.

jmcouffin avatar jmcouffin commented on August 12, 2024

fixed by #2188

from pyrevit.

jmcouffin avatar jmcouffin commented on August 12, 2024

tried it in 2024 2023 2021
image
I will try it in 2022 then

from pyrevit.

jmcouffin avatar jmcouffin commented on August 12, 2024

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.

jmcouffin avatar jmcouffin commented on August 12, 2024

it works fine in 2022... @thumDer

from pyrevit.

thumDer avatar thumDer commented on August 12, 2024

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.

jmcouffin avatar jmcouffin commented on August 12, 2024

for reference, interactions with ipy3, rps, ipy2, wpf
architecture-building-systems/revitpythonshell#155 (comment)

from pyrevit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.