Fabrication in Revit® > Fabrication Parts in Revit®

Ancillaries in Revit

<< < (2/8) > >>

bitterfitter:
Axl - I hear you there with the buggyness and constant attention needed.  Just knowing this info is stored in the support is all I need to know.  I can take it from there to extract the info and use it.  Just being fairly new to Revit , I am still unsure of just what I can actually pull from the items.  thanks for the insight.  I will fire up Dynamo and see what kind of trouble I can get into...   ;D
Any chance someone knows off hand which data line contains the info on the structure the support is attached to?

Axl:
There is very few people working on this, it took me months to get to the point of having a usable product, but I'm 100% willing to share with this forum that has helped me so much in the past,

first try this link,
https://www.revitapidocs.com/2022/d1b925eb-9fde-0c61-e416-25b4e98a8fd4.htm

the query will return an object with multiple "lines" of information, the way I do it is to loop through it and get all values, there is also Get rod length, position, attached and end position (for trimble information) search for Get Rod in the link to get more information.

The following are Python nodes that I've created to extract some of the Rod's related information, feel free to use it and change it according to your needs, you need to build a lot around them but those will be only simple existing blocks, the hard part is to get these python scripts working correctly.

Remember these are very customized scripts and you will see some things that probably you won't need

Code sample to extract coordinates:

--- Code: ---import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import FabricationPart
from Autodesk.Revit.DB import FabricationRodInfo

Inpt = UnwrapElement(IN[0])
List = []
count =IN[1]
ItmList = list()
ItmList1 = list()
ItmList2 = list()
coor_list = list()
new_list = list()
neo_list = list()
if count == 1:
List.append(Inpt)
for e in List:
STName = e.GetRodInfo().RodCount
ItmList1.append(STName)
STName1 = e.GetRodInfo()
for n in range(STName):
test = STName1.GetRodLength(n)
test1 = STName1.GetRodEndPosition(n)
ItmList.append(test)
ItmList2.append(test1)
coo_pnt = str(test1).split(",")
coor_list.append(coo_pnt)
str_coor = ''
if count > 1:
for e in Inpt:
STName = e.GetRodInfo().RodCount
ItmList1.append(STName)
STName1 = e.GetRodInfo()
for n in range(STName):
test = STName1.GetRodLength(n)
test1 = STName1.GetRodEndPosition(n)
ItmList.append(test)
ItmList2.append(test1)
coo_pnt = str(test1).split(",")#.replace("(","").replace(")","")
for c in coo_pnt:
cc = c.replace("(","").replace(")","")
ccc = round(float(cc),2)
coor_list.append(ccc)
str_coor += str(ccc)+','
str_coor2 = '('+str_coor+')'
new_list.append(str_coor2)
str_coor = ''
str_coor2 = ''
coor_list = list()


OUT = ItmList, ItmList1, ItmList2, new_list


--- End code ---

Code sample to get Rod Count:


--- Code: ---import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import FabricationPart
from Autodesk.Revit.DB import FabricationRodInfo

Inpt = UnwrapElement(IN[0])
rcnt = list()
count = len(Inpt)

if count == 1:
List.append(Inpt)
for e in List:
STName = e.GetRodInfo().RodCount
rcnt.append(STName)
if count > 1:
for e in Inpt:
STName = e.GetRodInfo().RodCount
rcnt.append(STName)

OUT = rcnt

--- End code ---

Code Sample to get Rod Diameter:


--- Code: ---import clr
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import System
from System import Array

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import FabricationPart
from Autodesk.Revit.DB import FabricationAncillaryUsage
from Autodesk.Revit.DB.Fabrication import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
from Revit import Elements

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

Inpt = UnwrapElement(IN[0])
Cnt = len(Inpt)
AnciCnt = list()
AnciObj = list()
AnciID = list()
AnciDiam = list()
AnciType = list()
AnciDepth = list()
AnciValid = list()
AnciLngth = list()
AnciProdCde = list()
AnciQty = list()
AnciUseTyp = list()
diamlist = list()
hgrlist = list()

clr.ImportExtensions(Revit.GeometryConversion)

Doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
TransactionManager.Instance.EnsureInTransaction(Doc)
cntr = 1
paramslist = list()
if Cnt > 1:
for e in Inpt:
AnciObj = e.GetPartAncillaryUsage()
AnciCnt.append(len(AnciObj))
diamlist.append(e)
#diamlist.append(cntr)
hgrName = e.ProductShortDescription
hgrlist.append(hgrName)
if "CT-69" in hgrName:
vv = '0.03125'
AnciDiam.append(vv)
for n in AnciObj:
AnciID.append(n.AncillaryId)
AnciType.append(n.Type)
vv = n.AncillaryWidthOrDiameter
tt = str(n.Type)
#AnciDiam.append(vv)
# if vv != 0:
# AnciDiam.append(vv)
if tt == "SupportRod":
AnciDiam.append(vv)
#AnciDiam.append(cntr)
# AnciDiam.append(tt)
cntr = cntr + 1
else:
part = Inpt[0]
AnciObj = part.GetPartAncillaryUsage()
AnciCnt.append(len(AnciObj))
for n in AnciObj:
AnciID.append(n.AncillaryId)
vv = n.AncillaryWidthOrDiameter
tt = str(n.Type)
#AnciDiam.append(vv)
# if vv != 0:
# AnciDiam.append(vv)
if tt == "SupportRod":
AnciDiam.append(vv)
# AnciDiam.append(tt)


TransactionManager.Instance.TransactionTaskDone()

OUT = AnciDiam
--- End code ---

bitterfitter:
Axl - Thanks for the reference material on writing with Python.  I does help a lot.  I did have a quick question about when you are pulling the rod diameters with your code.  I see how you are doing it but I noticed one thing I get in my data that drives me nuts and I am not just yet to the point of altering your code.  If I run 14 hangers through your script, but 2 do not have a value for the rod diameter; like if I am using hanger strap, then the script only reports 12 diameters.  Worst part is that the rod diameters no longer line up with the hanger element they are pulled from.  I have tried working with this after the script with nodes, but it appears I should be matching them up in the script itself.  Is this something that is possible in Python.  To hold the diameters to the elements they are pulled from?  maybe by placing a zero in for the missing data?

Axl:
Indeed it is possible,

possible root cause: the rod information is missing on those hangers, or the hangers have no rods, I usually filter those hangers out by either code or Revit filters,

try this code, the only difference is that check if vv value is empty and make it a zero, I have not tested it, good luck :)


--- Code: ---import clr
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import System
from System import Array

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import FabricationPart
from Autodesk.Revit.DB import FabricationAncillaryUsage
from Autodesk.Revit.DB.Fabrication import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
from Revit import Elements

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

Inpt = UnwrapElement(IN[0])
Cnt = len(Inpt)
AnciCnt = list()
AnciObj = list()
AnciID = list()
AnciDiam = list()
AnciType = list()
AnciDepth = list()
AnciValid = list()
AnciLngth = list()
AnciProdCde = list()
AnciQty = list()
AnciUseTyp = list()
diamlist = list()
hgrlist = list()

clr.ImportExtensions(Revit.GeometryConversion)

Doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
TransactionManager.Instance.EnsureInTransaction(Doc)
cntr = 1
paramslist = list()
if Cnt > 1:
for e in Inpt:
AnciObj = e.GetPartAncillaryUsage()
AnciCnt.append(len(AnciObj))
diamlist.append(e)
#diamlist.append(cntr)
hgrName = e.ProductShortDescription
hgrlist.append(hgrName)
if "CT-69" in hgrName:
vv = '0.03125'
AnciDiam.append(vv)
for n in AnciObj:
AnciID.append(n.AncillaryId)
AnciType.append(n.Type)
vv = n.AncillaryWidthOrDiameter
tt = str(n.Type)
#AnciDiam.append(vv)
if vv == None:
                vv = 0
# AnciDiam.append(vv)
if tt == "SupportRod":
AnciDiam.append(vv)
#AnciDiam.append(cntr)
# AnciDiam.append(tt)
cntr = cntr + 1
else:
part = Inpt[0]
AnciObj = part.GetPartAncillaryUsage()
AnciCnt.append(len(AnciObj))
for n in AnciObj:
AnciID.append(n.AncillaryId)
vv = n.AncillaryWidthOrDiameter
tt = str(n.Type)
#AnciDiam.append(vv)
# if vv != 0:
# AnciDiam.append(vv)
if tt == "SupportRod":
AnciDiam.append(vv)
# AnciDiam.append(tt)


TransactionManager.Instance.TransactionTaskDone()

OUT = AnciDiam
--- End code ---

bitterfitter:
Axl - Thanks for the revised code.  Now that I see what you did there it seems extremely easy. I have a feeling I will use that a lot more to come. 
It seems I have a deeper problem that I have worked on for a couple days now and I have not been able to find the issue.  It is only affecting half strap hangers for duct.  I have them setup correctly with the support specs and ancillaries. No matter what I choose for the ancillary or if I even leave the hanger as Default, I still get no ancillary parts reporting for these hangers.  The only item I see is sealant which is being pulled from the duct specification.  Every other pipe and duct hanger works as it should.  I have no ideas left as to where to look.  Can some check their half strap hangers and let me know if they work so I know that is something I have wrong and not a bug? >:(

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version