Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-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
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

why wouldn't you "just" List/output ?

another day in paradise, or is paradise one day closer ?
 
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".
 
I mean instead of API, use the menu system.

another day in paradise, or is paradise one day closer ?
 
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.

Part and Inventory Search

Sponsor