getpropertyname

Dim lMemberNo As Long
Dim lNodeA As Long
Dim lNodeB As Long

Dim icount As Integer

Dim dCoordX As Double
Dim dCoordY As Double
Dim dCoordZ As Double

Dim SelBeams() As Long

Dim strpropertyname As Variant
Dim isecrefno As String
Dim dWidth As Double
Dim dDepth As Double
Dim dax As Double
Dim Day As Double
Dim daz As Double
Dim dix As Double
Dim diy As Double
Dim diz As Double
Dim dtf As Double
Dim dtw As Double

Set objopenstaad = GetObject(, "StaadPro.OpenSTAAD")

Dim NoOfSelectedBeams As Long
NoOfSelectedBeams = objopenstaad.Geometry.GetNoOfSelectedBeams

If NoOfSelectedBeams = 0 Then

MsgBox "No Columns Selected ! Aborting...."

Exit Sub

End If

ReDim SelBeams(NoOfSelectedBeams - 1) As Long

objopenstaad.Geometry.GetSelectedBeams SelBeams, 1


For icount = 0 To (NoOfSelectedBeams - 1)

lMemberNo = SelBeams(icount)

objopenstaad.Geometry.GetMemberIncidence lMemberNo, lNodeA, lNodeB

Cells(2 + icount, 1).Value = lMemberNo

objopenstaad.Geometry.GetNodeCoordinates lNodeA, dCoordX, dCoordY, dCoordZ

Cells(2 + icount, 2).Value = lNodeA
Cells(2 + icount, 3).Value = dCoordX
Cells(2 + icount, 4).Value = dCoordY
Cells(2 + icount, 5).Value = dCoordZ

objopenstaad.Geometry.GetNodeCoordinates lNodeB, dCoordX, dCoordY, dCoordZ

Cells(2 + icount, 6).Value = lNodeB
Cells(2 + icount, 7).Value = dCoordX
Cells(2 + icount, 8).Value = dCoordY
Cells(2 + icount, 9).Value = dCoordZ

objopenstaad.Property.GetSectionPropertyName strpropertyname, isecrefno

Cells(2 + icount, 10).Value = strpropertyname
Cells(2 + icount, 11).Value = isecrefno

objopenstaad.Property.GetBeamPropertyAll dWidth, dDepth, dax, Day, daz, dix, diy, diz, dtf, dtw

Cells(2 + icount, 12).Value = dWidth
Cells(2 + icount, 13).Value = dDepth
Cells(2 + icount, 14).Value = dax
Cells(2 + icount, 15).Value = Day
Cells(2 + icount, 16).Value = daz
Cells(2 + icount, 17).Value = dix
Cells(2 + icount, 18).Value = diy
Cells(2 + icount, 19).Value = diz
Cells(2 + icount, 20).Value = dtf
Cells(2 + icount, 21).Value = dtw

Next

Set staad = Nothing
End Sub

i wrote this code to get necessary values but the property name and beam property are coming as null value .. please help 

  • Some modification is required in this code

    • For GetSectionPropertyName function isecrefno is the input. You need to specify the value of variable isecrefno. You can also pass array index for function GetSectionPropertyName 
    • The order of the arguments are correct for function GetSectionPropertyName 
    • Input variable (beam number) is missing for function GetBeamPropertyAll 
    • Variable type will be String for variable strpropertyname 
    • Variable type will be Long for variable isecrefno 

    After modification sample code:

    Dim lMemberNo As Long
    Dim lNodeA As Long
    Dim lNodeB As Long

    Dim icount As Integer

    Dim dCoordX As Double
    Dim dCoordY As Double
    Dim dCoordZ As Double

    Dim SelBeams() As Long

    'Dim strpropertyname As Variant
    Dim strpropertyname As String
    'Dim isecrefno As String
    Dim isecrefno As Long
    Dim dWidth As Double
    Dim dDepth As Double
    Dim dax As Double
    Dim Day As Double
    Dim daz As Double
    Dim dix As Double
    Dim diy As Double
    Dim diz As Double
    Dim dtf As Double
    Dim dtw As Double

    Set objOpenStaad = GetObject(, "StaadPro.OpenSTAAD")

    Dim NoOfSelectedBeams As Long
    NoOfSelectedBeams = objOpenStaad.Geometry.GetNoOfSelectedBeams

    If NoOfSelectedBeams = 0 Then

    MsgBox "No Columns Selected ! Aborting...."

    Exit Sub

    End If

    ReDim SelBeams(NoOfSelectedBeams - 1) As Long

    objOpenStaad.Geometry.GetSelectedBeams SelBeams, 1


    For icount = 0 To (NoOfSelectedBeams - 1)

    lMemberNo = SelBeams(icount)

    objOpenStaad.Geometry.GetMemberIncidence lMemberNo, lNodeA, lNodeB

    Cells(2 + icount, 1).Value = lMemberNo

    objOpenStaad.Geometry.GetNodeCoordinates lNodeA, dCoordX, dCoordY, dCoordZ

    Cells(2 + icount, 2).Value = lNodeA
    Cells(2 + icount, 3).Value = dCoordX
    Cells(2 + icount, 4).Value = dCoordY
    Cells(2 + icount, 5).Value = dCoordZ

    objOpenStaad.Geometry.GetNodeCoordinates lNodeB, dCoordX, dCoordY, dCoordZ

    Cells(2 + icount, 6).Value = lNodeB
    Cells(2 + icount, 7).Value = dCoordX
    Cells(2 + icount, 8).Value = dCoordY
    Cells(2 + icount, 9).Value = dCoordZ

    isecrefno = 1
    'objOpenStaad.Property.GetSectionPropertyName strpropertyname, isecrefno
    objOpenStaad.Property.GetSectionPropertyName isecrefno, strpropertyname

    Cells(2 + icount, 10).Value = strpropertyname
    Cells(2 + icount, 11).Value = isecrefno

    objOpenStaad.Property.GetBeamPropertyAll lMemberNo, dWidth, dDepth, dax, Day, daz, dix, diy, diz, dtf, dtw

    Cells(2 + icount, 12).Value = dWidth
    Cells(2 + icount, 13).Value = dDepth
    Cells(2 + icount, 14).Value = dax
    Cells(2 + icount, 15).Value = Day
    Cells(2 + icount, 16).Value = daz
    Cells(2 + icount, 17).Value = dix
    Cells(2 + icount, 18).Value = diy
    Cells(2 + icount, 19).Value = diz
    Cells(2 + icount, 20).Value = dtf
    Cells(2 + icount, 21).Value = dtw

    Next

    Set staad = Nothing

  • i want to get the property name for selected beam 

  • You can use these two functions as per your requirement. Either GetBeamSectionDisplayName or GetBeamSectionName