// Token: 0x060001B9 RID: 441 RVA: 0x0000BD48 File Offset: 0x00009F48
        public IEnumerable <WireItem> getWireItems(FabricSheet sheet, WireDistributionDirection direction, FabricSheetType type)
        {
            bool flag = sheet == null || type == null;
            IEnumerable <WireItem> result;

            if (flag)
            {
                result = new List <WireItem>();
            }
            else
            {
                Document               doc        = sheet.Document;
                List <Curve>           source     = sheet.GetWireCenterlines(direction).ToList <Curve>();
                IEnumerable <WireItem> enumerable = source.Select((Curve curve, int index) => new WireItem(doc, curve, type, index, direction, this));
                result = enumerable;
            }
            return(result);
        }
Exemple #2
0
		// Token: 0x0600026C RID: 620 RVA: 0x0000FBF0 File Offset: 0x0000DDF0
		public WireItem(Document doc, Curve curve, FabricSheetType type, int wireIndex, WireDistributionDirection direction, SteelGroupElementMeshBase parentMesh)
		{
			this._curve = curve;
			this.Direction = direction;
			this.ParentMesh = parentMesh;
			this.StartPoint = curve.GetEndPoint(0).asPoint();
			this.EndPoint = curve.GetEndPoint(1).asPoint();
			this.StartPoint.transformBy(parentMesh.MatWcsToPalette);
			this.EndPoint.transformBy(parentMesh.MatWcsToPalette);
			this.status = WireItem.Status.RelativeToWorld;
			this.SetValuesFromFabricType(doc, type, wireIndex);
			this.NumberOfIrons = 1;
			this.Pitch = 0;
			this.Angle = this.getAngle();
			this.ArticleNumber = "Rodstock";
			this.AutomaticProduction = 0;
			this.SpacerType = 0;
			this.SpacerStartPoint = 0;
			this.SpacerPitch = 0;
			this.Bending = 0;
			this.Spacers = 0;
			this.WeldingPoints = 0;
		}
        private static bool ExportStandardFabricSheet(FabricSheetExportConfig cfg)
        {
            if (cfg.Equals(null))
            {
                return(false);
            }

            string       guid         = GUIDUtil.CreateGUID(cfg.Sheet);
            IFCAnyHandle ownerHistory = ExporterCacheManager.OwnerHistoryHandle;

            int ii = 0;

            do
            {
                WireDistributionDirection dir             = (WireDistributionDirection)ii;
                IList <Curve>             wireCenterlines = cfg.Sheet?.GetWireCenterlines(dir);
                for (int jj = 0; jj < wireCenterlines.Count; jj++)
                {
                    double wireDiam = 0.0;

                    Element wireTypeElem = (dir == WireDistributionDirection.Major) ? cfg.Doc?.GetElement(cfg.SheetType?.MajorDirectionWireType) :
                                           cfg.Doc?.GetElement(cfg.SheetType?.MinorDirectionWireType);

                    if (wireTypeElem is FabricWireType wireType)
                    {
                        wireDiam = UnitUtil.ScaleLength(wireType.WireDiameter);
                    }
                    IFCAnyHandle bodyItem = GeometryUtil.CreateSweptDiskSolid(cfg.ExporterIFC, cfg.File, wireCenterlines[jj], wireDiam / 2.0, null);

                    if (!IFCAnyHandleUtil.IsNullOrHasNoValue(bodyItem))
                    {
                        cfg.BodyItems?.Add(bodyItem);
                        RepresentationUtil.CreateStyledItemAndAssign(cfg.File, cfg.Doc, cfg.MaterialId, bodyItem);
                    }
                }
                ii++;
            }while (ii < 2);

            IFCAnyHandle shapeRep = null;

            if (cfg.BodyItems.Count > 0)
            {
                shapeRep = RepresentationUtil.CreateAdvancedSweptSolidRep(cfg.ExporterIFC, cfg.Sheet, cfg.CategoryId,
                                                                          cfg.ExporterIFC.Get3DContextHandle("Body"), cfg.BodyItems, null);
            }

            IList <IFCAnyHandle> shapeReps = new List <IFCAnyHandle>();

            if (shapeRep != null)
            {
                shapeReps.Add(shapeRep);
            }

            IFCAnyHandle prodRep = (shapeReps != null) ? IFCInstanceExporter.CreateProductDefinitionShape(cfg.File, null, null, shapeReps) : null;

            FabricParams fabricParams = null;

            if (!ExporterCacheManager.FabricParamsCache.TryGetValue(cfg.Sheet.Id, out fabricParams))
            {
                fabricParams = new FabricParams(cfg.Sheet);
                ExporterCacheManager.FabricParamsCache[cfg.Sheet.Id] = fabricParams;
            }

            IFCAnyHandle handle = IFCInstanceExporter.CreateReinforcingMesh(cfg.ExporterIFC, cfg.Sheet, guid, ownerHistory, cfg.EcData.GetLocalPlacement(),
                                                                            prodRep, fabricParams.SteelGrade, fabricParams.MeshLength, fabricParams.MeshWidth,
                                                                            fabricParams.LongitudinalBarNominalDiameter, fabricParams.TransverseBarNominalDiameter,
                                                                            fabricParams.LongitudinalBarCrossSectionArea, fabricParams.TransverseBarCrossSectionArea,
                                                                            fabricParams.LongitudinalBarSpacing, fabricParams.TransverseBarSpacing);
            IFCExportInfoPair exportInfo   = new IFCExportInfoPair(IFCEntityType.IfcReinforcingMesh);
            ElementId         fabricAreaId = cfg.Sheet?.FabricAreaOwnerId;

            if (fabricAreaId != ElementId.InvalidElementId)
            {
                if (!ExporterCacheManager.FabricAreaHandleCache.TryGetValue(fabricAreaId, out HashSet <IFCAnyHandle> fabricSheets))
                {
                    fabricSheets = new HashSet <IFCAnyHandle>();
                    ExporterCacheManager.FabricAreaHandleCache[fabricAreaId] = fabricSheets;
                }
                fabricSheets.Add(handle);
            }
            cfg.ProductWrapper.AddElement(cfg.Sheet, handle, cfg.PlacementSetter?.LevelInfo, cfg.EcData, true, exportInfo);
            CategoryUtil.CreateMaterialAssociation(cfg.ExporterIFC, handle, cfg.MaterialId);

            return(true);
        }
        private static bool ExportCustomFabricSheet(FabricSheetExportConfig cfg)
        {
            if (cfg.Equals(null) || cfg.Sheet.IsBent)
            {
                return(false);
            }

            string                 guid         = GUIDUtil.CreateGUID(cfg.Sheet);
            IFCAnyHandle           ownerHistory = ExporterCacheManager.OwnerHistoryHandle;
            HashSet <IFCAnyHandle> rebarHandles = new HashSet <IFCAnyHandle>();
            string                 matName      = NamingUtil.GetMaterialName(cfg.Doc, cfg.MaterialId);

            int ii = 0;

            do
            {
                WireDistributionDirection dir             = (WireDistributionDirection)ii;
                IList <Curve>             wireCenterlines = cfg.Sheet.GetWireCenterlines(dir);
                for (int jj = 0; jj < wireCenterlines.Count; jj++)
                {
                    double wireDiam = 0.0;

                    FabricWireItem wire = cfg.SheetType.GetWireItem(jj, dir);
                    if (cfg.Doc.GetElement(wire.WireType) is FabricWireType wireType)
                    {
                        wireDiam = UnitUtil.ScaleLength(wireType.WireDiameter);
                    }

                    IFCAnyHandle bodyItem = GeometryUtil.CreateSweptDiskSolid(cfg.ExporterIFC, cfg.File, wireCenterlines[jj], wireDiam / 2.0, null);
                    RepresentationUtil.CreateStyledItemAndAssign(cfg.File, cfg.Doc, cfg.MaterialId, bodyItem);

                    ISet <IFCAnyHandle> bodyItems = new HashSet <IFCAnyHandle> {
                        bodyItem
                    };
                    IFCAnyHandle shapeRep = null;
                    if (bodyItems.Count > 0)
                    {
                        shapeRep = RepresentationUtil.CreateAdvancedSweptSolidRep(cfg.ExporterIFC, cfg.Sheet, cfg.CategoryId,
                                                                                  cfg.ExporterIFC.Get3DContextHandle("Body"), bodyItems, null);
                    }
                    IList <IFCAnyHandle> shapeReps = new List <IFCAnyHandle>();
                    if (shapeRep != null)
                    {
                        shapeReps.Add(shapeRep);
                    }

                    IFCAnyHandle prodRep = IFCInstanceExporter.CreateProductDefinitionShape(cfg.File, null, null, shapeReps);
                    IFCAnyHandle handle  = IFCInstanceExporter.CreateReinforcingBar(cfg.ExporterIFC, cfg.Sheet, guid, ExporterCacheManager.OwnerHistoryHandle,
                                                                                    cfg.PlacementSetter.LocalPlacement, prodRep, matName, wireDiam, 0, 0, IFCReinforcingBarRole.NotDefined, null);
                    IFCAnyHandleUtil.SetAttribute(handle, "ObjectType", "Generic");
                    CategoryUtil.CreateMaterialAssociation(cfg.ExporterIFC, handle, cfg.MaterialId);
                    rebarHandles.Add(handle);
                }
                ii++;
            }while (ii < 2);

            IFCAnyHandle assemblyInstanceHnd = IFCInstanceExporter.CreateElementAssembly(cfg.ExporterIFC, cfg.Sheet, guid,
                                                                                         ownerHistory, cfg.PlacementSetter.LocalPlacement, null, null, IFCElementAssemblyType.UserDefined);
            IFCExportInfoPair assemblyExportInfo = new IFCExportInfoPair(IFCEntityType.IfcElementAssembly);

            cfg.ProductWrapper.AddElement(cfg.Sheet, assemblyInstanceHnd, cfg.PlacementSetter.LevelInfo, null, true, assemblyExportInfo);
            ExporterCacheManager.AssemblyInstanceCache.RegisterAssemblyInstance(cfg.Sheet.Id, assemblyInstanceHnd);
            IFCInstanceExporter.CreateRelAggregates(cfg.File, guid, ownerHistory, null, null, assemblyInstanceHnd, rebarHandles);

            return(true);
        }