How to create face from boundary loop curves

How to create face from boundary loop curves

yafim.simanovsky
Participant Participant
3,979 Views
2 Replies
Message 1 of 3

How to create face from boundary loop curves

yafim.simanovsky
Participant
Participant

Hi,

I'm writing a Zero Touch node.

I want to create a Face element from the boundary loop I got from the following line:

IList<IList<BoundarySegment>> boundaryLoop = room.GetBoundarySegments(options);

 

I'd like to then test some points for inclusion using IsInside(UV) or some similar method.

 

I haven't found a way to create that face. I tried using document.Create, but there isn't a Face method available.

The original boundary loop is from a Room element. Is there a more direct and simple way to do this?

 

Thanks!

0 Likes
Accepted solutions (1)
3,980 Views
2 Replies
Replies (2)
Message 2 of 3

RPTHOMAS108
Mentor
Mentor

Yes: Room.IsPointInRoom

 

You can't create a Face with the API but if you want a more general approach you can extrude a set of curve loop(s) using:

GeometryCreationUtilities.CreateExtrusionGeometry(IList(CurveLoop), XYZ, Double)

  • IList(curveLoop) is the loops you are extruding (all on the same plane and not intersecting).
  • XYZ is the extrusion direction (not parallel to the plane of the curve loops)
  • Double is the distance

 

Then get the face with normal matching the direction of the extrusion, then use .IsInside on that but you have to transform the XYZ point to the UV face coordinates.

 

Interesting observation: FilledRegions have flat soilds and you can therefore use .IsInside on the geometry of those.

Message 3 of 3

yafim.simanovsky
Participant
Participant
Accepted solution

Hi,

Thanks for the reply.

It did help, but I finally solved it with taking polygon boundaries and patching them and testing for intersection, as mentioned in this post:

https://forum.dynamobim.com/t/polygon-containment-test/2336 

 

Surface srf = boundary.Patch();
bool validation = srf.DoesIntersect(point)

 

Thanks