Revit Family API 添加材质参数设置可见性
start
url:http://greatverve.cnblogs.com/p/revit-family-api-set-visible.html
//添加类型
void AddType(FamilyManager familyMgr, string name, double w, double d)
{
FamilyType type1 = familyMgr.NewType(name);
FamilyParameter paramW = familyMgr.get_Parameter("Width");
double valW = Util.mmToFeet(w);
if (paramW != null)
{
familyMgr.Set(paramW, valW);
}
FamilyParameter paramD = familyMgr.get_Parameter("Depth");
double valD = Util.mmToFeet(d);
if (paramD != null)
{
familyMgr.Set(paramD, valD);
}
}
//添加材质参数
void AddMaterials(FamilyManager familyMgr, Document doc, Extrusion pSolid)
{
Material pMat = Util.findElement(doc, typeof(Material), "Glass") as Material;
ElementId idMat = pMat.Id;
FamilyParameter paramFamilyMaterial = familyMgr.get_Parameter("Column Finish");
Parameter paramSolidMaterial = pSolid.get_Parameter("Material");
familyMgr.AssociateElementParameterToFamilyParameter(paramSolidMaterial, paramFamilyMaterial);
AddType(familyMgr,"Glass", 600.0, 600.0);
familyMgr.Set(paramFamilyMaterial, idMat);
}
//设置可见性
void SetVisibility(Extrusion pSolid)
{
FamilyElementVisibility pVis = new FamilyElementVisibility(FamilyElementVisibilityType.Model);
pVis.IsShownInCoarse = false;
pSolid.SetVisibility(pVis);
}
void AddType(FamilyManager familyMgr, string name, double w, double d)
{
FamilyType type1 = familyMgr.NewType(name);
FamilyParameter paramW = familyMgr.get_Parameter("Width");
double valW = Util.mmToFeet(w);
if (paramW != null)
{
familyMgr.Set(paramW, valW);
}
FamilyParameter paramD = familyMgr.get_Parameter("Depth");
double valD = Util.mmToFeet(d);
if (paramD != null)
{
familyMgr.Set(paramD, valD);
}
}
//添加材质参数
void AddMaterials(FamilyManager familyMgr, Document doc, Extrusion pSolid)
{
Material pMat = Util.findElement(doc, typeof(Material), "Glass") as Material;
ElementId idMat = pMat.Id;
FamilyParameter paramFamilyMaterial = familyMgr.get_Parameter("Column Finish");
Parameter paramSolidMaterial = pSolid.get_Parameter("Material");
familyMgr.AssociateElementParameterToFamilyParameter(paramSolidMaterial, paramFamilyMaterial);
AddType(familyMgr,"Glass", 600.0, 600.0);
familyMgr.Set(paramFamilyMaterial, idMat);
}
//设置可见性
void SetVisibility(Extrusion pSolid)
{
FamilyElementVisibility pVis = new FamilyElementVisibility(FamilyElementVisibilityType.Model);
pVis.IsShownInCoarse = false;
pSolid.SetVisibility(pVis);
}
我这个博客废弃不用了,今天想寻找外链的时候,突然想到这个博客权重很高。
有需要免费外链的,留言即可,我准备把这个博客变成免费的友情链接站点。