Revit API

Reply
Active Member
ivo.zagar
Posts: 8
Registered: ‎03-19-2011
Message 1 of 3 (205 Views)

FilledRegion.Create returning Boundaries are self-intersecting.

205 Views, 2 Replies
04-01-2013 05:28 PM

Hi,

 

I have simple code where I want to create FilledRegion. Whatever I do I get back: Boundaries are self-intersecting.

 

Here's my code:

IList<RDB.CurveLoop> boundaries = new List<RDB.CurveLoop>();
RDB.CurveLoop curve = CreateCurve(doc, new RDB.XYZ(0, 0, 0), new RDB.XYZ(0, 10, 0));
boundaries.Add(curve);
 
RDB.CurveLoop curve2 = CreateCurve(doc, new RDB.XYZ(0, 10, 0), new RDB.XYZ(10, 10, 0));
boundaries.Add(curve2);
 
RDB.CurveLoop curve3 = CreateCurve(doc, new RDB.XYZ(10, 10, 0), new RDB.XYZ(0, 0, 0));
boundaries.Add(curve3);
 
CreateFilledRegion(doc, boundaries);

And here are two external functions:

private RDB.CurveLoop CreateCurve(RDB.Document doc, RDB.XYZ start, RDB.XYZ end)
{
    RDB.Line line = doc.Application.Create.NewLine(start, end, true);
    RDB.CurveLoop curve = new RDB.CurveLoop();
    curve.Append(line);
 
    XLIB.Geometry.CreateDetailLine(doc, start, end);
    return curve;
}
 
private void CreateFilledRegion(RDB.Document doc, IList<RDB.CurveLoop> boundaries)
{
    RDB.Element t = XLIB.Selection.GetTypes(doc, typeof(RDB.FilledRegionType)).FirstOrDefault();
    RDB.FilledRegion.Create(doc, t.Id, doc.ActiveView.Id, boundaries);
}

 

Any thaugts?

 

Cheers,

Ivo

New Member
enonrick
Posts: 2
Registered: ‎04-02-2013
Message 2 of 3 (171 Views)

Re: FilledRegion.Create returning Boundaries are self-intersecting.

04-02-2013 07:37 PM in reply to: ivo.zagar

this is my working code snippet:

 

 

newCurveLoop = new List<CurveLoop>();
curveLoop = new CurveLoop();
for (int i = 0; i < LineCount; i++)
{
..........
.......... if ((LINE_TYPE)lineType == LINE_TYPE.LINEAR) curveLoop.Append(_document.Application.Create.NewLine(new XYZ(x1, y1, 0), new XYZ(x2, y2, 0), true)); else if ((LINE_TYPE)lineType == LINE_TYPE.ARC) curveLoop.Append(_document.Application.Create.NewArc(new XYZ(x1, y1, 0), radius, startRadian, endRadian, new XYZ(1, 0, 0), new XYZ(0, 1, 0))); } newCurveLoop.Add(curveLoop); FilledRegion.Create(_document, materialId, view.Id, newCurveLoop);

 

I'm just wondering, why are you recreated curveloop in each CreateCurve funtion,link this

RDB.CurveLoop curve = new RDB.CurveLoop();

just try it.

Active Member
ivo.zagar
Posts: 8
Registered: ‎03-19-2011
Message 3 of 3 (154 Views)

Re: FilledRegion.Create returning Boundaries are self-intersecting.

04-04-2013 05:56 AM in reply to: ivo.zagar

Thanks, that was it: only one CurveLoop.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.