Autodesk.Revit.DB.DirectShapeTypeOptions类用于设置直接生成几何体的选项。它是DirectShapeType.Create的参数之一。
无
bool
bool
bool
ElementId
// 创建DirectShapeTypeOptions对象
DirectShapeTypeOptions options = new DirectShapeTypeOptions();
options.ImportInstance = true;
options.UseColorForRender = true;
options.UseMaterialForRender = false;
// 设置RenderOptions
RenderMaterial material = new RenderMaterial(doc, "MaterialName");
RenderNode node = new RenderNode(null);
RenderProperty property = new RenderProperty(BuiltInParameter.MATERIAL_ID_PARAM, material.Id);
node.SetProperty(property);
RenderMaterialElementIdMap materialMap = new RenderMaterialElementIdMap();
materialMap.Map(material.Id, node);
RenderAppearanceAssetElement asset = new RenderAppearanceAssetElement(doc, "AssetName");
asset.SetMaterial(materialMap);
RenderNode appearanceNode = new RenderNode(null, asset);
RenderAppearance appearance = new RenderAppearance();
appearance.Color = Color.Red;
appearanceNode.SetAppearance(appearance);
options.RenderOptions = new RenderNodeList(new List<RenderNode>() { appearanceNode });
// 创建DirectShapeType
DirectShapeType directShapeType = DirectShapeType.Create(doc, "DirectShapeTypeName", ElementId.InvalidElementId, options);