Sie sind auf Seite 1von 3

'API Written by Jared Ellefson @ 541-760-2955

'Jared.Ellefson@PredictiveEngineering.com
'Predictive Engineering 2006
'Predictive Engineering Assumes No Responsibility For Results Obtained From API
'Written for FEMAP 9.2
'This API checks all selected elements for a specified material angle
'if elements are found to have no material angle specified, then a group
'is created and the group is populated with the elements
Sub Main
'-------------------------------------------------------------------------------
-
'First we'll connect to the existing FEMAP session
Dim femap As femap.model
Set femap = GetObject(,"femap.model")
Dim el As Object
Set el = femap.feElem
Dim elSet As Object
Set elSet = femap.feSet
Dim angleSet As Object
Set angleSet = femap.feSet
Dim angleGroup As Object
Set angleGroup = femap.feGroup
Dim elCurrent As Long
Dim elLast As Long
Dim rc As Long
Dim GroupID As Long
Dim SetID As Long
Dim x As Long
x = 0
Dim messageString As String
Dim elCount As Long
Dim flag As Boolean
'-----------------------------------------------------------------------
---------
'Here we're prompting the user to enter which elements they're intereste
d in
rc = elSet.Select(8,True,"Select the Elements Of Interest")
elCount = elSet.count
If elCount = 0 Then
GoTo FAIL
End If
elLast = elSet.Last
rc = elSet.Reset
'-----------------------------------------------------------------------
---------
'Now we'll cycle through the selected elements and check to see if they
are laminates. If they
'are then we'll check to see if the material angle has been specified. I
f it hasn't then the element is added to a set
'called angleSet
Do
elCurrent = elSet.Next
rc = el.Get(elCurrent)
If el.type = 21 Then
flag = True
ElseIf el.type = 22 Then
flag = True
Else
flag = False
End If
If flag = True Then
If el.MaterialAngleFlag = False Then
rc = angleSet.Add(elCurrent)
x = x + 1
End If
End If
Loop Until elCurrent = elLast
'-----------------------------------------------------------------------
---------
'A new group is then created called "Elements w/ no angle specified"
messageString = Str$(x) + " elements were found to have no orientation s
pecified"
femap.feAppMessage(0,messageString)
If x > 0 Then
SetID = angleSet.ID
angleGroup.title = "Elements w/ no angle specified"
GroupID = femap.Info_NextID(24)
rc = angleGroup.Put(GroupID)
If rc Then
messageString = "Group #" + Str$(GroupID) + " has been c
reated"
femap.feAppMessage(0,messageString)
End If
rc = angleGroup.Get(GroupID)
'---------------------------------------------------------------
-----------------
'All the elements which have been previously added to angleSet a
re then added to the new group
rc = angleGroup.SetAddOpt(8,SetID,1)
rc = angleGroup.Put(GroupID)
If rc Then
messageString = Str$(x) + " elements were added to Group
#" + Str$(GroupID)
femap.feAppMessage(0,messageString)
End If
End If

FAIL:
End Sub

Das könnte Ihnen auch gefallen