How can I create a comment via the COM interface?

Answer

When using the COM interface (RF‑COM or RS‑COM), you can create a comment by using the guide object interface IGuideObjects. The following is an example program that creates a comment:

Sub test_comment()

'   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 iModelData As RFEM5.IModelData2
    Set iModelData = iModel.GetModelData
    
    Dim iGuiObj As RFEM5.IGuideObjects
    Set iGuiObj = iModel.GetGuideObjects
    
    Dim comm As RFEM5.Comment
    
    '   set frame type
    comm.Frame = CircularFrameType
    
    '   set reference object type
    comm.ObjectType = GeneralObjectType
    comm.ObjectNo = 1
    
    '   set point if GeneralObjectType is choosen
    comm.Point.X = 2
    comm.Point.Y = 4
    comm.Point.Z = 6
    
    '   set offset from reference object
    comm.Offset.X = 0.5
    comm.Offset.Y = 1
    comm.Offset.Z = 1.5
    comm.Rotation = 1
    
    '   set text of comment
    comm.Text = "testcomment"
    
    '   transfer object to program
    iGuiObj.PrepareModification
    iGuiObj.SetComment comm
    iGuiObj.FinishModification
    
e:  If Err.Number <> 0 Then MsgBox Err.description, , Err.Source
    
    Set iModelData = Nothing
    iModel.GetApplication.UnlockLicense
    Set iModel = Nothing

End Sub

The selection of the reference or the element to which the comment is refferred to is defined by the type (ObjectType) first. Here, it is possible to select, for example, a member, a node or any point in space. Next, the number of the reference object is specified via ObjectNo (for example, Member 1). If you have selected a free point, it is set by Point.
Finally, you can specify an offset which results from the reference object.

Keywords

COM Comment Guide objects GuideObjects

Downloads

Links

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
RSTAB Main Program
RSTAB 8.xx

Main Program

The structural engineering software for design of frame, beam and truss structures, performing linear and nonlinear calculations of internal forces, deformations, and support reactions

Price of First License
2,550.00 USD