selected_sheets = forms.select_sheets(title='Select Target Sheets', button_name='Select Sheets') # get a list of viewports to be copied, updated if selected_sheets and len(selected_sheets) > 0: if int(__revit__.Application.VersionNumber) > 2014: cursheet = revit.uidoc.ActiveGraphicalView for v in selected_sheets: if cursheet.Id == v.Id: selected_sheets.remove(v) else: cursheet = selected_sheets[0] selected_sheets.remove(cursheet) revit.uidoc.ActiveView = cursheet selected_vps = revit.pick_elements() if selected_vps: with revit.Transaction('Copy Viewports to Sheets'): for sht in selected_sheets: existing_vps = [revit.doc.GetElement(x) for x in sht.GetAllViewports()] existing_schedules = [x for x in allSheetedSchedules if x.OwnerViewId == sht.Id] for vp in selected_vps: if isinstance(vp, DB.Viewport): src_view = revit.doc.GetElement(vp.ViewId) # check if viewport already exists # and update location and type if update_if_placed(vp, existing_vps): break
from pyrevit import revit, DB, UI from pyrevit import forms from pyrevit import script cursheet = revit.active_view forms.check_viewtype(cursheet, DB.ViewType.DrawingSheet, exitscript=True) dest_sheet = forms.select_sheets(title='Select Target Sheets', button_name='Select Sheets', multiple=False, include_placeholder=False, use_selection=True) selected_vports = [] if dest_sheet: sel = revit.pick_elements() for el in sel: selected_vports.append(el) if len(selected_vports) > 0: with revit.Transaction('Move Viewports'): for vp in selected_vports: if isinstance(vp, DB.Viewport): viewId = vp.ViewId vpCenter = vp.GetBoxCenter() vpTypeId = vp.GetTypeId() cursheet.DeleteViewport(vp) nvp = DB.Viewport.Create(revit.doc, dest_sheet.Id, viewId, vpCenter) nvp.ChangeTypeId(vpTypeId) elif isinstance(vp, DB.ScheduleSheetInstance):
import sys import rpw import pyrevit from rpw import db, doc, uidoc from pyrevit import revit, DB, UI, forms, HOST_APP import System from System.Collections.Generic import List from pyrevit.framework import Stopwatch m_offset = DB.XYZ(0, 100, 45) ###################################### m_servers = [] m_documents = [] picked = revit.pick_elements() class RenderingPassBufferStorage: def __init__(self, displayStyle): self.DisplayStyle = displayStyle self.Line = [] self.FormatBits = '' self.PrimitiveCount = '' self.VertexBufferCount = '' self.IndexBufferCount = '' self.VertexBuffer = '' self.IndexBuffer = '' self.VertexFormat = '' self.EffectInstance = ''
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") with forms.WarningBar(title="Pick instances to add to legend:"): source_elements = revit.pick_elements() values = [] if source_elements: # Filtering for current sheets to get highest sheet number current_sheets = [] all_sheets = (DB.FilteredElementCollector(revit.doc).OfCategory( DB.BuiltInCategory.OST_Sheets).ToElements()) for s in all_sheets: try: num = math.floor(float(s.SheetNumber)) current_sheets.append(num) except ValueError: continue # print("current sheets: ", current_sheets)
# -*- coding: utf-8 -*- __doc__ = "返回选择物体的类型" import rpw import clr from rpw import db, doc from pyrevit import revit, DB, HOST_APP, UI from rpw.ui.forms import FlexForm, Label, ComboBox, TextBox, TextBox, Separator, Button, SelectFromList floor = revit.pick_element() beams = revit.pick_elements() #out_sUV = clr.Reference[DB.UV]() #out_eUV = clr.Reference[DB.UV]() #out_sDistance = clr.Reference[float]() #out_eDistance = clr.Reference[float]() currentView = revit.uidoc.ActiveView @rpw.db.Transaction.ensure('CreateBeam') def CreateBeam(Curve, FamilySymbol, Level, StructureType): doc.Create.NewFamilyInstance(Curve, FamilySymbol, Level, StructureType) @rpw.db.Transaction.ensure('DeleteFamilyInstance') def DeleteFamilyInstance(FamilyInstanceId): doc.Delete(FamilyInstanceId) for beam in beams:
__doc__ = "创建" from pyrevit.framework import List from pyrevit import forms from pyrevit import revit, DB from pyrevit import HOST_APP import rpw from rpw import db from rpw.extras.rhino import Rhino as rc import Helper from collections import Counter rg = rc.Geometry curview = revit.activeview curdoc = revit.doc pickpipes = revit.pick_elements() class BAT_ST_Beam: def __init__(self, framing): self.framing = framing def BaseLevel(self): BaseLevel = self.framing.get_Parameter( DB.BuiltInParameter.STRUCTURAL_ELEVATION_AT_BOTTOM).AsValueString( ) return float(BaseLevel) def distance(self): TopLevel = self.framing.get_Parameter( DB.BuiltInParameter.STRUCTURAL_ELEVATION_AT_TOP).AsValueString()