Пример #1
0
        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);
        }
        /// <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;

        }
Пример #3
0
 /// <summary>
 /// returns a Hash for the geometric behaviour of this object
 /// </summary>
 /// <param name="solid"></param>
 /// <returns></returns>
 public static int GetGeometryHashCode(this  IfcShell shell)
 {
     if (shell is IfcOpenShell)
     {
         return(((IfcOpenShell)shell).GetGeometryHashCode());
     }
     if (shell is IfcClosedShell)
     {
         return(((IfcClosedShell)shell).GetGeometryHashCode());
     }
     else
     {
         return(shell.GetHashCode()); //use object hash for a uniqueish result
     }
 }
Пример #4
0
 internal override void ParseXml(XmlElement xml)
 {
     base.ParseXml(xml);
     foreach (XmlNode child in xml.ChildNodes)
     {
         string name = child.Name;
         if (string.Compare(name, "SbsmBoundary") == 0)
         {
             foreach (XmlNode cn in child.ChildNodes)
             {
                 IfcShell s = mDatabase.ParseXml <IfcShell>(cn as XmlElement);
                 if (s != null)
                 {
                     addBoundary(s);
                 }
             }
         }
     }
 }
Пример #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);
        }
Пример #6
0
 /// <summary>
 /// Calculates the maximum number of points in this object, does not remove geometric duplicates
 /// </summary>
 /// <param name="sbsm"></param>
 /// <returns></returns>
 public static int NumberOfPointsMax(this IfcShell shell)
 {
     return(((IfcConnectedFaceSet)shell).NumberOfPointsMax());
 }
Пример #7
0
		public IfcShellBasedSurfaceModel(IfcShell shell) : base(shell.Database) { mSbsmBoundary.Add(shell.Index); }