Load a lookup table in one go in multiple families

Hello People, I want to load 1 lookup table in multiple families in one go

I have found a orchid package were i can use some nodes but i don’t get it running.
Can some one help me. I don’t get an error but there is something wrong with my script. See picture below for what i have now.

Hi @Olaf_Kappert,

The FamilyDocument Open node needs a family instance or a family to be able to return a family document and not a filepath.
Since you are using an Orchid node, the other nodes must also come from Orchid.
From what I know there is no compatibility between Orchids (family) documents and other custom nodes / packages.

2 Likes

Yes Alban…Orchid is a closed system

1 Like

Oke, Thank you very much. Then i will check if i can make this script with only orchid nodes

Hi @Olaf_Kappert , if you go with an Orchid solution…can you find it all here, under sample…

Who can help me further with my script. I don’t get any errors but the lookup table isn’t loaded in my families. I have blur my my path a bit, i hope that is not confusing.

What is wrong with this script, I want import the lookup table that is in the string for it.
@erfajo, can you help me maybe or somebody else.

Who knows what i’m doing wrong. The nodes are all orchid nodes but i don’t get the lookpu table in it. It saved the family but i don’t see any changes in it.

Hello @Olaf_Kappert
here is an example with Python

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)

pf_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFilesX86)
sys.path.append(pf_path + '\\IronPython 2.7\\Lib')

toList = lambda x : x if hasattr(x, '__iter__') else [x]
fampaths = toList(IN[0])
csvPath = IN[1]
success = []
TransactionManager.Instance.ForceCloseTransaction()
for path in fampaths:

	famdoc = app.OpenDocumentFile(path)
	t = Transaction(famdoc)
	t.Start('import_table')
	family = famdoc.OwnerFamily
	# create SizeTableManager
	FamilySizeTableManager.CreateFamilySizeTableManager(famdoc, family.Id)
	familySizeTableManager = FamilySizeTableManager.GetFamilySizeTableManager(famdoc, family.Id)
	famSizeErrorInfo = FamilySizeTableErrorInfo()
	familySizeTableManager.ImportSizeTable(famdoc, csvPath, famSizeErrorInfo)
	#
	famdoc.Regenerate()
	#
	if famSizeErrorInfo.FamilySizeTableErrorType == FamilySizeTableErrorType.Undefined:
		success.append("Success")
		t.Commit()
	#
	elif famSizeErrorInfo.FamilySizeTableErrorType == FamilySizeTableErrorType.CannotParseColumnHeader:	
		success.append("Failed : {}, InvalidColumnIndex : {}".format(famSizeErrorInfo.FamilySizeTableErrorType.ToString(), famSizeErrorInfo.InvalidColumnIndex))
		t.RollBack()
	#
	else:
		success.append("Failed : {}".format(famSizeErrorInfo.FamilySizeTableErrorType.ToString()))
		t.RollBack()

	t.Dispose()
	famdoc.Close(True)
	famdoc.Dispose()

OUT = success

Edit post 15/05/2022
fix the output message when famSizeErrorInfo is not empty

3 Likes