1. 程式人生 > >二次開發獲取預設型別Id

二次開發獲取預設型別Id

Document GetDefaultElementTypeId Method

public ElementId GetDefaultElementTypeId(
	ElementTypeGroup defaultTypeId
)

ElementTypeGroup為列舉型別 

Member name Description
RailingsTypeForStairs The railings type for stairs.
RailingsTypeForRamps The railings type for ramps.
WallType The wall type.
RoofType The roof type.
FloorType The floor type.
FootingSlabType The footing slab type.
CeilingType The ceiling type.
StairsBySketchType The stairs by sketch type.
GridType The Grid Type.
LevelType The Level Type
LinearDimensionType The linear dimension type.
SpotElevationType The spot elevation type.
TextNoteType The text note type.
TagNoteType The tag note type.
ModelTextType The model text type.
CorniceType The cornice type.
RevealType The reveal type.
ViewportType The viewport type.
ReferenceViewerType The reference viewer type.
CalloutType The callout view type.
RampType The ramp type.
StairsRailingType The stairs railing type.
ModelGroupType The model group type.
DetailGroupType The detail group type.
AttachedDetailGroupType The attached detail group type.
FilledRegionType The filled region type.
RadialDimensionType The radial dimension type.
AngularDimensionType The angular dimension type.
ArcLengthDimensionType The arc length dimension type.
BuildingPadType The building pad type.
DecalType The decal type.
ContourLabelingType The contour labeling type.
RoofSoffitType The roof soffit type.
FasciaType The fascial type.
GutterType The gutter type.
EdgeSlabType The slab edge type.
RepeatingDetailType The repeating detail type.
BeamSystemType The beam system type.
CurtainSystemType The curtain system type.
ViewType3D The 3D view type.
ViewTypeWalkthrough The walkthrough view type.
ViewTypeRendering The rendering view type.
ViewTypeSchedule The schedule view type.
ViewTypeLegend The legend view type.
ViewTypeCostReport The cost report view type.
ViewTypeSheet The sheet view type.
ViewTypeDrafting The drafting view type.
ViewTypeStructuralPlan The structural plan view type.
ViewTypeFloorPlan The floor plan view type.
ViewTypeCeilingPlan The ceiling plan view type.
ViewTypeSection The section view type.
ViewTypeDetailView The detail view type.
ViewTypeElevation The elevation view type.
ViewTypeStructuralElevation The structrual elevation view type.
ViewTypeLoadsReport The loads report view type.
ViewTypePressureLossReport The pressure loss report view type.
ViewTypePanelSchedule The panel schedule view type.
AreaLoadType The area load type.
LineLoadType The line load type.
PointLoadType The point load type.
RebarBarType The rebar bar type.
AreaReinforcementType Area reinforcement type.
PathReinforcementType Path reinforcement type.
FabricAreaType The fabric area type.
FabricSheetType The fabric sheet type.
DuctType The duct type.
FlexDuctType The flex duct type.
PipeType The pipe type.
FlexPipeType The flex pipe type.
WireType The wire type.
SpotCoordinateType The spot coordinate type.
ViewTypeGraphScheduleColumn The graph schedule column view type.
SpotSlopeType The spot slope type.
WallFoundationType The wall foundation type.
PipeInsulationType The pipe insulation type.
DuctInsulationType The duct insulation type.
DuctLiningType The duct lining type.
CableTrayType The cable tray type.
ConduitType The conduilt type.
DiameterDimensionType The diameter dimension type.
StairsType The stairs type.
AnalyticalLinkType The analytical link type.
MultiReferenceAnnotationType The multi-reference annotation type.
ColorFillType The color fill legend type.
RebarContainerType The Rebar Container Type.

案例

private bool IsWallUsingDefaultType(Document document, Wall wall)
{
    ElementId defaultElementTypeId = document.GetDefaultElementTypeId(ElementTypeGroup.WallType);
    return (wall.WallType.Id == defaultElementTypeId);
}

Document.GetDefaultFamilyTypeId Method

public ElementId GetDefaultFamilyTypeId(
	ElementId familyCategoryId
)

Gets the default family type id with the given family category id.

案例

private void AssignDefaultTypeToColumn(Document document, FamilyInstance column)
{
    ElementId defaultTypeId = document.GetDefaultFamilyTypeId(new ElementId(BuiltInCategory.OST_StructuralColumns));

    if (defaultTypeId != ElementId.InvalidElementId)
    {
        FamilySymbol defaultType = document.GetElement(defaultTypeId) as FamilySymbol;
        if (defaultType != null)
        {
            column.Symbol = defaultType;
        }
    }
}