Signed up and Will see you soon.
1 Like
I was too fast on the post, this is happening tomorrow! not today
1 Like
Today!
9pm CET online
Thank you @Jean-Marc
2 Things I learned today:
1- the. content button has so much potential. didn’t knew that before although I used the bundle creator a few years ago but I think I totally overlooked that.
2- We both are 178cm, likely somebody accidentally clicked yes after finishing a floor sketch. Both of us got constrained to the same height.
If I attended BILT, I won’t be wasting time creating the script below, instead I’d just put my component in a .content button:
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
# pylint: disable=import-error
# pylint: disable=missing-import
# pyright: reportMissingImports=false
import os.path
from pyrevit import revit, DB
from pyrevit.revit import query
from pyrevit.revit.db import create
from pyrevit.revit.db import transaction
from pyrevit import forms, script, revit
from pyrevit import HOST_APP
from System.Collections.Generic import List
import family_placement # Import the family_placement module
import workset_assignment # Import the workset_assignment module
doc = revit.doc
uidoc = revit.uidoc
app = HOST_APP.app
fam_name = "Standard_Exam_Room_25" # Name of the rfa to load and place
target_workset = "STANDARDS" # Name of the workset to place the family in
def flatten_and_convert_to_ICollection(element_ids):
"""Flatten a list of lists and convert to an ICollection.
args:
element_ids (list): List of lists of element ids.
returns:
List[DB.ElementId]: Flat list of element ids."""
# Flatten the tree to a single list
flattened_ids = [item for sublist\
in element_ids for item in sublist]
# Create ID ICollection
return List[DB.ElementId](flattened_ids)
def select_elements_from_ICollection(element_ids):
"""Select elements in the Revit UI from an ICollection of element IDs.
args:
element_ids (List[DB.ElementId]): ICollection of element IDs to select.
"""
ids = flatten_and_convert_to_ICollection(element_ids)
uidoc.Selection.SetElementIds(ids)
return ids
def place_families(family_name):
"""Load a family and return its element IDs."""
return family_placement.FamilyLoader().main(family_name)
if doc.IsFamilyDocument:
forms.alert("This script cannot be run in a family document.")
script.exit()
if not doc.IsWorkshared:
forms.alert("This script requires a workshared document.")
script.exit()
# Load and place the family
element_ids = place_families(fam_name)
# Assign the placed elements to the target workset
workset_assignment.WorksetAssignment().assign_worksets(element_ids, target_workset)
# Select the placed elements
select_elements_from_ICollection(element_ids)
1 Like
I love feedback! Thanks
Indeed, I should make a short video for that
thiis the sweet spot between short and tall!
Hehe! and rather convoluted
1 Like