示例#1
0
        protected BbAssembly(
            string assemblyId,
            string assemblyName,
            string assemblyMark,
            string clientMark,
            string prelimMark,
            string shippingMark,
            string barCode,
            BbSpatialElement floor,
            BbCoordinate3D position,
            BbDirection3D zAxis,
            BbDirection3D xAxis
            )
        {
            //AssemblyName = assemblyName;
            //AssemblyMark = assemblyMark;

            var pos = BbPosition3D.Create(position, zAxis, xAxis);

            ObjectBbLocalPlacement = BbLocalPlacement3D.Create(
                floor.ObjectBbLocalPlacement, pos);

            _ifcElementAssembly = new IfcElementAssembly
            {
                GlobalId     = IfcGloballyUniqueId.NewGuid(),
                OwnerHistory = floor.IfcSpatialStructureElement.OwnerHistory,
                Name         = assemblyName,
                Description  = null,
                ObjectType   = null,

                ObjectPlacement = ObjectBbLocalPlacement.IfcLocalPlacement,
                Representation  = null,
                Tag             = assemblyId,
                AssemblyPlace   = IfcAssemblyPlaceEnum.NOTDEFINED,
                PredefinedType  = IfcElementAssemblyTypeEnum.RIGID_FRAME
            };


            BbAssemblyIdentity = BbAssemblyIdentity.Create(
                //				assemblyName,
                assemblyMark, clientMark, prelimMark, shippingMark,
                barCode);
            BbAssemblyIdentity.AssignTo(this);

            AddToSpatialElement(floor);

            // var relContaineds = EarlyBindingInstanceModel.GetDataByType("IfcRelContainedInSpatialStructure");

            //var thecontained = from y in ( from x in relContaineds
            //                   select x.Value as IfcRelContainedInSpatialStructure)
            //                       where y.;

            //var b = BbInstanceDB.GetTypedList(typeof(BbAssembly));


            //if (b == null)
            //{
            //    IfcRelContainedInSpatialStructure = new IfcRelContainedInSpatialStructure
            //    {
            //        GlobalId = IfcGloballyUniqueId.NewGuid(),
            //        OwnerHistory = _ifcElementAssembly.OwnerHistory,
            //        RelatingStructure = floor.IfcSpatialStructureElement,
            //        RelatedElements = new List<IfcProduct>(),
            //    };
            //}
            //else
            //{

            //    var otherAssemblies = (from x in b.OfType<BbAssembly>()

            //                           select x).ToList();

            //    //var a = otherAssemblies as IList<BbAssembly>;

            //    var other = (from x in otherAssemblies
            //                 where x.BbSpatialElement.IfcSpatialStructureElement.Name
            //                 == BbSpatialElement.IfcSpatialStructureElement.Name
            //                 select x).First();
            //    if (other == null)
            //    {
            //        IfcRelContainedInSpatialStructure = new IfcRelContainedInSpatialStructure
            //        {
            //            GlobalId = IfcGloballyUniqueId.NewGuid(),
            //            OwnerHistory = _ifcElementAssembly.OwnerHistory,
            //            RelatingStructure = BbSpatialElement.IfcSpatialStructureElement,
            //            RelatedElements = new List<IfcProduct>(),
            //        };
            //    }
            //    else
            //    {
            //        IfcRelContainedInSpatialStructure = other.IfcRelContainedInSpatialStructure;
            //    }
            //}

            //IfcRelContainedInSpatialStructure.RelatedElements.Add(_ifcElementAssembly);
        }