public static string GeomInfoBoundBox(XbimModel model, int iEntLabel)
        {
            XbimGeometryData geomdata = model.GetGeometryData(iEntLabel, XbimGeometryType.BoundingBox).FirstOrDefault();

            if (geomdata == null)
            {
                return("<not found>");
            }

            XbimRect3D r3d = XbimRect3D.FromArray(geomdata.ShapeData);

            return(string.Format("Bounding box (position, size): {0}", r3d.ToString()));
        }
Exemple #2
0
        /// <summary>
        /// 获取一个指定实体的信息,包括express属性信息和definedbyProperties信息
        /// 其中,express属性只获取直接有值的,不获取引用的
        /// 另外,express属性也获取了几何表达形式IfcProductDefinitionShape
        /// </summary>
        /// <param name="entity">实体,IfcProduct的子类</param>
        /// <returns></returns>
        public Entity getBasicInfo(IPersistEntity entity)
        {
            ObservableCollection <PropertyItem> properties = new ObservableCollection <PropertyItem>();

            FillObjectData(entity, properties);
            Entity newEntity = new Entity();

            newEntity.LABEL = entity.EntityLabel;
            foreach (var prop in properties)
            {
                if (prop.Name == "GlobalId")
                {
                    newEntity.GUID = prop.Value;
                }
                else if (prop.Name == "Type")
                {
                    newEntity.TYPE = prop.Value;
                }
                else
                {
                    //属性对应的IFCLABEL=0,代表这个属性是EXPRESS中的一个直接用text或者number就可以表示的一种属性
                    //并不是一个引用
                    if (prop.IfcLabel == 0)
                    {
                        newEntity.properties.Add(prop.Name, prop.Value);
                    }
                    //专门处理几何信息
                    if (prop.Value == "IfcProductDefinitionShape")
                    {
                        var value = string.Join(",", getRepresentation(prop.IfcLabel));
                        newEntity.properties.Add(prop.Name, value);
                    }
                }


                //Console.WriteLine(prop.Name + " " + prop.Value+ " "+ prop.IfcLabel);
            }

            ObservableCollection <PropertyItem> properties2 = new ObservableCollection <PropertyItem>();

            FillPropertyData(entity, properties2);
            foreach (var prop in properties2)
            {
                if (!newEntity.properties.ContainsKey(prop.Name))
                {
                    newEntity.properties.Add(prop.Name, prop.Value);
                }
                //Console.WriteLine(prop.Name + " " + prop.Value + " " + prop.IfcLabel);
            }

            var        toproduct = entity as IIfcProduct;
            XbimRect3D AABB      = GetAABB(toproduct);

            if (AABB.IsEmpty)
            {
                newEntity.AABB = "";
            }
            else
            {
                newEntity.AABB = AABB.ToString();
            }

            return(newEntity);
        }
 public override string ToString()
 {
     return(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8}", _shapeLabel, _ifcShapeLabel, _geometryHash, _shapeLabel, _referenceCount, LOD, _format, _boundingBox.ToString(), _shapeData));
 }