当前位置: 首页>>代码示例>>C#>>正文


C# ExporterIFC类代码示例

本文整理汇总了C#中ExporterIFC的典型用法代码示例。如果您正苦于以下问题:C# ExporterIFC类的具体用法?C# ExporterIFC怎么用?C# ExporterIFC使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ExporterIFC类属于命名空间,在下文中一共展示了ExporterIFC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Export

        /// <summary>
        /// Exports mullion.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="mullion">
        /// The mullion object.
        /// </param>
        /// <param name="geometryElement">
        /// The geometry element.
        /// </param>
        /// <param name="localPlacement">
        /// The local placement handle.
        /// </param>
        /// <param name="extraParams">
        /// The extrusion creation data.
        /// </param>
        /// <param name="setter">
        /// The IFCPlacementSetter.
        /// </param>
        /// <param name="productWrapper">
        /// The IFCProductWrapper.
        /// </param>
        public static void Export(ExporterIFC exporterIFC, Mullion mullion, GeometryElement geometryElement,
           IFCAnyHandle localPlacement, IFCExtrusionCreationData extraParams, IFCPlacementSetter setter, IFCProductWrapper productWrapper)
        {
            IFCFile file = exporterIFC.GetFile();

            ElementId catId = CategoryUtil.GetSafeCategoryId(mullion);


            IFCSolidMeshGeometryInfo solidMeshInfo = ExporterIFCUtils.GetSolidMeshGeometry(exporterIFC, geometryElement, Transform.Identity);
            IList<Solid> solids = solidMeshInfo.GetSolids();
            IList<Mesh> polyMeshes = solidMeshInfo.GetMeshes();

            bool tryToExportAsExtrusion = true;
            if (solids.Count != 1 || polyMeshes.Count != 0)
                tryToExportAsExtrusion = false;

            IFCAnyHandle shapeRep = BodyExporter.ExportBody(mullion.Document.Application, exporterIFC, catId, solids, polyMeshes, tryToExportAsExtrusion, extraParams);
            IList<IFCAnyHandle> shapeReps = new List<IFCAnyHandle>();
            shapeReps.Add(shapeRep);
            IFCAnyHandle repHnd = file.CreateProductDefinitionShape(IFCLabel.Create(), IFCLabel.Create(), shapeReps);

            IFCLabel elemGUID = IFCLabel.CreateGUID(mullion);
            IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
            IFCLabel elemObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, mullion);
            IFCLabel elemId = NamingUtil.CreateIFCElementId(mullion);
            //IFCLabel elemType = IFCLabel.Create("MULLION");

            IFCAnyHandle mullionHnd = file.CreateMember(elemGUID, ownerHistory, elemObjectType, IFCLabel.Create(), elemObjectType,
               localPlacement, repHnd, elemId);
            productWrapper.AddElement(mullionHnd, setter, extraParams, true);
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:55,代码来源:MullionExporter.cs

示例2: Calculate

 /// <summary>
 /// Calculates span value for a beam.
 /// </summary>
 /// <param name="exporterIFC">
 /// The ExporterIFC object.
 /// </param>
 /// <param name="extrusionCreationData">
 /// The IFCExtrusionCreationData.
 /// </param>
 /// <param name="element">
 /// The element to calculate the value.
 /// </param>
 /// <param name="elementType">
 /// The element type.
 /// </param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     if (extrusionCreationData == null || MathUtil.IsAlmostZero(extrusionCreationData.ScaledLength))
         return false;
     m_Span = extrusionCreationData.ScaledLength;
     return true;
 }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:25,代码来源:BeamSpanCalculator.cs

示例3: Calculate

 /// <summary>
 /// Calculates shape parameter B for a rebar.
 /// </summary>
 /// <param name="exporterIFC">The ExporterIFC object.</param>
 /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
 /// <param name="element">The element to calculate the value.</param>
 /// <param name="elementType">The element type.</param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     bool ret = (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameterGroup.PG_GEOMETRY, "B", out m_ShapeParameterB) != null);
     if (ret)
         m_ShapeParameterB = m_ShapeParameterB * exporterIFC.LinearScale;
     return ret;
 }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:17,代码来源:ISOCD3766ShapeParameterBCalculator.cs

示例4: Calculate

        /// <summary>
        /// Calculates the end hook angle for a rebar.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            RebarBendData bendData = null;
            if (element is Rebar)
                bendData = (element as Rebar).GetBendData();
            else if (element is RebarInSystem)
                bendData = (element as RebarInSystem).GetBendData();
            
            if (bendData != null)
            {
                if (bendData.HookLength1 > MathUtil.Eps())
                {
                    ElementId hookAtEndTypeId;
                    if (ParameterUtil.GetElementIdValueFromElement(element, BuiltInParameter.REBAR_ELEM_HOOK_END_TYPE, out hookAtEndTypeId) != null)
                    {
                        RebarHookType rebarHookType = element.Document.GetElement(hookAtEndTypeId) as RebarHookType;
                        if (rebarHookType != null)
                        {
							//HookAngle is measured in radians, so scale directly.
                            m_Angle = rebarHookType.HookAngle *180 / Math.PI;
                            return true;
                        }
                    }
                }
            }
            return false;
        }
开发者ID:whztt07,项目名称:RevitIFC,代码行数:37,代码来源:ISOCD3766BendingEndHookCalculator.cs

示例5: Calculate

 /// <summary>
 /// Calculates slope value for a beam.
 /// </summary>
 /// <param name="exporterIFC">
 /// The ExporterIFC object.
 /// </param>
 /// <param name="extrusionCreationData">
 /// The IFCExtrusionCreationData.
 /// </param>
 /// <param name="element">
 /// The element to calculate the value.
 /// </param>
 /// <param name="elementType">
 /// The element type.
 /// </param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     if (extrusionCreationData == null)
         return false;
     m_Slope = extrusionCreationData.Slope;
     return true;
 }
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:25,代码来源:BeamSlopeCalculator.cs

示例6: Export

        /// <summary>
        /// Exports a Rebar, AreaReinforcement or PathReinforcement to IFC ReinforcingBar.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="element">The element.</param>
        /// <param name="filterView">The view.</param>
        /// <param name="productWrapper">The product wrapper.</param>
        public static void Export(ExporterIFC exporterIFC,
            Element element, Autodesk.Revit.DB.View filterView, ProductWrapper productWrapper)
        {
            if (element is Rebar)
            {
                ExportRebar(exporterIFC, element, filterView, productWrapper);
            }
            else if (element is AreaReinforcement)
            {
                AreaReinforcement areaReinforcement = element as AreaReinforcement;
                IList<ElementId> rebarIds = areaReinforcement.GetRebarInSystemIds();

                Document doc = areaReinforcement.Document;
                foreach (ElementId id in rebarIds)
                {
                    Element rebarInSystem = doc.GetElement(id);
                    ExportRebar(exporterIFC, rebarInSystem, filterView, productWrapper);
                }
            }
            else if (element is PathReinforcement)
            {
                PathReinforcement pathReinforcement = element as PathReinforcement;
                IList<ElementId> rebarIds = pathReinforcement.GetRebarInSystemIds();

                Document doc = pathReinforcement.Document;
                foreach (ElementId id in rebarIds)
                {
                    Element rebarInSystem = doc.GetElement(id);
                    ExportRebar(exporterIFC, rebarInSystem, filterView, productWrapper);
                }
            }
        }
开发者ID:stiter,项目名称:ifcexporter,代码行数:39,代码来源:RebarExporter.cs

