Example #1
0
        public static bool GeometricEquals(this  IfcOpenShell a, IfcOpenShell b)
        {
            if (a == null && b == null)
            {
                return(false);                        //null
            }
            if (a == null || b == null)
            {
                return(false);                        //different type
            }
            List <IfcFace> fsb = b.CfsFaces.ToList();
            List <IfcFace> fsa = a.CfsFaces.ToList();

            if (fsa.Count != fsb.Count)
            {
                return(false);
            }
            for (int i = 0; i < fsa.Count; i++)
            {
                if (!fsa[i].GeometricEquals(fsb[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
        private static IfcShellBasedSurfaceModel ToIfcShellBasedSurfaceModel(this Lamina lamina, Document doc)
        {
            var plane  = lamina.Perimeter.Plane().ToIfcPlane(doc);
            var outer  = lamina.Perimeter.ToIfcCurve(doc);
            var bplane = new IfcCurveBoundedPlane(plane, outer, new List <IfcCurve> {
            });

            var bounds     = new List <IfcFaceBound> {
            };
            var loop       = lamina.Perimeter.ToIfcPolyLoop(doc);
            var faceBounds = new IfcFaceBound(loop, true);

            bounds.Add(faceBounds);

            var face      = new IfcFaceSurface(bounds, bplane, true);
            var openShell = new IfcOpenShell(new List <IfcFace> {
                face
            });

            var shell = new IfcShell(openShell);
            var ssm   = new IfcShellBasedSurfaceModel(new List <IfcShell> {
                shell
            });

            doc.AddEntity(plane);
            doc.AddEntity(outer);
            doc.AddEntity(bplane);
            doc.AddEntity(loop);
            doc.AddEntity(faceBounds);
            doc.AddEntity(face);
            doc.AddEntity(openShell);

            return(ssm);
        }
Example #3
0
        public static int GetGeometryHashCode(this  IfcOpenShell shell)
        {
            int hash = shell.CfsFaces.Count;

            if (hash > 30)
            {
                return(hash ^ shell.GetType().Name.GetHashCode());           //probably enough for a uniquish hash
            }
            foreach (IfcFace face in shell.CfsFaces)
            {
                hash ^= face.GetGeometryHashCode();
            }
            return(hash);
        }
 public static bool GeometricEquals(this  IfcOpenShell a, IfcOpenShell b)
 {
     if (a == null && b == null) return false; //null
     if (a == null || b == null) return false; //different type
     List<IfcFace> fsb = b.CfsFaces.ToList(); 
     List<IfcFace> fsa = a.CfsFaces.ToList(); 
     if (fsa.Count != fsb.Count) return false;
     for (int i = 0; i < fsa.Count; i++)
     {
         if (!fsa[i].GeometricEquals(fsb[i])) return false;
     }
     return true;
     
 }
Example #5
0
        /// <summary>
        /// Compares two objects for geomtric equality
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b">object to compare with</param>
        /// <returns></returns>
        public static bool GeometricEquals(this  IfcShell a, IfcShell b)
        {
            IfcOpenShell ob = b as IfcOpenShell;
            IfcOpenShell oa = a as IfcOpenShell;

            if (ob != null && oa != null)
            {
                return(oa.GeometricEquals(ob));
            }

            IfcClosedShell cb = b as IfcClosedShell;
            IfcClosedShell ca = a as IfcClosedShell;

            if (cb != null && ca != null)
            {
                return(ca.GeometricEquals(cb));
            }
            return(false);
        }
 public IXbimShell CreateShell(IfcOpenShell shell)
 {
     return(_engine.CreateShell(shell));
 }
 public IXbimShell CreateShell(IfcOpenShell shell)
 {
     return _engine.CreateShell(shell);
 }