Small programs to drive .COM server functions
notwendige Expertise
Create small .com server templates used to drive a specific application exe. Example of a type of project is in the attached document. (Last pages of the attachment) Other types similar to this example will be developed in the same method.
Either is VB (MS Visual Studio 2008) or C++.NET are the two example codes, creating the same example project.
Some knowledge of CAD software is preferred, some engineering understanding would be helpful.
If it works, here is the exact code for the example in VB:
Example #3: Line and load definition (Visual Basic)
This example is written in VisualBasic (using Microsoft VisualStudio 2008). It defines a line and place distributed loads
on it. The entire vb file is listed. The main part is executed when the Start button is clicked.
Imports System.Runtime.InteropServices ' we need that for COM object releasing
Public Class frmMain
Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btnStart.Click
On Error GoTo ErrHandler
btnStart.Enabled = False
First the COM server is created and the AxisModel variable is set to the current AxisVM model.
' create AxisVM COM server: always create 'AxisVMApplication' first!
Dim AxisApp As New AxisVM.AxisVMApplication
' check for Loaded state
While AxisApp.Loaded = False
' let other threads do their work without 100% CPU usage
System.Threading.Thread.Sleep(1)
End While
' when com client releases AxisVM COM Server's last object com server will terminate
immediately without asking to save current model
' if AskCloseOnLastReleased set to TRUE then AxisVM will ask the user whether to close
AxisVM or not
AxisApp.AskCloseOnLastReleased = True
' current AxisVM supports only one model to be loaded -> get first model
Dim AxisModels = AxisApp.Models
Dim AxisModel = AxisModels.Item(1)
Two nodes are created
' //------ GEOMETRY BEGIN ------\\
' get the Nodes interface of current model
Dim AxisNodes = AxisModel.Nodes
' add two nodes
Dim nNodeId1 = AxisNodes.Add(1.0, 1.0, 1.0)
If nNodeId1 < 1 Then
MsgBox("Error adding node #1. Error code: " + Str(nNodeId1), MsgBoxStyle.Critical,
"Error")
End If
Dim nNodeId2 = AxisNodes.Add(10.0, 10.0, 1.0)
If nNodeId2 < 1 Then
MsgBox("Error adding node #2. Error code: " + Str(nNodeId2), MsgBoxStyle.Critical,
"Error")
End If
The two nodes are connected with a straight line.
Dim rLineGeomData As AxisVM.RLineGeomData
' get the Lines interface of current model
Dim AxisLines = AxisModel.Lines
' connect two nodes with a straight line (no need to fill the RLineGeomData because it has
only circle or ellipse related data)
Dim nLineId = AxisLines.Add(nNodeId1, nNodeId2, AxisVM.ELineGeomType.lgtStraightLine,
rLineGeomData)
If nLineId < 1 Then
MsgBox("Error adding line. Error code: " + Str(nLineId), MsgBoxStyle.Critical, "Error")
End If
' //------ GEOMETRY END ------\\
The line is defined as a beam element.
' //------ ELEMENTS BEGIN ------\\
' need crosssection(s) and material to define a line element (eg. beam







