Cancel
Showing results for 
Search instead for 
Did you mean: 

Femap API Help - Create Geometry

Valued Contributor
Valued Contributor

Hi,

 

I am trying to create an API that asks the user for two points and creates a line:

 

So far my code is as follows but I am getting errors. (I have not made the user input part of it yet).

 

The HTML Clipboard

Sub Main

'Creating a Femap Application Object
'The create object has been used as we want a new Femap session - Refer to 3.1.2 Femap_API_Manual
    Dim App As Object
    Set App = CreateObject("femap.model")

'Create Object does not show the Femap window. To show the Femap window we have to make it visible
    App.feAppVisible (True)

    Dim ptID1 As Double (3)
    Dim ptID2 As Double (3)

    ptID1(0) = 1.0
    ptID1(1) = 1.0
    ptID1(2) = 1.0

    ptID2(0) = 2.0
    ptID2(1) = 2.0
    ptID2(2) = 2.0

Dim Diameter_Curve As femap.Curve

Set Diameter_Curve = App.feCurve

rc =Diameter_Curve.feLinePoints(True, ptID1, ptID2 )

1 REPLY

Re: Femap API Help - Create Geometry

Siemens Phenom Siemens Phenom
Siemens Phenom

You have a number of syntax errors.  I have not tried to reproduce your code outside of the FEMAP environment, but running from the API Programming window, it should look something like what I show below.  A couple of things to note...

 

In Basic, the dimensioning for arrays specifies the highest index. Since you want 3 entries, you dimension to 2 (i.e. indices 0,1,2)

 

Also, all of the methods described in Chapter 3 of the API manual...like feLInePoints( )... are accessed thru the main application object, not the entity objects. There was no need to create a curve object.

 

Finally, you were missing a parameter on feLinePoints( )

 

The HTML Clipboard

Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Dim ptID1(2) As Double
    Dim ptID2(2) As Double

    ptID1(0) = 1.0
    ptID1(1) = 1.0
    ptID1(2) = 1.0

    ptID2(0) = 2.0
    ptID2(1) = 2.0
    ptID2(2) = 2.0

     App.feLinePoints(True, ptID1, ptID2, True )
End Sub