I think I need to output a list of the family type name somehow? Not sure, gave what you said a go but type names are still not sorted. Or maybe sort the output after to write to the text file again?

I think I need to output a list of the family type name somehow? Not sure, gave what you said a go but type names are still not sorted. Or maybe sort the output after to write to the text file again?
I think I misspoke and it is the TYPES that need to be sorted, not the Parameters.
If you get the famTypes list in the order you want, then you can iterate through and the Catalog will be sorted as you want. It may be easier to try and pull this out of the python node to do that, but since you are doing it on a directory, maybe not.
Yeah Im getting kind of confused not sure how to get the fam types from the fam parameters code to order correctly. Might just trt reordered the outputted lines and write again
haha I love a ridiculous dynamo solution since my skills lack in python. Managed to get it recorded writing the text file again
Iām not sure if its the materials or something else but the family breaks when importing through the type catalog but is ok if loaded in without.
I was running into that with instance based material parameters because there arenāt any instances to set them on. Should only be a warning. Better option would be to not include instance materials in the catalog.
Thanks for all your help Sean. For some reason the doors breaking (nested family dosnt show) when importing from the catalog. When importing from the OOTB catalog it does work.
45_Hinge 1_OOTB.rfa (1.0 MB)
45_Hinge 1_OOTB.txt (41.5 KB)
45_Hinge 1.rfa (1.0 MB)
45_Hinge 1.txt (14.7 KB)
I will try filter out instance parameters and maybe nested family parameters that arnt linked. Na I dont know whats going on
Is there an easy way of using the OOTB export catalog?
I am not really sure, but I have used that graph on many different family types including our doors which have nested families and labels as well. I did also receive the same error you did and I looked for a minute but couldnāt even find that family or family type. I assume itās nested somewhere, but I didnāt see it.
The exact same parameters are being exported. The values still dont seem to be metric though. Not sure if thats causing an issue.
Yeah the values are not metric. Iām almost certain thatās the issue. Not quite sure how to change all of them to metric though. Feet to MM
Saved by smart guy at work. Converted the units
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference('System')
from System.Collections.Generic import List
from System import *
from System.IO import StreamWriter
#Preparing input from dynamo to revit
doc = IN[2]
path = IN[1]
#units = doc.GetUnits().GetFormatOptions(UnitType.UT_Length).DisplayUnits
famParams = IN[0]
output = []
famTypes = doc.FamilyManager.Types
#Set up the first line of the Type Catalog with the headers
variables = "";
for param in famParams:
pType = param.Definition.GetDataType()
pName = param.Definition.Name
if pType == SpecTypeId.Length:
variables += "," + pName + "##LENGTH##MILLIMETERS"
elif pType == SpecTypeId.Area:
variables += "," + pName + "##AREA##SQUARE_MILLIMETERS"
elif pType == SpecTypeId.Volume:
variables += "," + pName + "##VOLUME##CUBIC_MILLIMETERS"
elif pType == SpecTypeId.Slope:
variables += "," + pName + "##SLOPE##SLOPE_DEGREES"
elif pType == SpecTypeId.Angle:
variables += "," + pName + "##ANGLE##DEGREES"
elif pType == SpecTypeId.Currency:
variables += "," + pName + "##CURRENCY##CURRENCY"
else:
variables += "," + pName + "##OTHER##"
#Add the headers to the final output
output.Add(variables)
#Iterate each type and get the values for each parameter ased on its Storage Type and Parameter Type
for famType in famTypes:
typeString = String.Empty
typeString += famType.Name
for param in famParams:
pType = param.Definition.GetDataType()
sType = param.StorageType
value = String.Empty
if sType == StorageType.Double:
if pType == SpecTypeId.Angle:
value = UnitUtils.ConvertFromInternalUnits(famType.AsDouble(param),UnitTypeId.Degrees).ToString()
elif pType == SpecTypeId.Slope:
value = UnitUtils.ConvertFromInternalUnits(famType.AsDouble(param),UnitTypeId.SlopeDegrees).ToString()
elif pType == SpecTypeId.Length:
value = UnitUtils.ConvertFromInternalUnits(famType.AsDouble(param), UnitTypeId.Millimeters).ToString()
elif pType == SpecTypeId.Area:
value = UnitUtils.ConvertFromInternalUnits(famType.AsDouble(param), UnitTypeId.SquareMillimeters).ToString()
elif pType == SpecTypeId.Volume:
value = UnitUtils.ConvertFromInternalUnits(famType.AsDouble(param), UnitTypeId.CubicMillimeters).ToString()
else:
value = famType.AsDouble(param).ToString()
if sType == StorageType.Integer:
value = famType.AsInteger(param).ToString()
if sType == StorageType.String:
value = famType.AsString(param)
if sType == StorageType.ElementId:
eid = famType.AsElementId(param)
elem = doc.GetElement(eid)
try:
if not elem is None:
value = Element.Name.__get__(elem)
except:
value = String.Empty
#Add each value for each parameter
typeString += ","+value
#Add all values for each Family Type
output.Add(typeString)
try:
#Write each line to a txt file
sw = StreamWriter(path)
for line in output:
sw.WriteLine(line)
sw.Close()
OUT = output
except:
OUT = "Failed to Write File"