II agree that there are indeed a number of OpenSTAAD functions that we could look at to make the job a little easier, but I have created an incomplete sample macro which is can be included in STAAD.Pro and creates a STAAD.Pro table which can be copied from using copy and paste, but hopefully illustrates the principles. (Profiles, numbers and overall length are correct, but the total weight is only the volume and needs to be multiplied by the density).
'/*--------------------------------------------------------------------------------------+'|'| $Copyright: (c) 2023 Bentley Systems, Incorporated. All rights reserved. $'|'| Permission To use and distribute this software and its documentation'| for any purpose, without fee, and without a written agreement,'| is hereby granted, provided that the above copyright notice,'| this paragraph and the following two paragraphs appear in all copies,'| and distributions.'|'| IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,'| INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST'| PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,'| EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.'|'| THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT'| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A'| PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF'| ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". THE AUTHOR HAS NO OBLIGATION'| To PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, Or MODIFICATIONS.'|'+--------------------------------------------------------------------------------------*/
'DESCRIPTION : Sample macro to create a table of envelopes of displacements on node loads
' 'Developed By: Carlos Aguera'v1.0 - Sep 2023
OptionExplicit
Sub Main() Dim staadObj AsObjectSet staadObj=GetObject(,"StaadPro.OpenSTAAD") Dim stdFile AsStringDim nResult AsIntegerDim nMembers AsLongDim nMember() AsLongDim nRows AsInteger, nCols AsLongDim rptno AsLong, tblEnv AsLong
Dim i AsLongDim PropTable() AsString
staadObj.GetSTAADFile(stdFile, "TRUE")
If stdFile<>""Then 'Get member data nMembers = staadObj.geometry.GetMemberCount() ReDim nMember(nMembers) staadObj.geometry.GetBeamList(nMember())
'Get unit info Select staad.GetBaseUnit Case 1 'BaseUnit = "Base Unit is English" LenUnit = "feet" DispUnit="in" RotUnit="rad" WeightUnit="ton" Case 2 'BaseUnit = "Base Unit is Metric" LenUnit = "met" DispUnit="mm" RotUnit="rad" WeightUnit= "tonne" CaseElse 'BaseUnit = "Base Unit is Undefined" EndSelect
Yeah, that is an idea so I gave it a try. I had a few issues. When you say "create a table", I can think of a few ways to do that. Yes, I could write a VBA routine in Excel and populate it with the info but I really wanted something I could run within STAAD without having to open Excel. I could also write it to a file then open the file. Still, a little clunky. I could write it to the immediate window but that's not very user friendly. I did try writing it to the MsgBox. It worked but I really want something I can copy and paste if I need to. Then I tried writing it to a textbox in a user form. I liked this except couldn't figure out how to get the program to write the text in instead of the user so I used a text type instead of textbox. That worked but I couldn't copy and paste. I know I could do this in true Visual Basic. I don't know if it's just a limitation of this Visual Basic like program (WinWrap Basic) that comes with STAAD or I need some training.
The other issue I found is that the only function I found to get the property is "GetMemberDesignSectionName". That seems a bit dangerous as really want the analysis member section name. I couldn't find a function for that. I assume as long as I'm not having the program select member sizes it should be okay, but it would be nice not to have worry about that.
I'm giving you this rather long winded account for two reasons. One, your reply seems to hint that this has a rather trivial solution. To someone who is not a full-time programmer like me, it's not. The other is to elicit some help from anyone that may know of a good solution to this or just point me to the place that would explain writing text or a table in WinWrap Basic.
Thanks Carlos. Very helpful. I didn't know about the Table functions.
II agree that there are indeed a number of OpenSTAAD functions that we could look at to make the job a little easier, but I have created an incomplete sample macro which is can be included in STAAD.Pro and creates a STAAD.Pro table which can be copied from using copy and paste, but hopefully illustrates the principles. (Profiles, numbers and overall length are correct, but the total weight is only the volume and needs to be multiplied by the density).
Yeah, that is an idea so I gave it a try. I had a few issues. When you say "create a table", I can think of a few ways to do that. Yes, I could write a VBA routine in Excel and populate it with the info but I really wanted something I could run within STAAD without having to open Excel. I could also write it to a file then open the file. Still, a little clunky. I could write it to the immediate window but that's not very user friendly. I did try writing it to the MsgBox. It worked but I really want something I can copy and paste if I need to. Then I tried writing it to a textbox in a user form. I liked this except couldn't figure out how to get the program to write the text in instead of the user so I used a text type instead of textbox. That worked but I couldn't copy and paste. I know I could do this in true Visual Basic. I don't know if it's just a limitation of this Visual Basic like program (WinWrap Basic) that comes with STAAD or I need some training.
The other issue I found is that the only function I found to get the property is "GetMemberDesignSectionName". That seems a bit dangerous as really want the analysis member section name. I couldn't find a function for that. I assume as long as I'm not having the program select member sizes it should be okay, but it would be nice not to have worry about that.
I'm giving you this rather long winded account for two reasons. One, your reply seems to hint that this has a rather trivial solution. To someone who is not a full-time programmer like me, it's not. The other is to elicit some help from anyone that may know of a good solution to this or just point me to the place that would explain writing text or a table in WinWrap Basic.
Thank you for posting this idea. I would say this would seem ideally suited to an OpenSTAAD macro which creates a table and reports the following
1) Profile name
2) Number of objects
3) Total length
4) Total Weight
This would not require any analysis to be performed. Would that not work for you?