Anuncios
Welcome to the Revit Ideas Board! Before posting, please read the helpful tips here. Thank you for your Ideas!
cancelar
Mostrando los resultados de 
Mostrar  solo  | Buscar en lugar de 
Quiere decir: 

Function for getting the discipline of a ParameterType

Function for getting the discipline of a ParameterType

Add function to return discipline for a ParameterType similar to UI add parameter dialogue.

 

When all ParameterTypes are listed together many have the same name returned by LabelUtils.GetLabelFor(ParameterType) e.g.

 

HVACDensity = Density

PipingDensity = Density

HVACTemperature = Temperature

PipingTemperature = Temperature

ElectricalTemperature = Temperature

 

The above parameters will only be distinguishable in a custom UI if they are able to be divided into discipline.

 

Function similar to below should be available within API and maintained for new parameter types added.

 

 Public Enum ParameterTypeDiscipline As Byte
        Undefined = 0
        Common = 1
        Structural = 2
        HVAC = 3
        Electrical = 4
        Piping = 5
        Energy = 6
    End Enum
    Public Shared Function GetParameterTypeDiscipline(Val As ParameterType) As ParameterTypeDiscipline
        Dim V As Byte = CByte(Val)
        Dim D1 As Byte() = New Byte(14) {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 19, 20, 159, 172, 222}
        Dim D2 As Byte() = New Byte(40) {11, 12, 13, 14, 145, 146, 147, 148, 150, 151, 152, 153, _
                                         154, 184, 185, 192, 193, 194, 195, 196, 197, 198, 199, 200, _
                                         201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 223}
        Dim D3 As Byte() = New Byte(28) {107, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 125, _
                                   156, 158, 160, 161, 162, 163, 164, 165, 166, 167, 168, 170, 179, 180, 187, 188, 227}
        Dim D4 As Byte() = New Byte(21) {15, 18, 119, 120, 121, 122, 123, 124, 134, 135, 169, 173, _
                                         174, 175, 177, 178, 181, 182, 183, 186, 221, 229}
        Dim D5 As Byte() = New Byte(16) {16, 136, 137, 138, 139, 140, 141, 142, 143, 144, 155, 171, 189, 224, 225, 226, 228}
        Dim D6 As Byte() = New Byte(7) {108, 157, 190, 191, 217, 218, 219, 220}

        If D1.Contains(V) Then
            Return ParameterTypeDiscipline.Common
        ElseIf D2.Contains(V) Then
            Return ParameterTypeDiscipline.Structural
        ElseIf D3.Contains(V) Then
            Return ParameterTypeDiscipline.HVAC
        ElseIf D4.Contains(V) Then
            Return ParameterTypeDiscipline.Electrical
        ElseIf D5.Contains(V) Then
            Return ParameterTypeDiscipline.Piping
        ElseIf D6.Contains(V) Then
            Return ParameterTypeDiscipline.Energy
        Else
            Return ParameterTypeDiscipline.Undefined
        End If
    End Function

 

1 Comentario
RPTHOMAS108
Mentor

To clarify idea further:

 

There is an existing  API enumeration called UnitGroup this can be used as return instead of ParameterTypeDiscipline above.

 

There is a function UnitUtils.GetUnitGroup(UnitType) but this takes a value of UnitType which is a separate enumeration from ParameterType. Not all ParameterType values are represented in the UnitType enumeration so a direct or indirect use of UnitUtils.GetUnitGroup(UnitType) to get the UnitGroup of a ParameterType does not seem possible. 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Enviar idea  

Autodesk Design & Make Report