How to determine the Edge Inclusion

How to determine the Edge Inclusion

pmeigneux
Advocate Advocate
799 Views
10 Replies
Message 1 of 11

How to determine the Edge Inclusion

pmeigneux
Advocate
Advocate

Hello

 

I am using the Custom Exporter to extract 3D geometry. I am able to retrieve the surface of the Revit components with the sequence of edges associated.

 

I would like to determine for a specific surface if a sequence of edges is included in another (see pictures below).

 

Slide1.JPGSlide2.JPG

The red area represents the Surface and the blue and yellow represent the series of edges associated to this Surface.

 

In the first case, I succeed to determine that the Series of Edges 2 is included in the first one by comparing the min and max values of the (X;Y) coordinates of the Edge groups.

 

In the second case, this comparison approach is working.

 

Do you have any method to solve this cover this case?

 

Regards

0 Likes
800 Views
10 Replies
Replies (10)
Message 2 of 11

pmeigneux
Advocate
Advocate

Update:

The second case is not working. Do you have any idea to resolve it?

 

Thanks

0 Likes
Message 3 of 11

JimJia
Alumni
Alumni

Dear pmeigneux,

 

You can use solid operation to determine the inclusion.

Please see codes below:

/// <summary>
        ///  determine the two loop is inclusion or not
        /// </summary>
        /// <param name="loop1">edge loop</param>
        /// <param name="loop2">edge loop</param>
        /// <param name="normal">the normal of surface</param>
        /// <returns></returns>
        public bool IsIncluded(CurveLoop loop1, CurveLoop loop2, XYZ normal)
        {
            Solid solid1 = GeometryCreationUtilities.CreateExtrusionGeometry(new List<CurveLoop>() { loop1 }, normal, 1);
            Solid solid2 = GeometryCreationUtilities.CreateExtrusionGeometry(new List<CurveLoop>() { loop2 }, normal, 1);

            Solid intersectedSolid = BooleanOperationsUtils.ExecuteBooleanOperation(solid1, solid2, BooleanOperationsType.Intersect);

            Transform t = null;

            return ExporterIFCUtils.AreSolidsEqual(solid2, intersectedSolid, out t) || ExporterIFCUtils.AreSolidsEqual(solid1, intersectedSolid, out t);
        }

Hope the codes can solve your issue.


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
Message 4 of 11

pmeigneux
Advocate
Advocate

Hi Jimjia,

 

Thank you for your reply.

 

But for ExporterIFCUtils, which dll to use?

 

Philippe.

0 Likes
Message 5 of 11

pmeigneux
Advocate
Advocate

I'm use Revit 2018, 2017,2016 and 2015.

 

I'm test : Autodesk.Revit.DB.IFC.ExporterIFCUtils.AreSolidsEqual

 

Philippe

0 Likes
Message 6 of 11

JimJia
Alumni
Alumni

Dear Philippe,

 

It is Autodesk.Revit.DB.IFC.ExporterIFCUtils.AreSolidsEqual in RevitAPIIFC.dll


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 7 of 11

pmeigneux
Advocate
Advocate

Hi,

 

Thank you. An other question foir you. How find Normal for all face type (for planar is simple, but for other ?).

 

Philippe.

0 Likes
Message 8 of 11

JimJia
Alumni
Alumni

Hi Philippe,

 

If face is not planar, the normal is different according to location where the point is, you can get the normal at that point by Face.ComputeNormal(UV point)


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 9 of 11

pmeigneux
Advocate
Advocate

Ok but for this function, witch point (u,V) use for calculate the normal ?

0 Likes
Message 10 of 11

JimJia
Alumni
Alumni

Hi Philippe,

 

The normal is different at different UV point of the non-planar face.

You can not get a common face normal of a non-planar face like planar face's.

 

 

 


Jim Jia
Autodesk Forge Evangelist
https://forge.autodesk.com
Developer Technical Services
Autodesk Developer Network
Email: Jim.Jia@autodesk.com
0 Likes
Message 11 of 11

pmeigneux
Advocate
Advocate

Accept solution for Planar Face.

 

But for other Faces Types not solution..

 

Philippe.

0 Likes