Serious error while using NewFamilyInstance

Serious error while using NewFamilyInstance

kmkxperia
Advocate Advocate
858 Views
2 Replies
Message 1 of 3

Serious error while using NewFamilyInstance

kmkxperia
Advocate
Advocate

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();

0 Likes
859 Views
2 Replies
Replies (2)
Message 2 of 3

RPTHOMAS108
Mentor
Mentor

Most openings are face based and should be inserted with one of the overloads that includes a face or reference to face. I'm fairly confident it shouldn't be inserted with an overload that calls for a structural type.

 

The co-ordinates you are specifying are also large given you are converting from mm to ft. (your y will be 6 km from internal origin). Probably this is within the limits of Revit but is your model actually six thousand metres in size? You should ideally be using a smaller internal co-ordinate system converted from shared co-ordinates, perhaps? Interestingly the limit for import instances is 20 miles from Revit 2011 onwards 2 miles prior, I assume similar is appropriate for dimensions of other types of objects? Regardless of this due to time taken to open and work with large models I like to keep the size down to considerably less.

 

You are also looking for an element type named ""? Not sure how the function FindElementByName is working but you are supplying a value that has been set to nothing and not changed before using it.

 

 

Message 3 of 3

kmkxperia
Advocate
Advocate

After going through the API which takes face of floor I used below API but I now its failing with below error. I think reference work plane refDir is missing

How can I create a workplane for floor?

 

FamilyInstance instance = document.Create.NewFamilyInstance(face,location,refDir, familySymbol);

 

 

Error:

Autodesk.Revit.Exceptions.ArgumentException: Family cannot be placed as hosted on an input face reference, because its FamilyPlacementType is not WorkPlaneBased
Parameter name: symbol

 

 

0 Likes