Пример #1
0
def get_all_elements(doc=None):
    #  .WhereElementIsNotElementType()\
    return DB.FilteredElementCollector(doc or HOST_APP.doc)\
             .WherePasses(
                 DB.LogicalOrFilter(
                     DB.ElementIsElementTypeFilter(False),
                     DB.ElementIsElementTypeFilter(True)))\
             .ToElements()
Пример #2
0
    selection = revit.get_selection()

    for el in selection:
        if isline(el):
            print('Line ID: {0}'.format(el.Id))
            print('Start:\t {0}'.format(el.GeometryCurve.GetEndPoint(0)))
            print('End:\t {0}\n'.format(el.GeometryCurve.GetEndPoint(1)))
        else:
            print('Elemend with ID: {0} is a not a line.\n'.format(el.Id))

elif selected_switch == 'Data Schema Entities':
    allElements = \
        list(DB.FilteredElementCollector(revit.doc)
               .WherePasses(
                   DB.LogicalOrFilter(DB.ElementIsElementTypeFilter(False),
                                      DB.ElementIsElementTypeFilter(True))
            )
        )

    guids = {sc.GUID.ToString(): sc.SchemaName
             for sc in DB.ExtensibleStorage.Schema.ListSchemas()}

    for el in allElements:
        schemaGUIDs = el.GetEntitySchemaGuids()
        for guid in schemaGUIDs:
            if guid.ToString() in guids.keys():
                print('ELEMENT ID: {0}\t\t'
                      'SCHEMA NAME: {1}'
                      .format(el.Id.IntegerValue,
                              guids[guid.ToString()]))