Fabrication in Revit® > Fabrication Parts in Revit®

Ancillaries in Revit

<< < (8/8)

bitterfitter:
I fully understand what you are saying.  I have the ancillaries and the ancillary kits all entered in my database.  I have used them for years now.  I just don't have them entered in my product editor as I never had a need for that.  I was more asking if I altered the script correctly as I am still working through my Python abilities  ;D  I have placed the code I posted in a node but I am not having luck getting it to run yet without warnings. :(  I will get it to work and post what I did wrong.  It just may take me a little bit longer....

Axl:
updates:
To filter a random list of elements:


--- Code: ---# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
elems = UnwrapElement(IN[0])
# Place your code below this line
category = ('MEP Fabrication Hangers','Assemblies','MEP Fabrication Pipework')

listout1 = []
listout2 = []
listout3 = []

for e in elems:
cat = e.Category.Name.ToString()
if cat == "MEP Fabrication Hangers":
listout1.append(e)
# Assign your output to the OUT variable.
OUT = listout1
--- End code ---

To get a flat list of Ancillaries:

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

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

h_lst = UnwrapElement(IN[0])

mylist = []
genlist = []
for h in h_lst:
anc_l = h.GetPartAncillaryUsage()
mylist.append(h.Id)
for a in anc_l:
mylist.append(a.Type)
mylist.append(a.Quantity)
mylist.append(FabricationConfiguration.GetFabricationConfiguration(doc).GetAncillaryName(a.AncillaryId))
genlist.append(mylist)
OUT = genlist
--- End code ---

And to get a list of list of Ancillaries

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

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

h_lst = UnwrapElement(IN[0])

mylist = []
genlist = []
for h in h_lst:
anc_l = h.GetPartAncillaryUsage()
mylist.append(h.Id)
for a in anc_l:
anc_type = a.Type
anc_qty = a.Quantity
anc_name = FabricationConfiguration.GetFabricationConfiguration(doc).GetAncillaryName(a.AncillaryId)
anc_row = (anc_type,anc_qty,anc_name)
mylist.append(anc_row)
genlist.append(mylist)
OUT = genlist
--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version