//添加类型
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);
}