Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MEPDesign Inclusion #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions pyRevitMEP.tab/Clear Mark.panel/ClearMark.pushbutton/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# -*- coding: utf-8 -*-
""" Clear Mark Parameter of MEP elements."""

__title__ = 'Clear Mark'
__author__ = 'André Rodrigues da Silva'

from rpw import revit, db
from rpw.ui.forms import (FlexForm, Label, ComboBox, TextBox, TextBox,Separator, Button, CheckBox)
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('Clear Mark Parameter:'),
Label('Mark Parameter:'),
TextBox('textbox1', Text="Mark"),
Separator(),
Button('Process')]
form = FlexForm('Clear Mark Parameter', 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)
ConexoesDuto = db.Collector(of_category='OST_DuctFitting',is_not_type=True)
AcessoriosDuto = db.Collector(of_category='OST_DuctAccessory',is_not_type=True)
EquipamentosMecanicos = db.Collector(of_category='OST_MechanicalEquipment',is_not_type=True)

Elementos = []

"""
if len(Tubos)>0:
for i in range(0,len(Tubos)):
Elementos.append(Tubos[i])
"""

if len(ConexoesTubo)>0:
for i in range(0,len(ConexoesTubo)):
Elementos.append(ConexoesTubo[i])
if len(AcessoriosTubo)>0:
for i in range(0,len(AcessoriosTubo)):
Elementos.append(AcessoriosTubo[i])
if len(AcessoriosTubo)>0:
for i in range(0,len(Equipamentos)):
Elementos.append(Equipamentos[i])
if len(ConexoesDuto)>0:
for i in range(0,len(ConexoesDuto)):
Elementos.append(ConexoesDuto[i])
if len(AcessoriosDuto)>0:
for i in range(0,len(AcessoriosDuto)):
Elementos.append(AcessoriosDuto[i])
if len(EquipamentosMecanicos)>0:
for i in range(0,len(EquipamentosMecanicos)):
Elementos.append(EquipamentosMecanicos[i])

# Typical Transaction in Revit Python Shell / pyRevit
doc = __revit__.ActiveUIDocument.Document
transaction = Transaction(doc, 'Delete Object')
transaction.Start()

try:
Mark = form.values['textbox1']
for i in range(0,len(Elementos)):
Elementos[i].LookupParameter(Mark).Set('')

except:
transaction.RollBack()
else:
transaction.Commit()

except:
pass
2 changes: 2 additions & 0 deletions pyRevitMEP.tab/Clear Mark.panel/bundle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
layout:
- ClearMark
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
209 changes: 209 additions & 0 deletions pyRevitMEP.tab/Code.panel/PipeCode.pushbutton/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
# -*- coding: utf-8 -*-
""" Insert code in ALL pipes."""

__title__ = 'Pipe'
__author__ = 'André Rodrigues da Silva'


import clr
clr.AddReference("PresentationFramework")
from System.Windows import Window

file = ''
class ButtonClass(Window):
@staticmethod
def Importarbase(sender, e):
global file
file = select_file('csv separated by semicolon (*.csv)|*.csv')
return(file)

