How to get Part Type Data from Electrical Equipment in Revit API

How to get Part Type Data from Electrical Equipment in Revit API

Pravin_Lande
Enthusiast Enthusiast
1,704 Views
4 Replies
Message 1 of 5

How to get Part Type Data from Electrical Equipment in Revit API

Pravin_Lande
Enthusiast
Enthusiast

Hi

 

We want to get the Part Type information from Electrical Equipment in Revit API.

 

Kindly suggest how can we get the Part Type information as per attached screenshot.

 

Regards,

Pravin

 

0 Likes
1,705 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Dear Pravin,

 

Have you installed RevitLookup?

 

If not, please do so right now, before reading any further.

 

RevitLookup is one of the most basic, fundamental and important tools for Revit API development.

 

It enables you to easily interactively explore the contents of the Revit database, its elements, their properties and relationships.

 

Using that tool will enable you to easily answer your question yourself.

  

I cannot do so without a suitable sample model at hand.

  

I hope this helps.

 

Best regards, 

 

Jeremy

 

P.S.

  

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 5

Pravin_Lande
Enthusiast
Enthusiast

@jeremy_tammik 

 

Yes we already tried snooping tool to check how can we get the Part type but from  it we haven't receive any information.

 

Regards,

Pravin

0 Likes
Message 4 of 5

jeremy_tammik
Alumni
Alumni

Very strange.

 

I cannot do anything more than you can, unfortunately.

 

I analysed the two MEP sample projects provided with Revit and looked at various electrical equipment objects:

 

  • Open rme_basic_sample_project.rvt
  • Select Electrical Equipment PP-3A
  • Add-Ins
  • RevitLookup
  • Snoop current selection

 

I see no Mechanical section or Part type entry in its properties:

 

rme_basic_sample_project_electrical_equipment_pp_3a.png

  

Same result looking at the advanced sample project:

 

rme_advanced_sample_project_electrical_equipment_panelboard.png

 

 

Please explore your own model with RevitLookup and let us know the result. Maybe your electrical equipment differs from the sample project content.

  

Best regards,

 

Jeremy

 

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 5 of 5

ricaun
Advisor
Advisor

The Part Type is from the Family not from the FamilyInstance.

 

This code could help!

 

/// <summary>
/// Get PartType from the FamilyInstance
/// </summary>
/// <param name="familyInstance"></param>
/// <returns></returns>
public static PartType GetFamilyPartType(this FamilyInstance familyInstance)
{
    if (familyInstance?.Symbol?.Family is Family family)
    {
        var type = family.get_Parameter(BuiltInParameter.FAMILY_CONTENT_PART_TYPE).AsInteger();
        return (PartType)type;
    }
    return PartType.Undefined;
}

 

This is all the valid PartType on version 2021.

public enum PartType
    {
        Undefined = -1,
        Normal = 0,
        DuctMounted = 1,
        JunctionBox = 2,
        AttachesTo = 3,
        BreaksInto = 4,
        Elbow = 5,
        Tee = 6,
        Transition = 7,
        Cross = 8,
        Cap = 9,
        TapPerpendicular = 10,
        TapAdjustable = 11,
        Offset = 12,
        Union = 13,
        PanelBoard = 14,
        Transformer = 15,
        SwitchBoard = 16,
        OtherPanel = 17,
        EquipmentSwitch = 18,
        Switch = 19,
        ValveBreaksInto = 20,
        SpudPerpendicular = 21,
        SpudAdjustable = 22,
        Damper = 23,
        Wye = 24,
        LateralTee = 25,
        LateralCross = 26,
        Pants = 27,
        MultiPort = 28,
        ValveNormal = 29,
        JunctionBoxTee = 30,
        JunctionBoxCross = 31,
        PipeFlange = 32,
        JunctionBoxElbow = 34,
        ChannelCableTrayElbow = 35,
        ChannelCableTrayVerticalElbow = 36,
        ChannelCableTrayCross = 37,
        ChannelCableTrayTee = 38,
        ChannelCableTrayTransition = 39,
        ChannelCableTrayUnion = 40,
        ChannelCableTrayOffset = 41,
        ChannelCableTrayMultiPort = 42,
        LadderCableTrayElbow = 43,
        LadderCableTrayVerticalElbow = 44,
        LadderCableTrayCross = 45,
        LadderCableTrayTee = 46,
        LadderCableTrayTransition = 47,
        LadderCableTrayUnion = 48,
        LadderCableTrayOffset = 49,
        LadderCableTrayMultiPort = 50,
        InlineSensor = 51,
        Sensor = 52,
        EndCap = 53,
        HandrailBracketHardware = 54,
        PanelBracketHardware = 55,
        TerminationHardware = 56,
        Rails = 57,
        Handrails = 58,
        TopRails = 59,
        PipeMechanicalCoupling = 60
    }

 

PanelBoard is number 14!

 

See yaa!

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils