Serious error while using NewFamilyInstance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have created the Structure Floor and want to insert family instance say Opening.
I am using NewFamilyInstance to insert family into floor. but it fails with error
A serious error has occurred. It is strongly recommended that you use Save As to save your work in a new file before continuing.
Tried solution at below link but not working:
https://forums.autodesk.com/t5/revit-structure-forum/serious-error/m-p/7338142#M21073
Below is my Code :
Document document = this.Application.ActiveUIDocument.Document;
View currentView = this.Application.ActiveUIDocument.ActiveView;
string type="";
double X=0, Y=0, Z=0;
X = 1983510/304.8;
Y = 6206850/304.8;
Z = -100/304.8;
Transaction trans = new Transaction(document, "openings");
trans.Start();
string uniqueIDstring ="b2b0e226-2677-4683-8a77-12aad01eb5d7-0013cf8b";
Floor floor = document.GetElement(uniqueIDstring) as Floor;
FamilySymbol familySymbol= FindElementByName( document, typeof(FamilySymbol), type ) as FamilySymbol;
Level level = document.GetElement( floor.LevelId ) as Level;
if( !familySymbol.IsActive )
familySymbol.Activate();
XYZ location = new XYZ(X, Y, Z);
FamilyInstance instance = document.Create.NewFamilyInstance(location, familySymbol, floor,StructuralType.NonStructural);
trans.Commit();