def form(): floor_types = rpw.db.Collector(of_category='OST_Floors', is_type=True).get_elements() wall_types = rpw.db.Collector(of_category='Walls', is_type=True, where=lambda x: x.GetParameters('Width')).get_elements() components = [ Label('Finish floor type:'), ComboBox('floor_type_id', {ft.parameters['Type Name'].AsString(): ft.Id for ft in floor_types}), # Label('No Floors'), CheckBox('make_floors', 'make Floors'), Label('Finish wall type:'), ComboBox('wall_type_id', {wt.parameters['Type Name'].AsString(): wt.Id for wt in wall_types}), Label('Finish wall height (mm):'), TextBox('wall_height', default='3000'), Button('Create Finish Walls') ] ff = FlexForm('Create Finish Walls', components) ff.show() if ff.values['wall_type_id'] and ff.values['wall_height']: try: floor_type = rpw.db.Element.from_id(ff.values['floor_type_id']) wall_type = rpw.db.Element.from_id(ff.values['wall_type_id']) wall_height = float(ff.values['wall_height']) make_floors = ff.values['make_floors'] return wall_type, wall_height, floor_type, make_floors except: return
def get_from_win_form(): """ Получить от пользователя значение шаблона и на что заменить :return: две строки :rtype: tuple[str, str] """ components = [ Label('Введите шаблон:'), TextBox('Template', Text="A"), Label('Заменить на:'), TextBox('New_text', Text="Q"), Separator(), Button('Find and Replace') ] form = FlexForm('Title', components) form.show() if 'Template' in form.values and 'New_text' in form.values: template = form.values['Template'] new_text = form.values['New_text'] logger.info('Get from user template {} and new text {}'.format( repr(template), repr(new_text))) return template, new_text raise ElemNotFound('User canceled form')
def Run_Form(self): from rpw.ui.forms import FlexForm # create form object and add elements to it self.SetFormComponents() # Create Menu form = FlexForm("RENAME ELEMENTS", self.components) form.show() # set form outputs self.SetFormOutputs(form)
def flex_form(combo_values = dict, default_text = str): """Main Window""" components = [Label('Select View Template:'), ComboBox('template', combo_values), Separator(), Label('Enter Suffix:'), TextBox('suffix', Text= default_text), Separator(), CheckBox('select_levels', 'Select Levels'), CheckBox('all_levels', 'All Levels',default= True), Button('Create Views') ] form = FlexForm('Create Views', components) form.show() return form
def SF_GetUserConfigs(self): from rpw.ui.forms import FlexForm # set form options self.SetDefaultFormValues() # create form object and add elements to it self.SetFormComponents() # Create Menu form = FlexForm("STOREFRONT 2", self.components) form.show() # set form outputs self.SetFormOutputs(form) # write SF configuration to be used by SF2_Engine self.WriteSFConfigs()
def form(): wall_types = rpw.db.Collector(of_category='Walls', is_type=True, where=lambda x: x.GetParameters('Width')).get_elements() components = [Label('Finish wall type:'), ComboBox('wall_type_id', {wt.parameters['Type Name'].AsString(): wt.Id for wt in wall_types}), Label('Finish wall height (mm):'), TextBox('wall_height'), Button('Create Finish Walls')] ff = FlexForm('Create Finish Walls', components) ff.show() if ff.values['wall_type_id'] and ff.values['wall_height']: try: wall_type = rpw.db.Element.from_id(ff.values['wall_type_id']) wall_height = float(ff.values['wall_height']) return wall_type, wall_height except: return
def config_method(): prev_choice = get_config() opts = ["Extrusion", "Freeform"] components = [ Label("Choose method:"), ComboBox(name="method", options=opts, default=prev_choice), Button("Remember choice") ] form = FlexForm("Settings", components) ok = form.show() if ok: res = form.values["method"] if res: save_config(res) return res else: sys.exit()
def show_results(group, use, sprinkler, type): if not use: use = "ANY" height = allowable_height(group, use, sprinkler, type) stories = allowable_stories(group, use, sprinkler, type) area = allowable_area(group, use, sprinkler, type) text = '' if stories == 'NP' or area == 'NP': text = "This combination is not permitted" elif area == 'Unlimited': text = """Max height: {height} feet \n Max stories above grade plane: {stories} \n Unlimited area \n See Section 507 for further info concerning max height for unlimited area buildings.""".format(height=height, stories=stories) elif sprinkler == 'S13R': text = """Max height: {height} feet \n Max stories above grade plane: {stories} \n Max area per story: {area} square feet\n Max area total: {area} x N square feet\n Where N = stories above grade plane, up to four""".format(height=height, stories=stories, area=area) else: text = """Max height: {height} feet \n Max stories above grade plane: {stories} \n Max area per story: {area} square feet \n Max area total: {area} x N square feet \n Where N = stories above grade plane, up to three""".format(height=height, stories=stories, area=area) text = text + "\n\nThis is an estimate, and not a replacement for a professional code review. There are many " \ "special exceptions listed in Chapter 5, especially for mixed-occupancy buildings, so please " \ "only use these values as a quick reference." components = [TextBox('textbox1', Text=text, Height=250, TextWrapping=0)] form = FlexForm('Results', components) form.show()
def Run_Form(self, printTest=False): # create form - instantiates outputs through user selection self.CreateForm() form = FlexForm("Storefront Tools Refactored", self.components) form.show() # exit if no selection if not form.values: sys.exit() # form output if selection accepted else: self.selectedSystem = form.values["combobox1"] self.headHeight = float(form.values["combobox2"]) self.partialHeadHeight = float(form.values["combobox2"]) self.spacingType = form.values["combobox3"] self.storefrontPaneWidth = float(form.values["combobox4"]) # MAKE SURE TO OUTPUT THE DATA NECESSARY TO KNOW WHICH FAMILIES TO LOAD if printTest == True: self.PRINTout() # GUI HAS TO RUN CONFIGS AND LOAD STOREFRONT SETTINGS...IT CAN LIVE IN FAMILIES WHICH THEN LOADS THE FAMILIES THEMSELVES... self.userConfigs = {"projectName": self.projectName, "projectId": self.projectId.IntegerValue, "configDate": self.todaysDate, "headHeight": self.headHeight, "storefrontPaneWidth" : self.storefrontPaneWidth, "spacingType" : self.spacingType, "families": loadedFamilies, "selectedSystem": selectedSystem} # run youngest child from SF2_SystemConfigs - MAYBE NOT THIS RIGHT NOW, BUT SOMETHING ELSE HERE self.configObj = SF2_Families.storefront_configuration(system_name=self.selectedSystem, userConfigs=self.userConfigs) self.storefront_save_config(selectedSystem, userConfigs) return(None)
def main(): try: elements = selection.select_objects_by_category('Windows', 'Doors') except: return all_beam_types = rpw.db.Collector(of_category='Structural Framing', is_type=True).get_elements(wrapped=False) components = [ Label('Lintel (Beam) Type:'), ComboBox('beam_type', { b.LookupParameter('Type Name').AsString(): b for b in all_beam_types }), Label('L1:'), TextBox('l1'), Label('L2:'), TextBox('l2'), Button('Create Lintels') ] ff = FlexForm('Create Lintels', components) ff.show() if ff.values: beam_type = ff.values['beam_type'] try: l1 = float(ff.values['l1']) l2 = float(ff.values['l2']) except: return if not beam_type.IsActive: with rpw.db.Transaction('Activate Beam Type'): beam_type.Activate() for e in elements: create_lintel(e, l1, l2, beam_type)
'Sheet Export Directory', 'Sheet Naming Template', 'Sheet Size Parameter Name', 'Default Sheet Size', 'Sheet Orientation Parameter Name' ]) orientationField = 'Default Sheet Orientation' orientationKey = revitron.String.sanitize(orientationField) orientations = ['Landscape', 'Portrait'] default = orientations[0] if config.get(orientationKey) in orientations: default = config.get(orientationKey) components.append(Label(orientationField)) components.append(ComboBox(orientationKey, orientations, default=default)) components = addFields(components, [ '---', 'PDF Printer Address', 'PDF Temporary Output Path', '---', 'DWG Export Setup' ]) components.append(Label('')) components.append( Button('Save', Width=100, HorizontalAlignment=System.Windows.HorizontalAlignment.Right)) form = FlexForm('Revitron PDF and DWG Export Settings', components) form.show() if form.values: revitron.DocumentConfigStorage().set('revitron.export', form.values)
do_filter = DB.ElementDesignOptionFilter(do.Id) # collect with Design Option filter do_el_list = DB.FilteredElementCollector(doc).WherePasses(do_filter).ToElements() return do_el_list design_options = DB.FilteredElementCollector(revit.doc).OfClass(DB.DesignOption).ToElements() forms.alert_ifnot(design_options, "No Design Options in model.", exitscript=True) do_dict = {get_full_option_name(do) : do for do in design_options} # construct rwp UI components = [ Label("Select Design Option:"), ComboBox(name="design_option", options = do_dict), Button("Select")] form = FlexForm("Select Elements by Design Option", components) form.show() # assign chosen parameters chosen_do = form.values["design_option"] if not chosen_do: sys.exit() # collect elements belonging to chosen Design Option do_el_list = get_elements_by_do(chosen_do) # exit script if no elements found forms.alert_ifnot(do_el_list, "No elements in Design Option:\n {}".format(chosen_do.Name), exitscript=True) # add element selection = revit.get_selection() selSet = [elid.Id for elid in do_el_list]
Level_type = db.Collector(of_category='Levels', is_type=False).elements Level_type_options = {DB.Element.Name.GetValue(t): t for t in Level_type} components = [ Label('输入图层名称'), TextBox('图层名称', Text="S-STEL-BEAM"), Label('构件名称'), ComboBox('FamilyName', Framing_type_options), Label('标高'), ComboBox('Level', Level_type_options), Label('偏移标高'), TextBox('Offset', Text="-300"), Button('确定') ] form = FlexForm('结构', components) form.show() Value = form.values LayerName = Value['图层名称'] FamilyName = Value['FamilyName'] Level = Value['Level'] Offset = Helper.MmToFeet(float(Value['Offset'])) # def Draw_LinesfromPoints(Points): pass
'floor': 'floor', 'column': 'column', 'beam': 'beam', 'wall': 'wall', 'Generic Model': 'generic_model', }), Separator(), Label('Elements to join:'), CheckBox('join_floor', 'floor'), CheckBox('join_column', 'column'), CheckBox('join_beam', 'beam'), CheckBox('join_wall', 'wall'), CheckBox('join_generic_model', 'Generic Model'), Button('Join') ] if rpw.ui.Selection(): selected = True else: selected = False ff = FlexForm("Join cấu kiện", components) ff.show() if ff.values: cut_element = ff.values['cut_element'] for k, v in ff.values.items(): if k.startswith('join_') and v == True: multijoin(cut_element, k.replace('join_', ''), selected)
def SF_GetUserConfigs(self): """ Set configurations and load families. THIS IS ALSO IDENTICAL TO STOREFRONT GUI, SO IT WILL BE REPLACED BY THAT... """ from rpw.ui.forms import Label, ComboBox, Separator, Button, FlexForm, CheckBox, TextBox # set default storefront system if not self.currentConfig["selectedSystem"] in self.GUI_SFSystemOptions.values(): defaultSystem = self.GUI_SFSystemOptions .keys()[0] else: defaultSystem = self.GUI_SFSystemOptions .keys()[self.GUI_SFSystemOptions.values().index(self.currentConfig["selectedSystem"])] # set default storefront height if not self.currentConfig["headHeight"] in self.GUI_heightOptions.values(): defaultHeight = self.GUI_heightOptions.keys()[0] else: defaultHeight = self.GUI_heightOptions.keys()[self.GUI_heightOptions.values().index(self.currentConfig["headHeight"])] # set default storefront transum height #if not self.currentConfig["transomHeight"] in self.transomHeightOptions.values(): #defaultTransomHeight = self.transomHeightOptions.keys()[0] #else: #defaultTransomHeight = self.transumHeightOptions.keys()[self.transumHeightOptions.values().index(self.currentConfig["transomHeight"])] # set defualt storefront panel division method if not self.currentConfig["spacingType"] in self.GUI_divisionOptions.values(): defaultDivOption = self.GUI_divisionOptions.keys()[0] else: defaultDivOption = self.GUI_divisionOptions.keys()[self.GUI_divisionOptions.values().index(self.currentConfig["spacingType"])] # set default storefront panel width if not self.currentConfig["storefrontPaneWidth"] in self.GUI_panelWidthOptions.values(): defaultWidthOption = self.GUI_panelWidthOptions.keys()[0] else: defaultWidthOption = self.GUI_panelWidthOptions.keys()[self.GUI_panelWidthOptions.values().index(self.currentConfig["storefrontPaneWidth"])] # set default nib wall type if not self.currentConfig["nibWallType"] in self.GUI_nibWallOptions.values(): defaultSplitWallOption = self.GUI_nibWallOptions.keys()[0] else: defaultSplitWallOption = self.GUI_nibWallOptions.keys()[self.GUI_nibWallOptions.values().index(self.currentConfig["nibWallType"])] # set default nib wall length if not self.currentConfig["splitOffset"] in self.GUI_nibWallLengthOptions.values(): defaultNibWallTypeOption = self.GUI_nibWallLengthOptions.keys()[0] else: defaultNibWallTypeOption = self.GUI_nibWallLengthOptions.keys()[self.GUI_nibWallLengthOptions.values().index(self.currentConfig["splitOffset"])] # set form buttons, text boxes, etc... | TextBox(componentName, defaultValue) is an option for manual entry # dropdown transomHeightOptions from above is not currently being used components = [Label('PICK SYSTEM'), ComboBox("combobox1", self.GUI_SFSystemOptions , default=defaultSystem), Label('HEAD HEIGHT'), ComboBox("combobox2", self.GUI_heightOptions, default=defaultHeight), #CheckBox("checkbox1", "Transom (decimal input)", default=False), #TextBox("textbox1", default="12.00 inches"), Label('DIVISION TYPE'), ComboBox("combobox4", self.GUI_divisionOptions, default=defaultDivOption), Label('DIVISION WIDTH'), ComboBox("combobox5", self.GUI_panelWidthOptions, default=defaultWidthOption), Separator(), CheckBox("checkbox2", "Nib Wall Split", default=True), ComboBox("combobox6", self.GUI_nibWallOptions, default=defaultSplitWallOption), ComboBox("combobox7", self.GUI_nibWallLengthOptions, default=defaultNibWallTypeOption), Separator(), Button('Go') ] # Create Menu form = FlexForm("STOREFRONT 2", components) form.show() if not form.values: # better than sys.exit() pyrevit.script.exit() else: selectedSystem = form.values["combobox1"] headHeight = float(form.values["combobox2"]) partialHeadHeight = float(form.values["combobox2"]) #createTransom = form.values["checkbox1"] # filter out inputs with a text character - expand to other types of units #try: #transomHeight = float(form.values["textbox1"]) #except: #transomHeight = float(form.values["textbox1"].split(" inches")[0]) spacingType = form.values["combobox4"] storefrontPaneWidth = float(form.values["combobox5"]) createNibWall = form.values["checkbox2"] nibWallType = form.values["combobox6"] if form.values["combobox7"] == "OPTIMIZED": GUI_nibWallLengthOptions = form.values["combobox7"] else: GUI_nibWallLengthOptions = float(form.values["combobox7"]) # IS THIS DOUBLE LOADING? # Load familes - its not a load, load but I will clarify this later loadedFamilies = self.familyObj.SFLoadFamilies(True) # Save when the config was set. projectInfo = self.doc.ProjectInformation projectId = projectInfo.Id projectName = None for p in projectInfo.Parameters: if p.Definition.Name == "Project Name": projectName = p.AsString() todaysDate = "{0}-{1}-{2}".format(dt.Today.Month, dt.Today.Day, dt.Today.Year) # can also be used as class outputs directly in code self.userConfigs = {"projectName": projectName, "projectId": projectId.IntegerValue, "configDate": todaysDate, "families": loadedFamilies, "selectedSystem": selectedSystem, "headHeight": headHeight, "partialHeadHeight": partialHeadHeight, #"createTransom": createTransom, #"transomHeight": transomHeight, "spacingType": spacingType, "storefrontPaneWidth": storefrontPaneWidth, "createNibWall": createNibWall, "nibWallType": nibWallType, "nibWallLength": GUI_nibWallLengthOptions } # IS THIS SAVING WHAT WILL GET LOADED NEXT TIME? self.familyObj.Run_SaveSFConfigurations(selectedSystem, self.userConfigs)
# {key: value for value in list} cat_dict1 = {f.Category.Name: f.Category \ for f in [fam for fam in family_instances] \ if f.Category.Id.IntegerValue not in cat_ban_list \ and f.LevelId and f.get_Geometry(DB.Options())} cat_rooms = DB.Category.GetCategory(doc, DB.BuiltInCategory.OST_Rooms) cat_dict1[cat_rooms.Name] = cat_rooms # Add Rooms to the list of Categories # construct rwp UI for Category components = [ Label("Pick Category:"), ComboBox(name="cat_combobox", options=cat_dict1, sorted=True), Button("Select") ] form = FlexForm("Select", components) form.show() cat_name = '' try: # assign chosen parameters cat_name = form.values["cat_combobox"].Name except: forms.alert_ifnot(cat_name, "No selection", exitscript=True) cat = GetBICFromCat(form.values["cat_combobox"]) #BuiltInCategory param_dict1 = GetInstanceParameters(cat) # construct rwp UI for Parameter and Prefix components = [
from Autodesk.Revit.DB.Plumbing.PlumbingUtils import BreakCurve from rpw.db.xyz import XYZ import csv try: components = [ Label('Codes in selected pipes:'), Label('Code parameter:'), TextBox('textbox1', Text="AR - CODIGO"), Label('Description parameter:'), TextBox('textbox2', Text="AR - DESCRICAO"), Button('Search base', on_click=ButtonClass.Importarbase), Separator(), Button('Process') ] form = FlexForm('Insert code in selected pipes', components) form.show() #Tubos = db.Collector(of_category='OST_PipeCurves',is_not_type=True) #ConexoesTubo = db.Collector(of_category='OST_PipeFitting',is_not_type=True) #AcessoriosTubo = db.Collector(of_category='OST_PipeAccessory',is_not_type=True) #Equipamentos = db.Collector(of_category='OST_PlumbingFixtures',is_not_type=True) Tubos = ui.Selection() Elementos = Tubos """ if len(Tubos)>0: for i in range(0,len(Tubos)): Elementos.append(Tubos[i]) if len(ConexoesTubo)>0: for i in range(0,len(ConexoesTubo)):
"Linear Short": "Linear 36 IN", "Linear Long": "Linear 48 IN", "Pendant": "Pendant" }), Label('Secondary Light Fixture:'), ComboBox( "combobox5", { "Linear Short": "Linear 36 IN", "Linear Long": "Linear 48 IN", "Pendant": "Pendant" }), Separator(), Button('Go') ] form_1 = FlexForm("Retail Layout", components_1) form_2 = FlexForm("Retail Layout", components_2) form_3 = FlexForm("Retail Layout", components_3) form_1.show() form_2.show() form_3.show() #Form Inputs shelvingType = form_2.values["combobox1"] tableType = form_2.values["combobox2"] tvType = form_3.values["combobox3"] primLight = form_3.values["combobox4"] secLight = form_3.values["combobox5"] wall_height = Convert_Display_length_To_Internal(
'Rooms': 1 }), Label('Select the name of Excel sheet to import:'), ComboBox('combobox', dicWs), Label( 'Enter the number of rows in Excel you want to integrate to Revit:' ), TextBox('textbox', Text="60"), Label( 'Enter the number of colones in Excel you want to integrate to Revit:' ), TextBox('textbox2', Text="2"), Separator(), Button('OK') ] form = FlexForm('Title', components) form.show() worksheet = form.values['combobox'] rowEnd = convertStr(form.values['textbox']) colEnd = convertStr(form.values['textbox2']) category = form.values['combobox2'] if category == 0: collector = FilteredElementCollector(doc)\ .OfCategory(BuiltInCategory.OST_Doors)\ .WhereElementIsNotElementType()\ .ToElements() else: collector = FilteredElementCollector(doc)\ .OfCategory(BuiltInCategory.OST_Rooms)\
list_to_dict(view_templates), default="SSG_Elevation - Legend"), Label("Separator Line Style"), ComboBox( "combobox6", list_to_dict(all_text), default='SSG_3/32" - Segoe UI Semibold - Dark Blue', ), Label("Sheet Header"), ComboBox("combobox5", list_to_dict(gsCat), default="06"), Label("Header Text Style"), TextBox("textbox1", Text="Legend"), Button("Continue"), ] form = FlexForm("Legend PDF", components) if form.show(): border_size = form.values["combobox1"] tag = form.values["combobox2"] pdf_tb = form.values["combobox3"] view_temp = form.values["combobox4"] text = form.values["combobox6"] line_style = form.values["combobox5"] short_descript = form.values["textbox1"] plan_view = revit.doc.ActiveView forms.check_viewtype(plan_view, DB.ViewType.FloorPlan, exitscript=True) today = date.today() today = today.strftime("%m/%d/%Y")
# When this is run, a dialog pops up: Freepdf cannot be used with 95x90 print # settings. The "in-session print settings will be used" # - This dialog can not be dissabled. # set this PrintManager to use the "Selected Views/Sheets" option printman.PrintRange = PrintRange.Select # PrintRange is a different class # get the ViewSheetSetting which manages the view/sheet set information of current document viewshsetting = printman.ViewSheetSetting # returns ViewsheetSetting object, # textin Dialog:FlexForm from rpw, components = [Label('Enter Name: '), TextBox('textbox1', Text=""), CheckBox('checkbox1', 'Overwrite, if name exists', default=True), Button('OK')] textin = FlexForm('New ViewSheetSet', components) textin.show() print(textin.values) # with Transaction(doc, 'Created Print Set'): #vsexist = True if textin.values["textbox1"] in allviewss.keys() # else 3 if len(textin.values) == 0 else False try: if textin.values["textbox1"] in allviewss.keys() : vsexist = True else: vsexist = False except:
.ToElements() #db.Collector(of_class) cats = { "Walls": wall_cat, "Floors": floor_cat, "Roofs": roof_cat, "Ceilings": ceil_cat, "Generic Models": gen_cat } components = [ Label('Выберите категорию элементов для присоединения:'), ComboBox('categories', cats), Button('Select') ] form = FlexForm('Choose element category ', components) form.show() if form == False: sys.exit() else: selected_cat = form.values['categories'] obj_type = ObjectType.Element selection = ui.Selection().PickObjects(obj_type, "Choose elements to join") results = [] with db.Transaction('Multiple join'): for A in selected_cat: #print(A) for B in selection:
# gather and organize Room parameters: (only editable text params) room_parameter_set = good_rooms[0].Parameters room_params_text = [p.Definition.Name for p in room_parameter_set if p.StorageType.ToString() == "String" and p.IsReadOnly == False] #forms.select_parameters(src_element=good_rooms[0], multiple = False, include_instance = True, include_type = False) room_params.sort() # construct rwp UI components = [ Label("Which Room parameter is used for Unit Type:"), ComboBox(name="unit_type_param", options=room_params_text), Label("Select Room parameter to populate"), ComboBox("area_req_param", room_params), Button("Select")] form = FlexForm("Unit Type", components) form.show() # assign chosen parameters chosen_room_param1 = form.values["unit_type_param"] selected_parameter = form.values["area_req_param"] if not chosen_room_param1: sys.exit() #components = [Label("Select room parameter to populate"), ComboBox("room_tx_params", room_params), Button ("Select")] #form = FlexForm("Select Parameter", components) #form.show() #selected_parameter = form.values["room_tx_params"] counter = 0
from rpw import revit, db, ui,DB,UI from rpw.ui.forms import FlexForm, Label, ComboBox, TextBox, TextBox,Separator, Button, Alert import json from MyLib import Helper doc = __revit__.ActiveUIDocument.Document uidoc = __revit__.ActiveUIDocument # 参数输入 components = [ Label('曲面偏移距离'), TextBox('OffsetDistance', Text="500"), Label('构件名称'), TextBox('FamilyName', Text="HB200*100"), Button('确定') ] form = FlexForm('根据曲面与垂直线创建结构', components) form.show() Value=form.values OffsetDistance=Value["OffsetDistance"] FamilyName=Value['FamilyName'] Alert('请选择基础面', title=__doc__) #pick Surface Picked= uidoc.Selection.PickObject(UI.Selection.ObjectType.Face,"选择面") PickedElementId=Picked.ElementId Picked_Selection=doc.GetElement(PickedElementId) PickedFaces=Picked_Selection.GetGeometryObjectFromReference(Picked) # CovertTo Dynamo type print(PickedFaces) DS_Face=PickedFaces.ToProtoType() print(DS_Face)
Label('Select Rectangular Pile:'), ComboBox('pile_id', {f.Name: f.Id for f in foundations}), Label('Pile width (D):'), TextBox('pile_width'), Label('Number of piles along Length:'), TextBox('piles_along_length'), Label('Number of piles along Width:'), TextBox('piles_along_width'), Label('Pile spacing along Length:'), TextBox('pile_spacing_along_length'), Label('Pile spacing along Width:'), TextBox('pile_spacing_along_width'), Label('Length cover:'), TextBox('length_cover'), Label('Width cover:'), TextBox('width_cover'), Label('Foundation Thickness:'), TextBox('thickness'), Label('Pile Cut-off:'), TextBox('pile_cutoff'), Label('New Foundation Family Name:'), TextBox('new_foundation_family_name'), Separator(), Button('Create foundation')] ff = FlexForm("Modify Structural Foundation Family", components) ff.show() if ff.values: main()
Label("View Template"), ComboBox("combobox4", list_to_dict(view_templates), default="SSG_Plan - Swatch"), Label("Header Text Style"), ComboBox( "combobox5", list_to_dict(all_text), default='SSG_1/8" - Segoe UI Semibold - Dark Blue', ), Label("Sheet Header"), TextBox("textbox1", Text="Finish Options"), Button("Continue"), ] form = FlexForm("Finish Options PDF", components) if form.show(): border_size = form.values["combobox1"] tag = form.values["combobox2"] pdf_tb = form.values["combobox3"] view_temp = form.values["combobox4"] text = form.values["combobox5"] short_descript = form.values["textbox1"] all_mats = DB.FilteredElementCollector(revit.doc).OfCategory( DB.BuiltInCategory.OST_Materials) ssg_mats = [m for m in all_mats if "SSG" in m.Name] res = forms.SelectFromList.show(ssg_mats,
CheckBox('invert', 'Invert Selection', default=False) ] if selection: components.append( CheckBox('selection', 'Search in selection only', default=True)) else: components.append( CheckBox('viewOnly', 'Search in this view only', default=False)) components.append( Button('Select', Width=100, HorizontalAlignment=System.Windows.HorizontalAlignment.Right)) form = FlexForm('Select by Parameter', components) form.show() if 'search' in form.values: scope = False if 'selection' in form.values and form.values['selection']: scope = selection else: if 'viewOnly' in form.values and form.values['viewOnly']: scope = revitron.ACTIVE_VIEW.Id ids = revitron.Filter(scope).noTypes().byStringContains( form.values['parameter'], form.values['search'], form.values['invert']).getElementIds()
#Get wall_types wall_types = rpw.db.Collector(of_category='OST_Walls', is_type=True).get_elements(wrapped=False) #Select wall type wall_type_options = {DB.Element.Name.GetValue(t): t for t in wall_types} #Select wall types UI components = [ Label('Выберите тип отделки стен:'), ComboBox('wl_type', wall_type_options), Label('Введите высоту стены:'), TextBox('h_offset', wall_custom_height="50.0"), CheckBox('checkbox1', 'Брать высоту стены из помещений'), Button('Select') ] form = FlexForm('Создать отделку стен', components) win = form.show() #Get the ID of wall type if win == True: wall_type = form.values['wl_type'] wall_type_id = wall_type.Id else: sys.exit() # Duplicating wall type creating the same layer set with double width # to deal with the offset API issue def duplicate_wall_type(type_of_wall): wall_type1 = wall_type.Duplicate('temp_wall_type') cs1 = wall_type1.GetCompoundStructure()
for ft in filtered_types } # format document phases dict for ui window doc_phases_dict = {ph.Name: ph for ph in revit.doc.Phases} # rwp UI: pick wall type and phase components = [ Label("Select Wall Type:"), ComboBox("combobox1", wall_type_dict), Label("Select Phase:"), ComboBox("combobox2", doc_phases_dict), Separator(), Button("Select") ] form = FlexForm("Settings", components) form.show() chosen_wall_type = form.values["combobox1"] chosen_phase = form.values["combobox2"] # collect walls in project that are Basic walls and not in Insulation Phase coll_all_walls = DB.FilteredElementCollector(revit.doc) \ .OfClass(DB.Wall) \ .WhereElementIsNotElementType() \ .ToElements() ins_walls = [ w for w in coll_all_walls if w.WallType.Kind == DB.WallKind.Basic and wall_type_has_ins(w.WallType) and w.get_Parameter(DB.BuiltInParameter.PHASE_CREATED) != chosen_phase ]
gm_dict1 = {p.Definition.Name: p for p in gm_params_text} gm_dict2 = {p.Definition.Name: p for p in gm_params_area} # construct rwp UI components = [ Label("[Department] Match Room parameters:"), ComboBox(name="room_combobox1", options=room_params_text, default="Department"), Label("[Description] to Generic Model parameters:"), ComboBox("gm_combobox1", gm_dict1, default="Description"), Label("[Unit Area] parameter:"), ComboBox("gm_combobox2", gm_dict2), Button("Select") ] form = FlexForm("Match parameters", components) form.show() # assign chosen parameters chosen_room_param1 = form.values["room_combobox1"] chosen_gm_param1 = form.values["gm_combobox1"] chosen_gm_param2 = form.values["gm_combobox2"] # iterate through rooms for room in selection: # helper: define inverted transform to translate room geometry to origin geo_translation = helper.inverted_transform(room) # collect room boundaries and translate them to origin room_boundaries = helper.room_bound_to_origin(room, geo_translation) # define new family doc try: