Comments (4)
a possible workaround is to go via forge_type_id - it is not pretty though: 🤔
- via direct access:
from Autodesk.Revit.DB import BuiltInParameter as Bip
from Autodesk.Revit.DB import ForgeTypeId, ParameterUtils
doc = __revit__.ActiveUIDocument.Document
param = doc.ActiveView.GenLevel.GetParameter(ForgeTypeId(ParameterUtils.GetParameterTypeId(getattr(Bip, "LEVEL_IS_BUILDING_STORY")).TypeId))
# instead of just:
# param = doc.ActiveView.GenLevel.get_Parameter(Bip.LEVEL_IS_BUILDING_STORY)
but already the next step: param.StorageType
is your yet another enum that only returns int.
- via creating dict as lookup table for BuiltInCategory:
print(35*"-")
print("bic: forge_type_id_by_cat_name")
from Autodesk.Revit.DB import BuiltInCategory as Bic
from Autodesk.Revit.DB import Category
forge_type_id_by_cat_name = {}
for bic_cat in dir(Bic):
if bic_cat.startswith("OST_"):
bic_name = bic_cat.split("OST_")[-1]
bic = getattr(Bic, bic_cat)
if Category.IsBuiltInCategoryValid(bic):
ftid = Category.GetBuiltInCategoryTypeId(bic)
forge_type_id_by_cat_name[bic_name] = ftid.TypeId
# print(ftid.TypeId)
else:
pass
# print("skipped: ", bic_name)
print(f"found {} ftids".format(len(forge_type_id_by_cat_name)))
# for k, v in sorted(forge_type_id_by_cat_name.items()):
# print(k, v)
- via creating dict as lookup table for BuiltInParameter:
print(35*"-")
print("bip: forge_type_id_by_param_name")
from Autodesk.Revit.DB import BuiltInParameter as Bip
from Autodesk.Revit.DB import ForgeTypeId, ParameterUtils
forge_type_id_by_param_name = {}
skip_names = {
"INVALID",
"Overloads",
}
for bip_name in dir(Bip):
# print(bip_name)
if bip_name in skip_names:
continue
if bip_name.endswith("__"):
continue
bip = getattr(Bip, bip_name)
if "method" in str(bip) or "function" in str(bip):
continue
ftid = ParameterUtils.GetParameterTypeId(bip).TypeId
# print(bip_name, ftid)
forge_type_id_by_param_name[bip_name] = ftid
print("found {} ftids:".format(len(forge_type_id_by_param_name)))
# for k, v in sorted(forge_type_id_by_param_name.items()):
# print(k, v)
so ideally there could be a fix with which we could access enums in pyRevit cpython the same way as in ironpython. 🤔
from pyrevit.
I just tested it on pyRevit 4.8.16 , cpython 3.8.5 - same issue there.
from pyrevit.
Hi @ay-ex, sorry for the delay in the response.
This is a known bug of the version of pythonnet currently used by pyrevit. It was solved in version 3.0.
We're trying to update it alongside the upgrade to the .net8 sdk to support revit 2025.
As this was not our project originally and we're not super c# experts, we're trying to do the best we can to reach this goal.
The upcoming pyrevit version 5 should fix this issue (no ETA yet, unfortunately).
from pyrevit.
hi @sanzoghenzo ,
no worries and thank you for the notification. 🙂
looking forward to pyRevit 5.
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.