Revit API

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

FilledRegion.Create returning Boundaries are self-intersecting.

190 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 (156 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 (139 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube