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


C# IFCAnyHandle.SetAttribute方法代码示例

本文整理汇总了C#中IFCAnyHandle.SetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IFCAnyHandle.SetAttribute方法的具体用法?C# IFCAnyHandle.SetAttribute怎么用?C# IFCAnyHandle.SetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFCAnyHandle的用法示例。


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

示例1: CreateElementTypeProperties

        /// <summary>
        /// Creates and associates the common property sets associated with ElementTypes.  These are handled differently than for elements.
        /// </summary>
        /// <param name="exporterIFC">The IFC exporter object.</param>
        /// <param name="elementType">The element type whose properties are exported.</param>
        /// <param name="existingPropertySets">The handles of property sets already associated with the type.</param>
        /// <param name="prodTypeHnd">The handle of the entity associated with the element type object.</param>
        public static void CreateElementTypeProperties(ExporterIFC exporterIFC, ElementType elementType,
            HashSet<IFCAnyHandle> existingPropertySets, IFCAnyHandle prodTypeHnd)
        {
            HashSet<IFCAnyHandle> propertySets = new HashSet<IFCAnyHandle>();

            // Pass in an empty set of handles - we don't want IfcRelDefinesByProperties for type properties.
            ISet<IFCAnyHandle> associatedObjectIds = new HashSet<IFCAnyHandle>();
            PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, elementType, associatedObjectIds);

            TypePropertyInfo additionalPropertySets = null;
            if (ExporterCacheManager.TypePropertyInfoCache.TryGetValue(elementType.Id, out additionalPropertySets))
                propertySets.UnionWith(additionalPropertySets.PropertySets);

            if (existingPropertySets != null && existingPropertySets.Count > 0)
                propertySets.UnionWith(existingPropertySets);

            IFCFile file = exporterIFC.GetFile();
            using (IFCTransaction transaction = new IFCTransaction(file))
            {
                Document doc = elementType.Document;
                IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();

                IList<IList<PropertySetDescription>> psetsToCreate = ExporterCacheManager.ParameterCache.PropertySets;

                IList<PropertySetDescription> currPsetsToCreate = ExporterUtil.GetCurrPSetsToCreate(prodTypeHnd, psetsToCreate);
                foreach (PropertySetDescription currDesc in currPsetsToCreate)
                {
                    HashSet<IFCAnyHandle> props = currDesc.ProcessEntries(file, exporterIFC, null, elementType, elementType);
                    if (props.Count > 0)
                    {
                        int subElementIndex = currDesc.SubElementIndex;
                        string guid = GUIDUtil.CreateSubElementGUID(elementType, subElementIndex);

                        string paramSetName = currDesc.Name;
                        IFCAnyHandle propertySet = IFCInstanceExporter.CreatePropertySet(file, guid, ownerHistory, paramSetName, null, props);
                        propertySets.Add(propertySet);
                    }
                }

                if (propertySets.Count != 0)
                {
                    prodTypeHnd.SetAttribute("HasPropertySets", propertySets);
                    // Don't assign the property sets to the instances if we have just assigned them to the type.
                    if (additionalPropertySets != null)
                        additionalPropertySets.AssignedToType = true;
                }

                transaction.Commit();
            }
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:57,代码来源:PropertyUtil.cs

示例2: SetSurfaceStyleShading

 private static void SetSurfaceStyleShading(IFCAnyHandle surfaceStyleRendering, IFCAnyHandle surfaceColour)
 {
    surfaceStyleRendering.SetAttribute("SurfaceColour", surfaceColour);
 }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:4,代码来源:IFCInstanceExporter.cs

示例3: CreateElementTypeProperties

        /// <summary>
        /// Creates and associates the common property sets associated with ElementTypes.  These are handled differently than for elements.
        /// </summary>
        /// <param name="exporterIFC">The IFC exporter object.</param>
        /// <param name="elementType">The element type whose properties are exported.</param>
        /// <param name="existingPropertySets">The handles of property sets already associated with the type.</param>
        /// <param name="prodTypeHnd">The handle of the entity associated with the element type object.</param>
        public static void CreateElementTypeProperties(ExporterIFC exporterIFC, ElementType elementType, 
            HashSet<IFCAnyHandle> existingPropertySets, IFCAnyHandle prodTypeHnd)
        {
            HashSet<IFCAnyHandle> propertySets = new HashSet<IFCAnyHandle>();
            propertySets.UnionWith(existingPropertySets);

            IFCFile file = exporterIFC.GetFile();
            using (IFCTransaction transaction = new IFCTransaction(file))
            {
                Document doc = elementType.Document;

                IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();

                IList<IList<PropertySetDescription>> psetsToCreate = ExporterCacheManager.ParameterCache.PropertySets;

                IList<PropertySetDescription> currPsetsToCreate = GetCurrPSetsToCreate(prodTypeHnd, psetsToCreate);
                foreach (PropertySetDescription currDesc in currPsetsToCreate)
                {
                    HashSet<IFCAnyHandle> props = currDesc.ProcessEntries(file, exporterIFC, null, elementType, elementType);
                    if (props.Count > 0)
                    {
                        int subElementIndex = currDesc.SubElementIndex;
                        string guid = GUIDUtil.CreateSubElementGUID(elementType, subElementIndex);

                        string paramSetName = currDesc.Name;
                        IFCAnyHandle propertySet = IFCInstanceExporter.CreatePropertySet(file, guid, ownerHistory, paramSetName, null, props);
                        propertySets.Add(propertySet);
                    }
                }

                if (propertySets.Count != 0)
                    prodTypeHnd.SetAttribute("HasPropertySets", propertySets);

                transaction.Commit();
            }
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:43,代码来源:Exporter.cs


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