本文整理汇总了C#中Revit.IFC.Export.Utility.ProductWrapper.AddFinishMaterial方法的典型用法代码示例。如果您正苦于以下问题:C# ProductWrapper.AddFinishMaterial方法的具体用法?C# ProductWrapper.AddFinishMaterial怎么用?C# ProductWrapper.AddFinishMaterial使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Revit.IFC.Export.Utility.ProductWrapper
的用法示例。
在下文中一共展示了ProductWrapper.AddFinishMaterial方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportHostObjectMaterials
//.........这里部分代码省略.........
widths.Add(cs != null ? cs.GetWidth() : 0);
functions.Add(MaterialFunctionAssignment.None);
}
// We can't create IfcMaterialLayers without creating an IfcMaterialLayerSet. So we will simply collate here.
IList<IFCAnyHandle> materialHnds = new List<IFCAnyHandle>();
IList<int> widthIndices = new List<int>();
double thickestLayer = 0.0;
for (int ii = 0; ii < matIds.Count; ++ii)
{
// Require positive width for IFC2x3 and before, and non-negative width for IFC4.
if (widths[ii] < -MathUtil.Eps())
continue;
bool almostZeroWidth = MathUtil.IsAlmostZero(widths[ii]);
if (ExporterCacheManager.ExportOptionsCache.FileVersion != IFCVersion.IFC4 && almostZeroWidth)
continue;
if (almostZeroWidth)
widths[ii] = 0.0;
IFCAnyHandle materialHnd = CategoryUtil.GetOrCreateMaterialHandle(exporterIFC, matIds[ii]);
if (primaryMaterialHnd == null || (widths[ii] > thickestLayer))
{
primaryMaterialHnd = materialHnd;
thickestLayer = widths[ii];
}
widthIndices.Add(ii);
materialHnds.Add(materialHnd);
if ((productWrapper != null) && (functions[ii] == MaterialFunctionAssignment.Finish1 || functions[ii] == MaterialFunctionAssignment.Finish2))
{
productWrapper.AddFinishMaterial(materialHnd);
}
}
int numLayersToCreate = widthIndices.Count;
if (numLayersToCreate == 0)
return false;
if (!containsBRepGeometry)
{
IList<IFCAnyHandle> layers = new List<IFCAnyHandle>(numLayersToCreate);
for (int ii = 0; ii < numLayersToCreate; ii++)
{
int widthIndex = widthIndices[ii];
double scaledWidth = UnitUtil.ScaleLength(widths[widthIndex]);
IFCAnyHandle materialLayer = IFCInstanceExporter.CreateMaterialLayer(file, materialHnds[ii], scaledWidth, null);
layers.Add(materialLayer);
}
string layerSetName = exporterIFC.GetFamilyName();
materialLayerSet = IFCInstanceExporter.CreateMaterialLayerSet(file, layers, layerSetName);
ExporterCacheManager.MaterialLayerSetCache.Register(typeElemId, materialLayerSet);
ExporterCacheManager.MaterialLayerSetCache.RegisterPrimaryMaterialHnd(typeElemId, primaryMaterialHnd);
}
else
{
foreach (IFCAnyHandle elemHnd in elemHnds)
{
CategoryUtil.CreateMaterialAssociations(exporterIFC, elemHnd, matIds);
}
}