コード例 #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 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')
コード例 #3
0
 def SetFormComponents(self):
     from rpw.ui.forms import Button, CheckBox, Label, Separator, TextBox # why does this have to be inside method?
     self.components = [CheckBox("checkbox1", "VIEWS", default=False),
                        CheckBox("checkbox2", "SHEETS", default=False),
                        CheckBox("checkbox3", "ROOMS", default=False),
                        
                        Label("SEARCH TEXT"),
                        TextBox("textbox1"),
                        
                        Label("TARGET TEXT"),
                        TextBox("textbox2"),
                   
                        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 addFields(components, fields):
    for field in fields:
        if field == '---':
            components.append(Separator())
        else:
            key = revitron.String.sanitize(field)
            components.append(Label(field))
            components.append(TextBox(key, Text=config.get(key)))
    return components
コード例 #6
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
コード例 #7
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
コード例 #8
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)
コード例 #9
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')
        ]
コード例 #10
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()
コード例 #11
0
    gm_params_area = [
        p for p in gm_parameter_set
        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"]
コード例 #12
0
    config = revitron.DocumentConfigStorage().get('revitron.export',
                                                  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()
コード例 #13
0
ファイル: script.py プロジェクト: dnenov/pyChilizer
def get_elements_by_do(do, doc=revit.doc):
    # 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)
コード例 #14
0
Picked_Selection = db.Element.from_id(PickedElementId)
# 信息输入部分
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']
コード例 #15
0
ファイル: script.py プロジェクト: tkahng/ISGpyRevit
        elements1 = get_elements(fam1, selected)
        for e1 in elements1.get_elements():
            bb = e1.BoundingBox[doc.ActiveView]
            outline = Outline(bb.Min, bb.Max)
            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'),
コード例 #16
0
ファイル: script.py プロジェクト: ThomFgt/PyRevit
  # t = Transaction(doc, 'Read Excel spreadsheet.') 
  # 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):
コード例 #17
0
ファイル: script.py プロジェクト: dnenov/pyHP
           "STORAGE"
           ]


# 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")]
コード例 #18
0
    ParameterName = LG_CHS()

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:
コード例 #19
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('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()
コード例 #20
0
ファイル: script.py プロジェクト: htlcnn/pyrevitscripts
    new_filename = ff.values['new_foundation_family_name'] or 'new_{}'.format(foundation_famdoc.Title)
    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'),
コード例 #21
0
ファイル: script.py プロジェクト: kbruxvoort/SSG.extension
all_views = DB.FilteredElementCollector(revit.doc).OfClass(
    DB.View).ToElements()
for view in all_views:
    if view.IsTemplate:
        view_templates.append(view)

# 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",
コード例 #22
0
	new_viewset.Insert(i)

# get the PrintManger from the current document 
printman = doc.PrintManager 
	# 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() : 
コード例 #23
0
    else:
        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
ファイル: script.py プロジェクト: nhuannguyen1/pyRevitnvn
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
clr.AddReference("RevitNodes")

from pyrevitnvn.units import (Convert_length,
                              Convert_Display_length_To_Internal)
from pyrevitnvn.reauto import (get_edges_lines_corners_main,
                               plot_design_cordninates)

doc = __revit__.ActiveUIDocument.Document
tt = Transaction(doc, "Retail Automation")

#UI form organization
components_1 = [
    Label('SUITE EXTENTS'),
    Label('Bays Length'),
    TextBox('textbox1', Text="7000, 8000, 6000, 9000, 5000, 5000, 7000"),
    Label('Bays Width'),
    TextBox('textbox2', Text="7000,7000,7000,7000,7000"),
    Label('Wall Heights'),
    TextBox('textbox3', Text="7000"),
    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')
]
コード例 #25
0
        return (dim)


from rpw import revit, db
from rpw.ui.forms import (FlexForm, Label, ComboBox, TextBox, TextBox,
                          Separator, Button, CheckBox)
from rpw import ui
from rpw.ui.forms import select_file
from Autodesk.Revit.DB import Transaction
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)
コード例 #26
0
    t = Transaction(doc, 'Read Excel spreadsheet.')
    t.Start()

    #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(),
コード例 #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
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

import rpw
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)
コード例 #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() \
コード例 #30
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)