Showing results for 
Search instead for 
Did you mean: 

API problem with putscalaratbeam


I am trying to use the entity object putscalaratbeam. I do not know but the macro (vb excel) works without errors but I do not get any output results. I tried several things and look for something in internet but no luck.  Maybe someone can find the error

To make it simple I prepare an example with one element number 37 and loading the end A and B with values from user defined array. Maybe the foutput.put is wrong. ? 


Sub MAIN()

Dim femap As Object
Set femap = GetObject(, "femap.model")
Dim feOutputSet As Object
Set feOutputSet = femap.feOutputSet

Dim foutput As Object
Set foutput = femap.feoutput

Dim aa(6) As Double
aa(0) = 10
aa(1) = 20
aa(2) = 10
aa(3) = 20
aa(4) = 10
aa(5) = 20
Dim elem(1) As Double
elem(0) = 37

setID = 3
feOutputSet.Title = "aaa"
feOutputSet.Put (setID)
rc = foutput.InitScalarAtBeam(setID, 9000001, 9000002, "", 2, 4, False, True)
rc = foutput.PutScalarAtBeam(1, elem, aa(0), aa(1))
rc = foutput.Put(-1)
femap.feViewRegenerate (0)

End Sub


Re: API problem with putscalaratbeam




Use your return code (i.e. the fact that you begin method calls by "rc = ") to debug: your PutScalarAtBeam line returns 8, which means "FE_BAD_TYPE" (cf API Help 1 > Global Constants)


This comes from "Dim elem(1) As Double" which should be "Dim elem(1) As Long"



Re: API problem with putscalaratbeam

Dear astrium_tls

Thanks for the quick reply. It works!!