FamilyElementVisibility Class


Provides access to the visibility parameters of family elements in family document.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)

Syntax

C#
public class FamilyElementVisibility : APIObject
Visual Basic
Public Class FamilyElementVisibility _
	Inherits APIObject
Visual C++
public ref class FamilyElementVisibility : public APIObject

Examples

Copy C#
public void CreateAndSetVisibility(Autodesk.Revit.DB.Document familyDocument, SketchPlane sketchPlane)
{
    // create a new ModelCurve in the family document
    XYZ p0 = new XYZ(1, 1, 0);
    XYZ p1 = new XYZ(5, 1, 0);
    Line line1 = Line.CreateBound(p0, p1);

    ModelCurve modelCurve1 = familyDocument.FamilyCreate.NewModelCurve(line1, sketchPlane);

    // create a new ModelText along ModelCurve line
    ModelText text = familyDocument.FamilyCreate.NewModelText("Hello World", null, sketchPlane, p0, HorizontalAlign.Center, 0.1);

    // set visibility for text 
    FamilyElementVisibility textVisibility = new FamilyElementVisibility(FamilyElementVisibilityType.Model);
    textVisibility.IsShownInTopBottom = false;
    text.SetVisibility(textVisibility);

    // set visibility for line
    FamilyElementVisibility curveVisibility = new FamilyElementVisibility(FamilyElementVisibilityType.Model);
    curveVisibility.IsShownInCoarse = false;
    modelCurve1.SetVisibility(curveVisibility);

}
Copy VB.NET
Public Sub CreateAndSetVisibility(familyDocument As Autodesk.Revit.DB.Document, sketchPlane As SketchPlane)
    ' create a new ModelCurve in the family document
    Dim p0 As New XYZ(1, 1, 0)
    Dim p1 As New XYZ(5, 1, 0)
    Dim line1 As Line = Line.CreateBound(p0, p1)

    Dim modelCurve1 As ModelCurve = familyDocument.FamilyCreate.NewModelCurve(line1, sketchPlane)

    ' create a new ModelText along ModelCurve line
    Dim text As ModelText = familyDocument.FamilyCreate.NewModelText("Hello World", Nothing, sketchPlane, p0, HorizontalAlign.Center, 0.1)

    ' set visibility for text 
    Dim textVisibility As New FamilyElementVisibility(FamilyElementVisibilityType.Model)
    textVisibility.IsShownInTopBottom = False
    text.SetVisibility(textVisibility)

    ' set visibility for line
    Dim curveVisibility As New FamilyElementVisibility(FamilyElementVisibilityType.Model)
    curveVisibility.IsShownInCoarse = False
    modelCurve1.SetVisibility(curveVisibility)

End Sub

Inheritance Hierarchy

System Object
Autodesk.Revit.DB APIObject
Autodesk.Revit.DB FamilyElementVisibility

See Also