OpenSTAAD V8i

6.3 Autodesk AutoCAD® Macro

Writing the Member Section Forces at any Distance Along a Member in AutoCAD 2000 or higher.

OpenSTAAD can also be used to integrate pre or post-processing data with AutoCAD 2000 or higher. AutoCAD 2000 supports VBA macros with its own exposed set of functions. This example automatically calculates the section forces at any distance along a member from a  STAAD file and plots the results in a table as a separate layer. A dialog box was created in AutoCAD using AutoCAD VBA forms. The input box will prompt for the STAAD file name, the member number, the load case and the point along the member (expressed as  a fraction of the length) where the section forces are to be determined. The macro returns the section forces (by using OpenSTAAD to read STAAD's database) and plots them in a pre-defined table in the DXF file (STDandAcad.dxf).

  1. Open the file …\SProV8i\OpenSTAAD\STDandACAD.dwg.

    AutoCAD will warn of macros present in the file.

    It is always recommended to do a virus scan on any macro before opening it - including this one!

  2. Click Enable Macros.

  3. To run the macro, either:

    select the RUN VBA Macro tool on the Manage tab (AutoCAD 2009 and higher).

    Microsoft Visual Basic for Applications Module is not installed with recent versions of AutoCAD but can be downloaded from the Autodesk website. Refer to the help included with AutoCAD for more information.

    or

    select Tools > Macro > Macros (previous versions of AutoCAD or when AutoCAD 2009 is in AutoCAD Classic mode).

    or

    press ALT+F8.

    The Macro dialog opens.

    Macro dialog in Autodesk AutoCAD 2011

  4. Select the macro named STAADSectionForces and click Run.

    The STAAD.Pro Section Forces dialog opens. A warning also opens informing you that the STAAD File name must be specified.

  5. Enter a valid filename, including complete file path, for the current input file open in STAAD.Pro.

    The Member Number and Load Case drop-down lists are populated with data from the selected model.

  6. Select a Member Number and Load Case and specify a Fraction Along Beam.

  7. Click OK.

    The table is updated

  8. (Optional) To populate the table with different results, first clear all contents on the STAAD Results layer in the AutoCAD drawing. Then repeat steps 4 through 7.

For more information on how to call AutoCAD commands in VBA, please refer to the AutoCAD VBA Help provided with AutoCAD.