def RevitCodes(dim):
if(dim == '15'):
return ('0.049212598425196846')
if(dim == '16'):
return ('0.052493438320209973')
if(dim == '20'):
return ('0.065616797900262466')
if(dim == '22'):
return ('0.072178477690288706')
if(dim == '25'):
return ('0.082020997375328086')
if(dim == '28'):
return ('0.091863517060367453')
if(dim == '32'):
return ('0.10498687664041995')
if(dim == '35'):
return ('0.11482939632545931')
if(dim == '40'):
return ('0.13123359580052493')
if(dim == '42'):
return ('0.13779527559055119')
if(dim == '50'):
return ('0.16404199475065617')
if(dim == '54'):
return ('0.17716535433070865')
if(dim == '60'):
return ('0.19685039370078738')
if(dim == '63'):
return ('0.20669291338582677')
if(dim == '73'):
return ('0.23950131233595801')
if(dim == '75'):
return ('0.24606299212598426')
if(dim == '85'):
return ('0.27887139107611547')
if(dim == '89'):
return ('0.29199475065616798')
if(dim == '90'):
return ('0.29527559055118108')
if(dim == '100'):
return ('0.32808398950131235')
if(dim == '110'):
return ('0.36089238845144356')
if(dim == '114'):
return ('0.37401574803149606')
if(dim == '150'):
return ('0.49212598425196852')
if(dim == '200'):
return ('0.65616797900262469')
if(dim == '12.7'):
return ('0.041666666666666664')
if(dim == '19.05'):
return ('0.0625')
if(dim == '19.10'):
return ('0.062664041994750661')
if(dim == '25.40'):
return ('0.083333333333333329')
if(dim == '31.75'):
return ('0.10433070866141732')
if(dim == '38.10'):
return ('0.125')
if(dim == '50.80'):
return ('0.16666666666666666')
if(dim == '50.80'):
return ('0.16666666666666666')
if(dim == '63.50'):
return ('0.20833333333333334')
if(dim == '76.20'):
return ('0.25')
if(dim == '101.60'):
return ('0.33333333333333331')
if(dim == '45'):
return ('0.7853981633974475')
if(dim == '90'):
return ('1.570796326794895')

else:
return(dim)


from rpw import revit, db
from rpw.ui.forms import (FlexForm, Label, ComboBox, TextBox, TextBox,Separator, Button, CheckBox)
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 all 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 all pipes', components)
form.show()

Tubos = db.Collector(of_category='OST_PipeCurves',is_not_type=True)
Dutos = db.Collector(of_category='OST_DuctCurves',is_not_type=True)
TubosFlexiveis = db.Collector(of_category='OST_FlexPipeCurves',is_not_type=True)
DutosFlexiveis = db.Collector(of_category='OST_FlexDuctCurves',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)


Elementos = []


if len(Tubos)>0:
for i in range(0,len(Tubos)):
Elementos.append(Tubos[i])
if len(Dutos)>0:
for i in range(0,len(Dutos)):
Elementos.append(Dutos[i])
if len(TubosFlexiveis)>0:
for i in range(0,len(TubosFlexiveis)):
Elementos.append(TubosFlexiveis[i])
if len(DutosFlexiveis)>0:
for i in range(0,len(DutosFlexiveis)):
Elementos.append(DutosFlexiveis[i])


with open(file,'r') as csv_file:
lines = csv_file.readlines()

line = lines[0].split(";")
codigo_construtora = form.values['textbox1']
descricao_construtora = form.values['textbox2']
a = 0
b = 0

for i in range(0,len(line)):
if(line[i] == codigo_construtora):
a = i
#if(line[i] == descricao_construtora):
#b = i


FamilyName = []
Parameter1 = []
Parameter2 = []
Parameter3 = []
Parameter4 = []
Angle = []
Indice = []
ProductDescription = []
Parameter5 = []
CODIGO = []
DESCRICAO = []

for line in lines:
data = line.split(';')
FamilyName.append(data[0])
Parameter1.append(data[1])
Parameter2.append(data[2])
Parameter3.append(data[3])
Parameter4.append(data[4])
Angle.append(data[5])
Indice.append(data[6])
ProductDescription.append(data[7])
Parameter5.append(data[8])
CODIGO.append(data[a])
DESCRICAO.append(data[a+1])

# Typical Transaction in Revit Python Shell / pyRevit
doc = __revit__.ActiveUIDocument.Document
transaction = Transaction(doc, 'Insert parameters')
transaction.Start()

try:
for i in range(0,len(Elementos)):
for t in range(0,len(FamilyName)):
if(Parameter2[t]=='' and Parameter3[t]=='' and Parameter4[t]=='' and Angle[t]=='' and Indice[t]=='' and ProductDescription[t]=='' and Parameter5[t]==''):
info1 = list(Parameter1[t].split('='))
if(Elementos[i].Name == FamilyName[t] and Elementos[i].LookupParameter(info1[0]).AsDouble() == float(RevitCodes(info1[1]))):
Elementos[i].LookupParameter(codigo_construtora).Set(CODIGO[t])
Elementos[i].LookupParameter(descricao_construtora).Set(DESCRICAO[t])

except:
transaction.RollBack()
else:
transaction.Commit()

except:
pass
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading