Hi all,
i am trying to load and place an familyobject.
i am using this topic from jeremy tammik:
my code since now:
public void Floormacro() { UIDocument uiDoc = this.Application.ActiveUIDocument; Document doc = uiDoc.Document; using( Transaction trans = new Transaction( doc ) ) { trans.Start("start"); //familypath string filePath = @"D:\Familie1.rfa"; Family family; //load the family doc.LoadFamily(filePath, out family); trans.Commit(); } //choose the familysymbol FamilySymbol symbol = null; foreach( ElementId id in family.GetFamilySymbolIds() ) { symbol = doc.GetElement( id ) as FamilySymbol; // Our family only contains one // symbol, so pick it and leave break; } //place the familyinstance uiDoc.PromptForFamilyInstancePlacement( symbol ); }
the problem is that i always gets this error when i run the macro:
System.NullReferenceEcxeption
I hope that someone can help me to solve that Problem.
Thanks a lot!