Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VM Stress At Element

Status
Not open for further replies.

rbas85

Structural
Sep 23, 2019
7
0
0
BR
I'm trying to get the Von Mises Stress of elements 1 to 50, but my API code is not working. I get the error "run-time error 13 – Type mismatch". Follow a code that I copied from Iberisa to get what I want:
Sub Main()
Dim App As femap.Model
Set App = GetObject(, "femap.model")
Dim fOS As femap.OutputSet
Dim fOV As femap.Output
Dim fsElem As femap.Set
Dim nArr As Long
Dim i As Long
Dim values As Variant
Dim ents As Variant
Dim rc As Long
Set fOS = App.feOutputSet
Set fsElem = App.feSet
fOS.Get (1)
Set fOV = fOS.Vector(7033)
rc = fsElem.AddRange(1, 50, 1)
rc = fsElem.GetArray(nArr, ents)
rc = fOV.GetScalarAtElemSet(fsElem.ID, values)
For i = 0 To nArr - 1 Step 1
rc = App.feAppMessage(FCM_NORMAL, "Element ID: " + Str$(ents(i)) + _
", Top VM Stress: " + Str$(values(i)))
Next
End Sub
The line with problem is rc = App.feAppMessage(FCM_NORMAL, "Element ID: " + Str$(ents(i)) + ", Top VM Stress: " + Str$(values(i))). Apparently, the variable "values" is not declared correctly, but I don't know what to do.

 
Replies continue below

Recommended for you

I could list those values, but I don't know how to do it, since I'm having problems with the declaration of the variable "values".
 
rbas85, your code looks correct and should work just if you are using MS VBA (Excel) as an IDE and if you are sure that you have calculated results vector 7033 in the OutputSet ID #1, for elements IDs 1-50.
For sure it will call an error regarding variable types if you use pure vb.net in MS Visual Studio for example.
 
Status
Not open for further replies.
Back
Top