Revit中Category的获取

开发基础代码

UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document doc = uidoc.Document;
UIApplication uiapp = commandData.Application;
Application app = uiapp.Application;

获得单一类别

以墙为例
方法一:Category wallCategory  = doc.Settings.Categories.get_Item(BuiltInCategory.OST_Walls); 
方法二: Category wallCategory  =Category.GetCategory(doc, BuiltInCategory.OST_Walls);
方法三:Category wall3=Category.GetCategory(doc, new ElementId(-2000011));

获取类别后就可以得到其他参数
wallCategory .Name就是类别名:墙

wallCategory  .CategoryType就是类别类型:Model(模型)

(BuiltInCategory)cat.Id.IntegerValue:OST_Walls 

获取当前文档所有的Category

Categories cats = doc.Settings.Categories; 

备注:对于所有revit文档来说,类别定了ElementId也就定了,如墙的为-2000011,不随项目不同而变化。

在此列出所以Category的ElementId:反编译其他文档一般只能看出Id,通过这个可以反推出类别来。其他的枚举类型如BuiltinParameter类似。

public enum BuiltInCategory

    {

        INVALID = -1,

        OST_MatchAll = -2000002,

        OST_MatchModel = -2000003,

        OST_MatchAnnotation = -2000004,

        OST_MatchDetail = -2000005,

        OST_MatchProfile = -2000006,

        OST_MatchSiteComponent = -2000007,

        OST_ScheduleViewParamGroup = -2000008,

        OST_Walls = -2000011,

        OST_WallsCutOutlines = -2000012,

        OST_WallsProjectionOutlines = -2000013,

        OST_WallsAnalyticalGeometry = -2000545,

        OST_WallsSurfacePattern = -2000540,

        OST_WallsMembrane = -2000580,

        OST_WallsStructure = -2000581,

        OST_WallsInsulation = -2000582,

        OST_WallsSubstrate = -2000583,

        OST_WallsFinish1 = -2000584,

        OST_WallsFinish2 = -2000585,

        OST_WallsDefault = -2000586,

        OST_HiddenWallLines = -2000587,

        OST_WallsCutPattern = -2000588,

        OST_RoofsMembrane = -2000590,

        OST_RoofsStructure = -2000591,

        OST_RoofsInsulation = -2000592,

        OST_RoofsSubstrate = -2000593,

        OST_RoofsFinish1 = -2000594,

        OST_RoofsFinish2 = -2000595,

        OST_RoofsDefault = -2000596,

        OST_RoofsCutPattern = -2000597,

        OST_RoofsInteriorEdges = -2000598,

        OST_FloorsMembrane = -2000600,

        OST_FloorsStructure = -2000601,

        OST_FloorsInsulation = -2000602,

        OST_FloorsSubstrate = -2000603,

        OST_FloorsFinish1 = -2000604,

        OST_FloorsFinish2 = -2000605,

        OST_FloorsDefault = -2000606,

        OST_HiddenFloorLines = -2000607,

        OST_FloorsCutPattern = -2000608,

        OST_FloorsInteriorEdges = -2000609,

        OST_CeilingsMembrane = -2000610,

        OST_CeilingsStructure = -2000611,

        OST_CeilingsInsulation = -2000612,

        OST_CeilingsSubstrate = -2000613,

        OST_CeilingsFinish1 = -2000614,

        OST_CeilingsFinish2 = -2000615,

        OST_CeilingsDefault = -2000616,

        OST_CeilingsCutPattern = -2000617,

        OST_WallRefPlanes_Obsolete_IdInWrongRange = -20000896,

        OST_WallRefPlanes = -2000896,

        OST_ArcWallRectOpening = -2000999,

        OST_SWallRectOpening = -2000997,

        OST_RoofOpening = -2000897,

        OST_DormerOpeningIncomplete = -2000998,

        OST_FloorOpening = -2000898,

        OST_CeilingOpening = -2000899,

        OST_ShaftOpening = -2000996,

        OST_StructuralFramingOpening,

        OST_ColumnOpening,

        OST_Windows = -2000014,

        OST_WindowsGlassCut = -2000015,

        OST_WindowsGlassProjection = -2000016,

        OST_WindowsFrameMullionCut = -2000017,

        OST_WindowsFrameMullionProjection = -2000018,

        OST_WindowsSillHeadCut = -2000019,

        OST_WindowsSillHeadProjection = -2000020,

        OST_WindowsOpeningCut = -2000021,

        OST_WindowsOpeningProjection = -2000022,

        OST_Doors = -2000023,

        OST_DoorsPanelCut = -2000024,

        OST_DoorsPanelProjection = -2000025,

        OST_DoorsOpeningCut = -2000026,

        OST_DoorsOpeningProjection = -2000027,

        OST_DoorsFrameMullionCut = -2000028,

        OST_DoorsFrameMullionProjection = -2000029,

        OST_DoorsGlassCut = -2000030,

        OST_DoorsGlassProjection = -2000031,

        OST_Floors = -2000032,

        OST_FloorsCut = -2000033,

        OST_FloorsProjection = -2000034,

        OST_FloorsSurfacePattern = -2000541,

        OST_FloorsAnalyticalGeometry = -2000546,

        OST_Roofs = -2000035,

        OST_RoofsCut = -2000036,

        OST_RoofsProjection = -2000037,

        OST_RoofsSurfacePattern = -2000542,

        OST_Ceilings = -2000038,

        OST_CeilingsCut = -2000039,

        OST_CeilingsProjection = -2000040,

        OST_CeilingsSurfacePattern = -2000543,

        OST_Lines = -2000051,

        OST_Curves = -2000041,

        OST_CurvesThinLines = -2000042,

        OST_CurvesMediumLines = -2000043,

        OST_CurvesWideLines = -2000044,

        OST_SketchLines = -2000045,

        OST_InvisibleLines = -2000064,

        OST_AxisOfRotation = -2000065,

        OST_RoomSeparationLines = -2000066,

        OST_StairsSketchBoundaryLines = -2000067,

        OST_StairsSketchRiserLines = -2000068,

        OST_StairsSketchRunLines = -2000069,

        OST_StairsSketchLandingCenterLines = -2000070,

        OST_CloudLines = -2000076,

        OST_InsulationLines = -2000077,

        OST_GenericLines = -2000078,

        OST_AreaSchemeLines = -2000079,

        OST_RepeatingDetailLines = -2003321,

        OST_RemovedGridSeg_Obsolete_IdInWrongRange = -20000827,

        OST_RemovedGridSeg = -2000827,

        OST_StickSymbols_Obsolete_IdInWrongRange = -20000828,

        OST_InstanceDrivenLineStyle = -2000828,

        OST_RoomPolylines = -2000829,

        OST_AreaPolylines = -2000830,

        OST_MEPSpaceSeparationLines = -2000831,

        OST_DimLockControlLeader = -2000832,

        OST_DividedSurface = -2003323,

        OST_DividedSurface_Nodes = -2003324,

        OST_DividedSurface_Gridlines = -2003325,

        OST_DividedSurface_PatternLines = -2003326,

        OST_DividedSurface_PatternFill = -2003327,

        OST_DividedSurface_PreDividedSurface = -2003328,

        OST_DividedSurface_TransparentFace = -2003329,

        OST_AlwaysExcludedInAllViews = -2003330,

        OST_TilePatterns = -2003331,

        OST_DividedSurfaceBelt = -2003332,

        OST_DividedSurface_DiscardedDivisionLines = -2003333,

        OST_FillPatterns = -2000081,

        OST_Extrusions = -2000060,

        OST_Furniture = -2000080,

        OST_Columns = -2000100,

        OST_Stairs = -2000120,

        OST_StairsIncomplete_Deprecated = -2000121,

        OST_StairsAboveCut_ToBeDeprecated = -2000122,

        OST_StairsStringerCarriage = -2000123,

        OST_StairsSupportsAboveCut = -2000124,

        OST_StairsUpText = -2000125,

        OST_StairsDownText = -2000129,

        OST_StairsUpArrows = -2000130,

        OST_StairsDownArrows = -2000131,

        OST_StairsRailing = -2000126,

        OST_StairsRailingBaluster = -2000127,

        OST_StairsRailingRail = -2000128,

        OST_StairsRailingAboveCut = -2000132,

        OST_StairsRailingTags = -2000133,

        OST_Fixtures = -2000140,

        OST_Rooms = -2000160,

        OST_RoomInteriorFillVisibility = -2000161,

        OST_RoomReferenceVisibility = -2000162,

        OST_AreaInteriorFillVisibility = -2000163,

        OST_AreaReferenceVisibility = -2000164,

        OST_AreaColorFill = -2000165,

        OST_RoomInteriorFill = -2000166,

        OST_RoomReference = -2000167,

        OST_AreaInteriorFill = -2000168,

        OST_AreaReference = -2000169,

        OST_CurtainWallPanels = -2000170,

        OST_CurtainWallMullions = -2000171,

        OST_CurtainWallMullionsCut = -2000172,

        OST_CurtainGrids = -2000173,

        OST_CurtainGridsRoof = -2000320,

        OST_CurtainGridsWall = -2000321,

        OST_CurtainGridsSystem = -2000322,

        OST_CurtainGridsCurtaSystem = -2000323,

        OST_Railings = -2000175,

        OST_RailingBalusterRail = -2000176,

        OST_RailingBalusterRailCut = -2000177,

        OST_Ramps = -2000180,

        OST_RampsIncomplete = -2003301,

        OST_RampsAboveCut = -2003302,

        OST_RampsStringer = -2003303,

        OST_RampsStringerAboveCut = -2003304,

        OST_RampsUpText = -2003305,

        OST_RampsDownText = -2003306,

        OST_RampsUpArrow = -2003307,

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值