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; XYZ location = new XYZ(0, 0, 0); string filePath = @"D:\Familie1.rfa"; Family family; using( Transaction trans = new Transaction( doc ) ) { trans.Start("start"); //load the family doc.LoadFamily(filePath, out family); trans.Commit(); } FamilySymbol symbol = null; //choose the familysymbol foreach( ElementId id in family.GetFamilySymbolIds() ) { symbol = doc.GetElement( id ) as FamilySymbol; // Our family only contains one // symbol, so pick it and leave break; } symbol.Activate(); //place the familyinstance uiDoc.PromptForFamilyInstancePlacement( symbol ); }
the problem is that i always get this error when i run the macro:
System.NullReferenceEcxeption
I hope that someone can help me to solve that Problem.
Thanks a lot!