Exemple #1
0
    def purgeProcess(self, sender, args):
        if doc.GetWorksharingCentralModelPath():
            centralPath = ModelPathUtils.ConvertModelPathToUserVisiblePath(
                doc.GetWorksharingCentralModelPath())
            res = TaskDialog.Show(
                'pyrevit',
                'The central model is located at:\n {0}\n\nAre you sure you want to wipe?'
                .format(centralPath),
                TaskDialogCommonButtons.Yes | TaskDialogCommonButtons.Cancel)
            if res == TaskDialogResult.Cancel:
                __window__.Close()
                return

        self.systemWindow.Hide()
        __window__.Show()
        report('\n\n')
        report('                                PRINTING FULL REPORT',
               title=True)
        report('\n\n')
        tg = TransactionGroup(doc, "Purge Model for GC")
        tg.Start()

        if self.removeAllExternalLinksCheckBox.IsChecked:
            removeAllExternalLinks()
        if self.removeAllRoomsCheckBox.IsChecked:
            removeAllRooms()
            removeAllRoomSeparationLines()
        if self.removeAllAreasCheckBox.IsChecked:
            removeAllAreas()
            removeAllAreaSeparationLines()
        if self.explodeAndRemoveAllGroupsCheckBox.IsChecked:
            explodeAndRemoveAllGroups()
        if self.removeAllScopeBoxesCheckBox.IsChecked:
            removeAllScopeBoxes()
        if self.removeAllReferencePlanesCheckBox.IsChecked:
            removeAllReferencePlanes()
        if self.removeAllConstraintsCheckBox.IsChecked:
            removeAllConstraints()
        if self.removeAllSheetsCheckBox.IsChecked:
            removeAllSheets()
        if self.removeAllViewsCheckBox.IsChecked:
            removeAllViews()
            removeAllElevationMarkers()
        if self.removeAllViewTemplatesCheckBox.IsChecked:
            removeAllViewTemplates()
        if self.removeAllFiltersCheckBox.IsChecked:
            removeAllFilters()
        if self.removeAllMaterialsCheckBox.IsChecked:
            removeAllMaterials()

        tg.Commit()
        self.systemWindow.Close()

        if self.callPurgeCommandCheckbox.IsChecked:
            from Autodesk.Revit.UI import PostableCommand as pc
            from Autodesk.Revit.UI import RevitCommandId as rcid
            cid_PurgeUnused = rcid.LookupPostableCommandId(pc.PurgeUnused)
            __revit__.PostCommand(cid_PurgeUnused)

        print(outputs.getvalue())
def createobj(typename):

    wallType = GetFirstWallTypeNamed(doc, wallTypeName)
    wall = GetFirstWallUsingType(doc, wallType)

    if not wall:
        line = DB.Line.CreateBound(XYZ.Zero, XYZ(2, 0, 0))

        feclevel = FilteredElementCollector(doc).OfClass(
            Level).FirstElement()  # Level1

        t = Transaction(doc, "Create dummy Wall")
        t.Start()
        # wall.Create(doc, IList(Curve),walltypeId, levelId, bool structural, XYZ normal)
        #(doc, Curve, wallTypeId, LevelId,height double, offset double, flip bool, struc bools)
        #(doc, IList(curve), walltypId, levelId, structural bool)
        height = 2 * 3.048
        wall = Wall.Create(doc, line, wallType.Id, feclevel.Id, height, 0.0,
                           False, False)
        t.Commit()

    if wall:
        # Select it/Add it to Selection
        listId = List[ElementId]()
        listId.Add(wall.Id)
        uidoc.Selection.SetElementIds(listId)

    try:
        revitcomid = RevitCommandId.LookupPostableCommandId(
            PostableCommand.CreateSimilar)
        if revitcomid: uiapp.PostCommand(revitcomid)
    except:
        import traceback
        print traceback.format_exc()
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

