Hi
Could anyone help me on this one?
Openstaad macro in excel.
Im trying to get the list of profile used.
Thanks.
I successfully run the macro. If ever anyone would want to use.
You can use this code
'Get list of profiles used profiles = objOpenSTAAD.Property.GetSectionPropertyCount() Cells(4, 2).Value = profiles Dim refNo As Long Dim profname As String For i = 0 To profiles refNo = i objOpenSTAAD.Property.GetSectionPropertyName refNo, profname Cells(i + 5, 2).Value = profname Next i Cells(1, 1).Select
Answer Verified By: Dave Jason Narca
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 the necessary values but the property name followed by beam property coming null.
Please refer to the below link
getpropertyname