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!

API - retrieving an array from a Femap command

Status
Not open for further replies.

Tomcat8700

Structural
Jul 31, 2015
13
Hi,I try to write a VB program that checks normals of the surfaces. It's a part of a bigger script. So, I have problems getting the normal vector in VB. The script works in WinWrap but not from VB.

Here is a snippet of the code:


.....................................
Dim s_normal(3) As Double
s_normal = {0, 0, 0}
sel_set.Select(5, True, "Select surfaces")
sel_set.Reset()
.............. Loop here ...............
surf_id = sel_set.Next
surf.Get(surf_id)
rc = surf.normal(0.5, 0.5, s_normal)
<---------- Here I get a typeconflict

Can someone give me a hint please?!

Thanks!


 
Replies continue below

Recommended for you

Thanks for the tipp. I already tried that. Didn't work. See attached image.

eng-tipp_-_Microsoft_Visual_Basic_2010_Express_pri9zn.png
 
Seif's answer is correct: if you're coding in .NET you need
Dim s_normal as Object

Don't dimension it.
Usually in .NET I need to add "s_normal = Nothing" in loops, prior to the function call, because once the method has been called once the object has a dimension.

Example (in Visual Studio):

Sub Main()
Dim App As femap.model
App = GetObject(, "femap.model")

Dim nSet As femap.Set
nSet = App.feSet

Dim v1 As Object

nSet.AddAll(femap.zDataType.FT_NODE)
While nSet.Next
v1 = Nothing 'won't work without this
App.feCoordOnNode(nSet.CurrentID, v1)
App.feAppMessage(femap.zMessageColor.FCM_NORMAL, CStr(v1(0)))
End While
End Sub
 
Hey Guys, you're great. Thanks alot! It works.
It was the "=Nothing" in the Loop that was missing.

Thanks again!

Greetings from Germany!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor