コード例 #1
0
ファイル: script.py プロジェクト: tkahng/ISGpyRevit
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
コード例 #2
0
def addComboBox(components, config, name, values):
    key = revitron.String.sanitize(name)
    if not values:
        values = ['']
    default = values[0]
    if config.get(key) in values:
        default = config.get(key)
    components.append(Label(name))
    components.append(ComboBox(key, values, default=default))
    return components
コード例 #3
0
        def CreateForm(self):
            # Create Menu
            systemOptions = self.availableSystems
            heightOptions = self.heightOptions
            divisionTypeOptions = self.divisionOptions
            widthOptions = self.panelWidthOptions
            
            # Make sure default values are set
            if not self.configObj.currentConfig["selectedSystem"] in systemOptions.values():
                defaultSystem = systemOptions.keys()[0]
            else:
                defaultSystem = systemOptions.keys()[systemOptions.values().index(self.configObj.currentConfig["selectedSystem"])]

            if not self.configObj.currentConfig["headHeight"] in heightOptions.values():
                defaultHeight = heightOptions.keys()[0]
            else: 
                defaultHeight = heightOptions.keys()[heightOptions.values().index(self.configObj.currentConfig["headHeight"])]

            if not self.configObj.currentConfig["spacingType"] in divisionTypeOptions.values():
                defaultDivOption = divisionTypeOptions.keys()[0]
            else:
                defaultDivOption = divisionTypeOptions.keys()[divisionTypeOptions.values().index(self.configObj.currentConfig["spacingType"])]

            if not self.configObj.currentConfig["storefrontPaneWidth"] in widthOptions.values():
                defaultWidthOption = widthOptions.keys()[0]
            else:
                defaultWidthOption = widthOptions.keys()[widthOptions.values().index(self.configObj.currentConfig["storefrontPaneWidth"])]

            self.components = [Label('PICK SYSTEM'),
                               ComboBox("combobox1", systemOptions, default=defaultSystem),
                               Label('HEAD HEIGHT'),
                               ComboBox("combobox2", heightOptions, default=defaultHeight),
                               Label('DIVISION TYPE'),
                               ComboBox("combobox3", divisionTypeOptions, default=defaultDivOption),
                               Label('DIVISION WIDTH'),
                               ComboBox("combobox4", widthOptions, default=defaultWidthOption),
                               Separator(),
                               Button('Go')]        
コード例 #4
0
ファイル: gui.py プロジェクト: pyhop/RevitMP
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 
コード例 #5
0
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
コード例 #6
0
ファイル: config.py プロジェクト: dnenov/pyChilizer
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()
コード例 #7
0
ファイル: script.py プロジェクト: htlcnn/pyrevitscripts
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)
コード例 #8
0
ファイル: SF2_GUI.py プロジェクト: tkahng/pyWest
    def SetFormComponents(self):
        from rpw.ui.forms import Button, CheckBox, ComboBox, Label, Separator, TextBox  # why does this have to be inside method?

        # set form buttons, text boxes, etc... | TextBox(componentName, defaultValue) is an option for manual entry
        # dropdown transomHeightOptions from above is not currently being used
        self.components = [  #Label('CHOOSE FLOORS'),
            #CheckBox("checkbox1", "something", default=True),
            Separator(),
            Label('PICK SYSTEM'),
            ComboBox("combobox1",
                     self.GUI_SF_systemOptions,
                     default=self.defaultSystem),
            Label('HEAD HEIGHT'),
            ComboBox("combobox2",
                     self.GUI_SF_heightOptions,
                     default=self.defaultHeight),
            Label('DIVISION TYPE'),
            ComboBox("combobox4",
                     self.GUI_SF_divisionOptions,
                     default=self.defaultDivOption),
            Label('DIVISION WIDTH'),
            ComboBox("combobox5",
                     self.GUI_SF_panelWidthOptions,
                     default=self.defaultWidthOption),
            Separator(),
            CheckBox("checkbox1", "NIB WALL SPLIT", default=True),
            CheckBox("checkbox2", "NIB WALL SPLIT ONLY", default=False),
            ComboBox("combobox6",
                     self.GUI_nibWallOptions,
                     default=self.defaultNibWallOption),
            ComboBox("combobox7",
                     self.GUI_nibWallLengthOptions,
                     default=self.defaultNibWallLengthOption),
            Separator(),
            Button('Go')
        ]
