New

27 April 2020

004409

Thomas Günthel

Results

RFEM

RF-COM

How can I create a section via the COM interface?

Answer

In principle, a section is an element, such as a member, and is also created in the same way. First, the interface to the objects is required. For a member, this would be IModelData, and for sections, it would be ISections. This interface can be found in IModel3:

Sub test_section()
'   get interface from the opened model and lock the licence/program
    Dim iModel As RFEM5.IModel3
    Set iModel = GetObject(, "RFEM5.Model")
    iModel.GetApplication.LockLicense
    
On Error GoTo E
    
    Dim iSecs As RFEM5.ISections
    Set iSecs = iModel.GetSections()

All sections created previously are deleted first, and then two new sections are created.
The first section should be a solid section with a visible sectional area (see Figure 01). The data are entered in a similar way as in RFEM. As a type, "SectionOnSectionalArea" is selected, the corner points of the section are set by using "EdgePoint," and a "Vector" defines the direction of the section:

   '   first delete all sections
    iSecs.PrepareModification
    iSecs.DeleteObjects ("All")
    iSecs.FinishModification
    
    '   set section on solid
    Dim sec As RFEM5.Section
    sec.EdgePointA.X = 2
    sec.EdgePointA.Y = 5
    sec.EdgePointA.Z = 0
    sec.EdgePointB.X = 2
    sec.EdgePointB.Y = 8
    sec.EdgePointB.Z = 0
    
    sec.no = 1
    sec.Name = "solid section"
    sec.Plane = GlobalPlaneInPositiveX
    sec.ShowValuesInIsolines = False
    sec.Type = SectionOnSolidSectionLine
    sec.ObjectList = "1"
    
    iSecs.PrepareModification
    iSecs.SetSection sec
    iSecs.FinishModification

As already known from other elements, the new section is finally transferred in a Prepare-/FinishModification block. As the second section, a surface section is to be created (see Figure 02). For this, it is necessary to use the "SectionViaSurfacePlane" type. In addition to the vector of the section direction, you have to select the display plane of the results for the surface section. In the following example, the xy plane is selected by setting "GlobalPlaneInPositiveX."

'   set section on surface
    sec.EdgePointA.X = 2
    sec.EdgePointA.Y = 0
    sec.EdgePointA.Z = 0
    sec.EdgePointB.X = 2
    sec.EdgePointB.Y = 3
    sec.EdgePointB.Z = 0
    
    sec.no = 2
    sec.Name = "surface section"
    sec.Plane = GlobalPlaneInPositiveX
    
    sec.ShowValuesInIsolines = True
    sec.Type = SectionViaSurfacePlane
    sec.ObjectList = "1"
    
    sec.Vector.X = 0
    sec.Vector.Y = 0
    sec.Vector.Z = 1
    
    iSecs.PrepareModification
    iSecs.SetSection sec
    iSecs.FinishModification

It is also possible to get the results of a section by using the separate method "GetResultsInSection" of the "IResults2" interface. In the following, the shear forces on the surface section are obtained. The distribution of the internal forces is set to "Continuous within Surfaces" by means of "ContinuousDistributionWithinObjects":

 '   get results
    Dim iCalc As ICalculation2
    Set iCalc = iModel.GetCalculation
    
    Dim iRes As IResults2
    Set iRes = iCalc.GetResultsInFeNodes(LoadCaseType, 1)
    
    Dim secRes() As RFEM5.SectionResult
    secRes = iRes.GetResultsInSection(2, AtNo,
      ShearForceVy,ContinuousDistributionWithinObjects, False)

Under Downloads, you can find the Excel macro and the test file to comprehend the program.

Keywords

Section COM ISection

Downloads

Contact us

Did you find your question?
If not, contact us via our free e-mail, chat, or forum support, or send us your question via the online form.

+49 9673 9203 0

info@dlubal.com

RFEM Main Program
RFEM 5.xx

Main Program

Structural engineering software for finite element analysis (FEA) of planar and spatial structural systems consisting of plates, walls, shells, members (beams), solids and contact elements

Price of First License
3,540.00 USD
RFEM Other
RF-COM 5.xx

Add-on Module

Programmable interface (API) based on the COM technology

Price of First License
580.00 USD