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);
Solved! Go to Solution.
Solved by jeremytammik. Go to Solution.
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
Can't find what you're looking for? Ask the community or share your knowledge.