Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error: circular chain of reference when creating opening on a floor

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
715 Views, 2 Replies

Error: circular chain of reference when creating opening on a floor

Unable to create opening on a created floor, posted error "circular chain of reference"

Problem is floor can be create while not the opening, here are the codes: 

 

 

CurveArray curveArray = new CurveArray();
curveArray.Append(Line.CreateBound(new XYZ(-50, 50, 3000/304.8), new XYZ(50, 50, 3000 / 304.8)));
curveArray.Append(Line.CreateBound(new XYZ(50, 50, 3000 / 304.8), new XYZ(50, -50, 3000 / 304.8)));
curveArray.Append(Line.CreateBound(new XYZ(50, -50, 3000 / 304.8), new XYZ(-50, -50, 3000 / 304.8)));
curveArray.Append(Line.CreateBound(new XYZ(-50, -50, 3000 / 304.8), new XYZ(-50, 50, 3000 / 304.8)));

CurveArray curveArray1 = new CurveArray();
curveArray1.Append(Line.CreateBound(new XYZ(10, 30, 3000 / 304.8), new XYZ(30, 30, 3000 / 304.8)));
curveArray1.Append(Line.CreateBound(new XYZ(30, 30, 3000 / 304.8), new XYZ(20, 10, 3000 / 304.8)));
curveArray1.Append(Line.CreateBound(new XYZ(20, 10, 3000 / 304.8), new XYZ(10, 30, 3000 / 304.8)));

 

ElementId levelid = new ElementId(2787);
Level level = doc.GetElement(levelid) as Level;

FloorType floorType = floorTypeFilter(doc, "常规 - 300mm");
Floor newFloor = doc.Create.NewFloor(curveArray,floorType , level, false);
Element NewFloor = newFloor as Element;
Opening opening = doc.Create.NewOpening(newFloor, curveArray1, false);

Tags (3)
2 REPLIES 2
Message 2 of 3
jeremytammik
in reply to: Anonymous

Try to regenerate the model after creating the floor and before creating the opening.

 

If that does not help, try to commit the transaction after after creating the floor and create the opening in a new separate transaction.

 

If using two or more transactions, you can group them.

 

Read all about the need to regenerate here:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.33

 

Cheers,

 

Jeremy

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 3
Anonymous
in reply to: jeremytammik

 

Dear Mr.Tammik

 

Thank you for replying, now the problem is solved by regenerating and I can make opening like that

 

Best Wishes

 

TIMOpening.png

 

 

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report