See this link for a copy of the GNU General Public License protecting this package.
https://github.com/eirannejad/pyRevit/blob/master/LICENSE
"""

__doc__ = 'Selects all Text Note elements & launches spell check.'

__window__.Close()
from Autodesk.Revit.DB import FilteredElementCollector, ElementId, BuiltInCategory, TextNote, Group
from System.Collections.Generic import List

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document

textnotes = FilteredElementCollector(doc).OfClass(
    TextNote).WhereElementIsNotElementType().ToElements()

selSet = []

for el in textnotes:
    selSet.append(el.Id)

uidoc.Selection.SetElementIds(List[ElementId](selSet))

from Autodesk.Revit.UI import PostableCommand as pc
from Autodesk.Revit.UI import RevitCommandId as rcid
cid_CheckSpelling = rcid.LookupPostableCommandId(pc.CheckSpelling)
__revit__.PostCommand(cid_CheckSpelling)
Exemple #4
0
'''
Copyright (c) 2014-2016 Ehsan Iran-Nejad
Python scripts for Autodesk Revit

This file is part of pyRevit repository at https://github.com/eirannejad/pyRevit

pyRevit is a free set of scripts for Autodesk Revit: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3, as published by
the Free Software Foundation.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

See this link for a copy of the GNU General Public License protecting this package.
https://github.com/eirannejad/pyRevit/blob/master/LICENSE
'''
__window__.Width = 1000
from Autodesk.Revit.UI import PostableCommand, RevitCommandId
for pc in PostableCommand.GetValues(PostableCommand):
	try:
		rcid = RevitCommandId.LookupPostableCommandId(pc)
		if rcid:
			print('{0} {1} {2}'.format(str(pc).ljust(50), str(rcid.Name).ljust(70), rcid.Id))
		else:
			print('{0}'.format(str(pc).ljust(50)))
	except:
		print('{0}'.format(str(pc).ljust(50)))
Exemple #5
0
https://github.com/eirannejad/pyRevit/blob/master/LICENSE
"""

__doc__ = 'Copies the Elements Ids of the selected elements into the clipboard memory. You can then use ' \
          'Revit\'s own "Select By Id" tool, paste the Ids into the textbox from clipboard and ' \
          'click on the show button. For convenience this tool will call the "Select By Id" tool after copying.'


__window__.Close()
from Autodesk.Revit.UI import PostableCommand as pc
from Autodesk.Revit.UI import RevitCommandId as rcid
import os

uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document


def addtoclipboard(text):
    command = 'echo ' + text.strip() + '| clip'
    os.system(command)


selectedIds = ''

for elId in uidoc.Selection.GetElementIds():
    selectedIds = selectedIds + str(elId) + ','

cid_SelectById = rcid.LookupPostableCommandId(pc.SelectById)
addtoclipboard(selectedIds)
__revit__.PostCommand(cid_SelectById)
Exemple #6
0
#             # 1002 call TaskDialogResult.CommandLink2
#             # int(TaskDialogResult.CommandLink2) to check the result
#     except Exception:
#         pass  # print(e) # uncomment this to debug


def AppDialogShowing(sender, args):
    dialogId = args.DialogId
    promptInfo = "A Revit dialog will be opened.\n"
    promptInfo += "The DialogId of this dialog is " + dialogId + "\n"
    promptInfo += "If you don't want the dialog to open, please press cancel button"

    taskDialog = TaskDialog("Revit")
    taskDialog.Id = "Customer DialogId"
    taskDialog.MainContent = promptInfo
    buttons = TaskDialogCommonButtons.Ok | TaskDialogCommonButtons.Cancel
    taskDialog.CommonButtons = buttons
    result = taskDialog.Show()
    if TaskDialogResult.Cancel == result:
        args.OverrideResult(1)
    else:
        args.OverrideResult(0)


uiapp.DialogBoxShowing += AppDialogShowing
e = uiapp.PostCommand(
    RevitCommandId.LookupPostableCommandId(PostableCommand.PropertyLine))
uiapp.DialogBoxShowing -= AppDialogShowing

OUT = "Тест"
Exemple #7
0
def call_purge():
    """Call Revit "Purge Unused" after completion."""
    from Autodesk.Revit.UI import PostableCommand as pc
    from Autodesk.Revit.UI import RevitCommandId as rcid
    cid_PurgeUnused = rcid.LookupPostableCommandId(pc.PurgeUnused)
    __revit__.PostCommand(cid_PurgeUnused)
Exemple #8
0
def createDefault3DView(uiapp):
    def3dCmd = RevitCommandId.LookupPostableCommandId(
        PostableCommand.Default3DView)
    if uiapp.CanPostCommand(def3dCmd):
        uiapp.PostCommand(def3dCmd)
Exemple #9
0
def callPurgeCommand():
    from Autodesk.Revit.UI import PostableCommand as pc
    from Autodesk.Revit.UI import RevitCommandId as rcid
    cid_PurgeUnused = rcid.LookupPostableCommandId(pc.PurgeUnused)
    __revit__.PostCommand(cid_PurgeUnused)