×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

API - retrieving an array from a Femap command

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!


RE: API - retrieving an array from a Femap command

Hi,

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

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

RE: API - retrieving an array from a Femap command

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

RE: API - retrieving an array from a Femap command

(OP)
Hey Guys, you're great. Thanks alot! It works.
It was the "=Nothing" in the Loop that was missing.

Thanks again!

Greetings from Germany!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources