API - retrieving an array from a Femap command
API - retrieving an array from a Femap command
(OP)
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!
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!





RE: API - retrieving an array from a Femap command
What about declaring s_normal as variant?
Seif Eddine Naffoussi, Stress Engineer
www.Innovamech.com
33650 Martillac û France
RE: API - retrieving an array from a Femap command
RE: API - retrieving an array from a Femap command
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
RE: API - retrieving an array from a Femap command
It was the "=Nothing" in the Loop that was missing.
Thanks again!
Greetings from Germany!