コード例 #9
0
                                                  defaultdict())

    components = addFields([], [
        '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()
コード例 #10
0
ファイル: script.py プロジェクト: dnenov/pyChilizer
    # quickly collect element belonging to a Design Option
    # quick filter
    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
コード例 #11
0
Framing_types = rpw.db.Collector(of_category='OST_StructuralFraming',
                                 is_type=True).elements

Framing_type_options = {
    t.FamilyName + DB.Element.Name.GetValue(t): t
    for t in Framing_types
}

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']))
コード例 #12
0
ファイル: script.py プロジェクト: tkahng/ISGpyRevit
            bbfilter = BoundingBoxIntersectsFilter(outline)
            elements2 = get_elements(fam2, selected)
            elements2.WherePasses(bbfilter)
            for e2 in elements2:
                try:
                    JoinGeometryUtils.JoinGeometry(doc, e1, e2)
                except Autodesk.Revit.Exceptions.ArgumentException:
                    pass


components = [
    Label('Cut Elements:'),
    ComboBox(
        'cut_element', {
            '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
コード例 #13
0
ファイル: script.py プロジェクト: ThomFgt/PyRevit
  # t.Start()
with db.Transaction('read xl sheet'):
  #Accessing the Excel applications.
  try:
    xlApp = System.Runtime.InteropServices.Marshal.GetActiveObject('Excel.Application')
  except:
    Alert('The Excel sheet must be open (the program failed because of a problem with Excel)', title = "Failed", exit = True)

  dicWs = {}
  count = 1
  for i in xlApp.Worksheets:
      dicWs[i.Name] = i
      count += 1

  components = [Label('Select the name of Excel sheet to import :'),
            ComboBox('combobox', dicWs),
            Label('Choose the units you used in your Excel sheet :'),
            ComboBox('combobox2', {'Meters': 3.048, 'Decimeters': 30.48, 'Centimeters': 304.8, 'Millimeters': 3048}),
            Label('Enter the number of points:'),
            TextBox('textbox', Text="11"),
            Separator(),
            Button('OK')]
  form = FlexForm('Title', components)
  form.show()

  worksheet = form.values['combobox']
  rowEnd = convertStr(form.values['textbox'])
  array = []
  fails = []
  for r in range(1, rowEnd):
    try:
コード例 #14
0
ファイル: script.py プロジェクト: dnenov/pyChilizer
family_instances = DB.FilteredElementCollector(doc).OfClass(
    DB.FamilyInstance).ToElements()  # get all family instance categories

# {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)
コード例 #15
0
ファイル: script.py プロジェクト: dnenov/pyHP
           ]


# check there's a Unit Type parameter
# 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)
コード例 #16
0
    #Accessing the Excel applications.
    xlApp = System.Runtime.InteropServices.Marshal.GetActiveObject(
        'Excel.Application')
    count = 1

    dicWs = {}
    count = 1
    for i in xlApp.Worksheets:
        dicWs[i.Name] = i
        count += 1

    components = [
        Label('Pick a category:'),
        ComboBox('combobox2', {
            'Doors': 0,
            '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)
コード例 #17
0
ファイル: script.py プロジェクト: nhuannguyen1/pyRevitnvn
    Label('Ceiling Heights'),
    TextBox('textbox4', Text="7000"),
    Label('Storefront Distance From Front'),
    TextBox('textbox5', Text="1000"),
    CheckBox('checkbox1', 'Rear Left Door'),
    CheckBox('checkbox2', 'Rear Right Door'),
    Separator(),
    Button('Go')
]

components_2 = [
    Label('FURNITURE & FIXTURES'),
    Label('Shelving Type:'),
    ComboBox("combobox1", {
        "Small": "1200_Width",
        "Medium": "1800_Width",
        "Large": "2400_Width"
    }),
    Label('Table Type:'),
    ComboBox("combobox2", {
        "Small": "1200_Width",
        "Medium": "1800_Width",
        "Large": "2400_Width"
    }),
    Label('#Tables Length'),
    TextBox('textbox6', Text="6"),
    Label('Tables Lengthwise Spacing'),
    TextBox('textbox7', Text="7000"),
    Label('#Tables Width'),
    TextBox('textbox8', Text="4"),
    Label('Tables Widthwise Spacing'),
コード例 #18
0
ファイル: script.py プロジェクト: htlcnn/pyrevitscripts
    foundation_famdoc.SaveAs(os.path.join(saveas_path, '{}.rfa'.format(new_filename)),
                            save_options)
    foundation_rfa_path = foundation_famdoc.PathName
    foundation_famdoc.Close(False)

    rpw.ui.forms.Alert('Finished creating foundation, saved at {}'.format(foundation_rfa_path))
    os.startfile(foundation_rfa_path)




foundations = rpw.db.Collector(of_class='Family',
                               where=lambda x: x.FamilyCategory.Name=='Structural Foundations')

components = [Label('Select Pile Cap:'),
            ComboBox('foundation_id', {f.Name: f.Id for f in foundations}),
            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:'),
コード例 #19
0
ファイル: script.py プロジェクト: kbruxvoort/SSG.extension
# Get list of linestyles to choose from
cat = revit.doc.Settings.Categories.get_Item(DB.BuiltInCategory.OST_Lines)
gs = cat.GetGraphicsStyle(DB.GraphicsStyleType.Projection)
gsCat = gs.GraphicsStyleCategory.SubCategories

all_text = DB.FilteredElementCollector(revit.doc)
all_text.OfClass(DB.TextNoteType).ToElements()

components = [
    Label("Border Size"),
    ComboBox(
        "combobox1",
        {
            '1/8"': 0.125 / 12,
            '1/4"': 0.25 / 12,
            '1/2"': 0.5 / 12,
            '3/4"': 0.75 / 12
        },
        default='1/2"',
    ),
    Label("Tag Type"),
    ComboBox(
        "combobox2",
        list_to_dict_2(multi_tags),
        default="SSG_Tag_Multicategory: SSG_Prefix",
    ),
    Label("Titleblock"),
    ComboBox("combobox3",
             list_to_dict_2(title_blocks),
             default="SSG_TB_8.5x11_PDF: Empty"),
    Label("View Template"),
コード例 #20
0
                            init_dir='',
                            restore_dir=True,
                            multi_file=False,
                            unc_paths=False)
Materials = rpw.db.Collector(of_category='OST_Materials',
                             is_type=False).get_elements(wrapped=False)
Materials_options = {t.Name: t for t in Materials}
CategoryID_options = {
    "常规模型": DB.BuiltInCategory.OST_GenericModel,
    "墙": DB.BuiltInCategory.OST_Walls
}

#信息输入部分
components = [
    Label('材质'),
    ComboBox('Material', Materials_options),
    Label('类型'),
    ComboBox('Category', CategoryID_options),
    Label('Rhino图层'),
    TextBox('Layer', Text="Default"),
    Button('确定')
]
form = FlexForm('结构', components)
form.show()
Value = form.values

Mat = Value['Material'].Id

Category = Value['Category']

RhinoFile = rc.FileIO.File3dm.Read(finlename)
コード例 #21
0
gen_cat = DB.FilteredElementCollector(doc) \
   .OfCategory(DB.BuiltInCategory.OST_GenericModel) \
   .WhereElementIsNotElementType() \
   .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'):
コード例 #22
0
selection = ui.Selection()
selected_rooms = [e for e in selection.get_elements(wrapped=False) if isinstance(e, Room)]
if not selected_rooms:
    UI.TaskDialog.Show('Создать отделку потолка', 'Необходимо выбрать помещение.')
    sys.exit()



#Get ceiling_types
ceiling_types = rpw.db.Collector(of_category='OST_Roofs', is_type=True).get_elements(wrapped=False)
#Select ceiling type
ceiling_type_options = {DB.Element.Name.GetValue(t): t for t in ceiling_types}
#Select ceiling types UI

components = [Label('Выберите тип потолка:'),
              ComboBox('cl_type', ceiling_type_options),
              Label('Введите привязку потолка к уровню :'),
              TextBox('h_offset', ceiling_offset="50.0"),
              CheckBox('checkbox1', 'Из помещения'),
              Button('Select')]
form = FlexForm('Создать отделку потолка',components)
win = form.show()

if win == False:
    sys.exit()

#Get the ID of ceiling ( NewFootPrintRoof )
ceiling_type_id = form.values['cl_type'].Id
if form.values['h_offset'] != "":
    offset3 = float(form.values['h_offset'])
else:
コード例 #23
0
        for curve_arr in profile:
            for curve in curve_arr:
                curves.append(curve)
        return List[DB.Curve](curves)


# format roof types dict for ui window
coll_rt = DB.FilteredElementCollector(doc).OfClass(DB.RoofType)
roof_type_dict = {rt.get_Parameter(DB.BuiltInParameter.ALL_MODEL_TYPE_NAME).AsString(): rt for rt in coll_rt}

# format document phases dict for ui window
doc_phases_dict = {ph.Name: ph for ph in doc.Phases}

# rwp UI: pick roof type and phase
components = [Label("Select Roof Type:"),
              ComboBox("combobox1", roof_type_dict),
              Label("Select Phase:"),
              ComboBox("combobox2", doc_phases_dict),
              Separator(),
              Button("Select")]
form = FlexForm("Settings", components)
form.show()
chosen_roof_type = form.values["combobox1"]
chosen_phase = form.values["combobox2"]

# collect roofs in project that are not in Insulation Phase
coll_all_roofs = DB.FilteredElementCollector(doc) \
    .OfClass(DB.RoofBase) \
    .WhereElementIsNotElementType() \
    .ToElements()
コード例 #24
0
ファイル: SF2_GUI.py プロジェクト: tkahng/pyWest
    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)
コード例 #25
0
selected_rooms = [
    e for e in selection.get_elements(wrapped=False) if isinstance(e, Room)
]
if not selected_rooms:
    UI.TaskDialog.Show('MakeWalls', 'You need to select at lest one Room.')
    sys.exit()

#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()
コード例 #26
0
ファイル: script.py プロジェクト: kbruxvoort/SSG.extension
    if view.IsTemplate:
        view_templates.append(view)

all_text = DB.FilteredElementCollector(revit.doc)
all_text.OfClass(DB.TextNoteType).ToElements()

# endtime = timer.get_time()
# print(endtime)

components = [
    Label("Border Size"),
    ComboBox(
        "combobox1",
        {
            '1/8"': 0.125 / 12,
            '1/4"': 0.25 / 12,
            '1/16"': 0.0625 / 12,
            "None": 0.001
        },
        default='1/16"',
    ),
    Label("Tag Type"),
    ComboBox(
        "combobox2",
        list_to_dict_2(mat_tags),
        default="SSG_Tag_Material_Swatch: Default",
    ),
    Label("Titleblock"),
    ComboBox("combobox3",
             list_to_dict_2(title_blocks),
             default="SSG_TB_8.5x11_PDF: Empty"),
    Label("View Template"),
コード例 #27
0
import revitron
from revitron import _
from rpw.ui.forms import FlexForm, TextBox, Button, Label, Separator, ComboBox, CheckBox
import System.Windows

defaultParameter = False
parameters = revitron.ParameterNameList().get()
selection = revitron.Selection.get()

if 'Family and Type' in parameters:
    defaultParameter = 'Family and Type'

components = [
    Label('Parameter Name'),
    ComboBox('parameter', parameters, default=defaultParameter),
    Label('Search String'),
    TextBox('search'),
    Separator(),
    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,
コード例 #28
0
LocationFile = select_file('CSV(*.csv)|*.csv')

# 信息输入部分
GenericCategory = rpw.db.Collector(of_category='OST_GenericModel',
                                   is_type=True).get_elements(wrapped=False)

Framing_type_options = {t.FamilyName: t for t in GenericCategory}

Level_type = db.Collector(of_category='Levels',
                          is_type=False).get_elements(wrapped=False)
Level_type_options = {DB.Element.Name: t for t in Level_type}

components = [
    Label('构件名称'),
    ComboBox('FamilyName', Framing_type_options),
    Button('确定')
]
Structure = []
form = FlexForm('结构', components)
form.show()

Value = form.values

Locations = []
with open(LocationFile, 'rbU') as csvfile:
    spamreader = csv.DictReader(csvfile)
    header = spamreader.fieldnames

    for row in spamreader:
        print(row)
コード例 #29
0
ファイル: script.py プロジェクト: tkahng/pyChilizer
# format wall types dict for ui window
coll_wt = DB.FilteredElementCollector(revit.doc).OfClass(DB.WallType)
filtered_types = [wt for wt in coll_wt if wt.Kind == DB.WallKind.Basic]
wall_type_dict = {
    ft.get_Parameter(DB.BuiltInParameter.ALL_MODEL_TYPE_NAME).AsString(): ft
    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()
コード例 #30
0
        if p.Definition.ParameterType.ToString() == "Area"
    ]

    if not gm_params_area:
        forms.alert(msg="No suitable parameter", \
                    sub_msg="There is no suitable parameter to use for Unit Area. Please add a shared parameter 'Unit Area' of Area Type", \
                    ok=True, \
                    warn_icon=True, exitscript=True)

    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