Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

chuongmep

💭
I may be slow to respond.
View GitHub Profile
View Add Share Family Parameter To Family.py
#Copyright(c)2020,chuongho
#@chuongmep,https://chuongmep.com/
import clr
clr.AddReference('ProtoGeometry')
clr.AddReference('RevitAPI')
clr.AddReference("RevitServices")
from Autodesk.DesignScript.Geometry import *
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
View Find Network Pipe.py
import clr
import math
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import System
clr.AddReference("RevitServices")
import RevitServices
View CheckelementDuplicate.py
mylist = IN[0]
i, seen, result = mylist, set(), []
for _index, item in enumerate(i):
if item not in seen:
seen.add(item)
else:
result.append(_index)
OUT = result
View DialuxfilterRoom.py
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
arr = IN[0]
posArr = list(filter(lambda a: ("Room" in a), arr))
def splitFn(a):
View DiaLuxFilterByItemString.py
#Copyright(c) 2020, chuongho
# @chuongmep, https://chuongmep.com/
data = IN[0]
item = IN[1]
newlst = []
i=0
for n in item:
i = i+1
try:
lst = data[data.index(n):data.index(item[i])]
View DialuxfilterPos.py
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
dataEnteringNode = IN
arr = IN[0]
posArr = list(filter(lambda a: ("Pos" in a), arr))
def splitFn(a):
return a.split("=")[1]
View LibDynamo.py
#Copyright(c)2020,chuongho
#@chuongmep,https://chuongmep.com/
import clr
clr.AddReference('ProtoGeometry')
clr.AddReference('RevitAPI')
clr.AddReference("RevitServices")
from Autodesk.DesignScript.Geometry import *
from Autodesk.Revit.DB import *
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
View DefGroup.py
spfile = app.OpenSharedParameterFile()
def defFile(spfile, group, param):
defGroup = spfile.Groups.get_Item(group)
return defGroup.Definitions.get_Item(param)
View Input ShareParameter.py
def tolist(obj1):
if hasattr(obj1,"__iter__"): return obj1
else : return [obj1]
fams = UnwrapElement(tolist(IN[0]))
params = IN[1]
group = IN[2]
paramGroup = IN[3]
instance = IN[4]
logs = []
if not isinstance(params, list): params = [params]
View Modify Share Family Parameter To Family.py
try:
for f in fams:
try:
spfile = app.OpenSharedParameterFile()
except:
log = 'No Shared Parameter file found!'
family = UnwrapElement(f)
TransactionManager.Instance.ForceCloseTransaction()