示例7: Export

        /// <summary>
        /// Exports mullion.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="mullion">
        /// The mullion object.
        /// </param>
        /// <param name="geometryElement">
        /// The geometry element.
        /// </param>
        /// <param name="localPlacement">
        /// The local placement handle.
        /// </param>
        /// <param name="extraParams">
        /// The extrusion creation data.
        /// </param>
        /// <param name="setter">
        /// The IFCPlacementSetter.
        /// </param>
        /// <param name="productWrapper">
        /// The IFCProductWrapper.
        /// </param>
        public static void Export(ExporterIFC exporterIFC, Mullion mullion, GeometryElement geometryElement,
           IFCAnyHandle localPlacement, IFCExtrusionCreationData extraParams, IFCPlacementSetter setter, IFCProductWrapper productWrapper)
        {
            IFCFile file = exporterIFC.GetFile();

            ElementId catId = CategoryUtil.GetSafeCategoryId(mullion);

            BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
            IFCAnyHandle repHnd = RepresentationUtil.CreateBRepProductDefinitionShape(mullion.Document.Application, exporterIFC, mullion, catId,
                geometryElement, bodyExporterOptions, null, extraParams);
            if (IFCAnyHandleUtil.IsNullOrHasNoValue(repHnd))
            {
                extraParams.ClearOpenings();
                return;
            }

            string elemGUID = ExporterIFCUtils.CreateGUID(mullion);
            IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
            string elemObjectType = NamingUtil.CreateIFCObjectName(exporterIFC, mullion);
            string elemId = NamingUtil.CreateIFCElementId(mullion);

            IFCAnyHandle mullionHnd = IFCInstanceExporter.CreateMember(file, elemGUID, ownerHistory, elemObjectType, null, elemObjectType,
               localPlacement, repHnd, elemId);
            productWrapper.AddElement(mullionHnd, setter, extraParams, LevelUtil.AssociateElementToLevel(mullion));

            PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, mullion, productWrapper);
        }
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:51,代码来源:MullionExporter.cs

示例8: SetBestMaterialIdInExporter

        /// <summary>
        /// Sets best material id for current export state.
        /// </summary>
        /// <param name="geometryObject">The geometry object to get the best material id.</param>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        public static void SetBestMaterialIdInExporter(GeometryObject geometryObject, ExporterIFC exporterIFC)
        {
            ElementId materialId = GetBestMaterialIdForGeometry(geometryObject, exporterIFC);

            if (materialId != ElementId.InvalidElementId)
                exporterIFC.SetMaterialIdForCurrentExportState(materialId);
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:12,代码来源:BodyExporter.cs

示例9: ExportAssemblyInstanceElement

        /// <summary>
        /// Exports an element as an IFC assembly.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The IFCProductWrapper.</param>
        /// <returns>True if exported successfully, false otherwise.</returns>
        public static bool ExportAssemblyInstanceElement(ExporterIFC exporterIFC, AssemblyInstance element,
            IFCProductWrapper productWrapper)
        {
            if (element == null)
                return false;

            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                using (IFCPlacementSetter placementSetter = IFCPlacementSetter.Create(exporterIFC, element))
                {
                    string guid = ExporterIFCUtils.CreateGUID(element);
                    IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
                    string name = exporterIFC.GetName();
                    string objectType = exporterIFC.GetFamilyName();
                    IFCAnyHandle localPlacement = placementSetter.GetPlacement();
                    IFCAnyHandle representation = null;
                    string elementTag = NamingUtil.CreateIFCElementId(element);
                    IFCElementAssemblyType predefinedType = GetPredefinedTypeFromObjectType(objectType);

                    IFCAnyHandle assemblyInstanceHnd = IFCInstanceExporter.CreateElementAssembly(file, guid,
                        ownerHistory, name, null, objectType, localPlacement, representation, elementTag,
                        IFCAssemblyPlace.NotDefined, predefinedType);

                    productWrapper.AddElement(assemblyInstanceHnd, placementSetter.GetLevelInfo(), null, true);

                    PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);

                    ExporterCacheManager.AssemblyInstanceCache.RegisterAssemblyInstance(element.Id, assemblyInstanceHnd);
                }
                tr.Commit();
                return true;
            }
        }
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:43,代码来源:AssemblyInstanceExporter.cs

