Dim lMemberNo As LongDim lNodeA As LongDim lNodeB As Long
Dim icount As Integer
Dim dCoordX As DoubleDim dCoordY As DoubleDim dCoordZ As Double
Dim SelBeams() As Long
Dim strpropertyname As VariantDim isecrefno As StringDim dWidth As DoubleDim dDepth As DoubleDim dax As DoubleDim Day As DoubleDim daz As DoubleDim dix As DoubleDim diy As DoubleDim diz As DoubleDim dtf As DoubleDim dtw As Double
Set objopenstaad = GetObject(, "StaadPro.OpenSTAAD")
Dim NoOfSelectedBeams As LongNoOfSelectedBeams = 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 = NothingEnd 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
After modification sample code:
'Dim strpropertyname As VariantDim strpropertyname As String'Dim isecrefno As StringDim isecrefno As LongDim dWidth As DoubleDim dDepth As DoubleDim dax As DoubleDim Day As DoubleDim daz As DoubleDim dix As DoubleDim diy As DoubleDim diz As DoubleDim dtf As DoubleDim dtw As Double
Set objOpenStaad = GetObject(, "StaadPro.OpenSTAAD")
Dim NoOfSelectedBeams As LongNoOfSelectedBeams = objOpenStaad.Geometry.GetNoOfSelectedBeams
objOpenStaad.Geometry.GetSelectedBeams SelBeams, 1
lMemberNo = SelBeams(icount)
objOpenStaad.Geometry.GetMemberIncidence lMemberNo, lNodeA, lNodeB
objOpenStaad.Geometry.GetNodeCoordinates lNodeA, dCoordX, dCoordY, dCoordZ
Cells(2 + icount, 2).Value = lNodeACells(2 + icount, 3).Value = dCoordXCells(2 + icount, 4).Value = dCoordYCells(2 + icount, 5).Value = dCoordZ
objOpenStaad.Geometry.GetNodeCoordinates lNodeB, dCoordX, dCoordY, dCoordZ
Cells(2 + icount, 6).Value = lNodeBCells(2 + icount, 7).Value = dCoordXCells(2 + icount, 8).Value = dCoordYCells(2 + icount, 9).Value = dCoordZ
isecrefno = 1'objOpenStaad.Property.GetSectionPropertyName strpropertyname, isecrefnoobjOpenStaad.Property.GetSectionPropertyName isecrefno, strpropertyname
Cells(2 + icount, 10).Value = strpropertynameCells(2 + icount, 11).Value = isecrefno
objOpenStaad.Property.GetBeamPropertyAll lMemberNo, dWidth, dDepth, dax, Day, daz, dix, diy, diz, dtf, dtw
Cells(2 + icount, 12).Value = dWidthCells(2 + icount, 13).Value = dDepthCells(2 + icount, 14).Value = daxCells(2 + icount, 15).Value = DayCells(2 + icount, 16).Value = dazCells(2 + icount, 17).Value = dixCells(2 + icount, 18).Value = diyCells(2 + icount, 19).Value = dizCells(2 + icount, 20).Value = dtfCells(2 + icount, 21).Value = dtw
Set staad = Nothing
thank you very much
i want to get the property name for selected beam
You can use these two functions as per your requirement. Either GetBeamSectionDisplayName or GetBeamSectionName
am getting error