示例10: CreateUniformatClassification

        /// <summary>
        /// Creates uniformat classification.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC.</param>
        /// <param name="file">The file.</param>
        /// <param name="element">The element.</param>
        /// <param name="elemHnd">The element handle.</param>
        public static void CreateUniformatClassification(ExporterIFC exporterIFC, IFCFile file, Element element, IFCAnyHandle elemHnd)
        {
            // Create Uniformat classification, if it is not set.
            string uniformatKeyString = "Uniformat";
            string uniformatCode = "";
            if (ParameterUtil.GetStringValueFromElementOrSymbol(element, BuiltInParameter.UNIFORMAT_CODE, false, out uniformatCode) == null)
                ParameterUtil.GetStringValueFromElementOrSymbol(element, "Assembly Code", out uniformatCode);
            string uniformatDescription = "";

            if (!String.IsNullOrWhiteSpace(uniformatCode))
            {
                if (ParameterUtil.GetStringValueFromElementOrSymbol(element, BuiltInParameter.UNIFORMAT_DESCRIPTION, false, out uniformatDescription) == null)
                    ParameterUtil.GetStringValueFromElementOrSymbol(element, "Assembly Description", out uniformatDescription);
            }

            IFCAnyHandle classification;
            if (!ExporterCacheManager.ClassificationCache.ClassificationHandles.TryGetValue(uniformatKeyString, out classification))
            {
                classification = IFCInstanceExporter.CreateClassification(file, "http://www.csiorg.net/uniformat", "1998", null, uniformatKeyString);
                ExporterCacheManager.ClassificationCache.ClassificationHandles.Add(uniformatKeyString, classification);
            }

                InsertClassificationReference(exporterIFC, file, element, elemHnd, uniformatKeyString, uniformatCode, uniformatDescription, "http://www.csiorg.net/uniformat" );

        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:32,代码来源:ClassificationUtil.cs

示例11: ExportFooting

        /// <summary>
        /// Exports an element to IFC footing.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="element">
        /// The element.
        /// </param>
        /// <param name="geometryElement">
        /// The geometry element.
        /// </param>
        /// <param name="ifcEnumType">
        /// The string value represents the IFC type.
        /// </param>
        /// <param name="productWrapper">
        /// The IFCProductWrapper.
        /// </param>
        public static void ExportFooting(ExporterIFC exporterIFC, Element element, GeometryElement geometryElement,
           string ifcEnumType, IFCProductWrapper productWrapper)
        {
            // export parts or not
            bool exportParts = PartExporter.CanExportParts(element);
            if (exportParts && !PartExporter.CanExportElementInPartExport(element, element.Level.Id, false))
                return;

            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                using (IFCPlacementSetter setter = IFCPlacementSetter.Create(exporterIFC, element))
                {
                    using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
                    {                      
                        ecData.SetLocalPlacement(setter.GetPlacement());
                      
                        IFCAnyHandle prodRep = null;
                        if (!exportParts)
                        {
                            ElementId catId = CategoryUtil.GetSafeCategoryId(element);

                            BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
                            prodRep = RepresentationUtil.CreateBRepProductDefinitionShape(element.Document.Application, exporterIFC,
                               element, catId, geometryElement, bodyExporterOptions, null, ecData);
                            if (IFCAnyHandleUtil.IsNullOrHasNoValue(prodRep))
                            {
                                ecData.ClearOpenings();
                                return;
                            }
                        }

                        string instanceGUID = ExporterIFCUtils.CreateGUID(element);
                        string origInstanceName = exporterIFC.GetName();
                        string instanceName = NamingUtil.GetNameOverride(element, origInstanceName);
                        string instanceDescription = NamingUtil.GetDescriptionOverride(element, null);
                        string instanceObjectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
                        string instanceElemId = NamingUtil.CreateIFCElementId(element);
                        Toolkit.IFCFootingType footingType = GetIFCFootingType(element, ifcEnumType);

                        IFCAnyHandle footing = IFCInstanceExporter.CreateFooting(file, instanceGUID, exporterIFC.GetOwnerHistoryHandle(),
                            instanceName, instanceDescription, instanceObjectType, ecData.GetLocalPlacement(), prodRep, instanceElemId, footingType);

                        if (exportParts)
                        {
                            PartExporter.ExportHostPart(exporterIFC, element, footing, productWrapper, setter, setter.GetPlacement(), null);
                        }

                        productWrapper.AddElement(footing, setter, ecData, LevelUtil.AssociateElementToLevel(element));

                        OpeningUtil.CreateOpeningsIfNecessary(footing, element, ecData, exporterIFC, ecData.GetLocalPlacement(), setter, productWrapper);

                        PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);
                    }
                }

                tr.Commit();
            }
        }
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:78,代码来源:FootingExporter.cs

示例12: CreateBaseShapeRepresentation

 /// <summary>
 /// Creates a shape representation and register it to shape representation layer.
 /// </summary>
 /// <param name="exporterIFC">The ExporterIFC object.</param>
 /// <param name="contextOfItems">The context for which the different subtypes of representation are valid.</param>
 /// <param name="identifier">The identifier for the representation.</param>
 /// <param name="representationType">The type handle for the representation.</param>
 /// <param name="items">Collection of geometric representation items that are defined for this representation.</param>
 /// <returns>The handle.</returns>
 public static IFCAnyHandle CreateBaseShapeRepresentation(ExporterIFC exporterIFC, IFCAnyHandle contextOfItems,
    string identifier, string representationType, ISet<IFCAnyHandle> items)
 {
     IFCFile file = exporterIFC.GetFile();
     IFCAnyHandle newShapeRepresentation = IFCInstanceExporter.CreateShapeRepresentation(file, contextOfItems, identifier, representationType, items);
     return newShapeRepresentation;
 }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:16,代码来源:RepresentationUtil.cs

示例13: Calculate

 /// <summary>
 /// Calculates shape parameter A for a rebar.
 /// </summary>
 /// <param name="exporterIFC">The ExporterIFC object.</param>
 /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
 /// <param name="element">The element to calculate the value.</param>
 /// <param name="elementType">The element type.</param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     bool ret = (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameterGroup.PG_GEOMETRY, "A", out m_ShapeParameterA) != null);
     if (ret)
         m_ShapeParameterA = UnitUtil.ScaleLength(m_ShapeParameterA);
     return ret;
 }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:17,代码来源:ISOCD3766ShapeParameterACalculator.cs

示例14: Calculate

 /// <summary>
 /// Calculates perimeter for a slab.
 /// </summary>
 /// <param name="exporterIFC">
 /// The ExporterIFC object.
 /// </param>
 /// <param name="extrusionCreationData">
 /// The IFCExtrusionCreationData.
 /// </param>
 /// <param name="element">
 /// The element to calculate the value.
 /// </param>
 /// <param name="elementType">
 /// The element type.
 /// </param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     if (extrusionCreationData == null)
         return false;
     m_Perimeter = extrusionCreationData.ScaledOuterPerimeter;
     return m_Perimeter > MathUtil.Eps();
 }
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:25,代码来源:SlabPerimeterCalculator.cs

示例15: Calculate

 /// <summary>
 /// Calculates width for a slab.
 /// </summary>
 /// <param name="exporterIFC">
 /// The ExporterIFC object.
 /// </param>
 /// <param name="extrusionCreationData">
 /// The IFCExtrusionCreationData.
 /// </param>
 /// <param name="element">
 /// The element to calculate the value.
 /// </param>
 /// <param name="elementType">
 /// The element type.
 /// </param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     if (extrusionCreationData == null)
         return false;
     m_Width = extrusionCreationData.ScaledLength;
     return m_Width > MathUtil.Eps();
 }
开发者ID:whztt07,项目名称:RevitIFC,代码行数:25,代码来源:SlabWidthCalculator.cs


注:本文中的ExporterIFC类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。