Sometimes as a programmer, you want to know the minimum set of instructions/ commands needed to enable some functionality. Well I’ve gone ahead and assembled that for saving custom output data to your Femap model.
Here’s a snippet of code that will place custom data into your model. Note that it is not complete, some manual work needs to be done around the “loop condition” comment. But in general, this can be used as a template to create 1 output set and data for two output vectors in Femap.
Sub WRITE_CUSTOM_OS_OV()
‘ E. GustafsonDim app As femap.Model
Set app = GetObject(, “femap.model”)Dim os As femap.OutputSet
Set os = app.feOutputSetWith os
.Title = “New Output Set”
.ID = os.NextEmptyID
.program = FAP_UNKNOWN
.analysis = FAT_UNKNOWN
.Value = 0#
.Notes = “Data manually added”
.Put (os.ID)
End With‘Output Vector 1
Dim fOV1 As femap.output
Set fOV1 = app.feOutput
rc = fOV1.InitScalarAtElem(os.ID, 9000000, “Custom OV 1”, FOT_ANY, True)‘Output Vector 2
Dim fOV2 As femap.output
Set fOV2 = app.feOutput
rc = fOV2.InitScalarAtElem(os.ID, 9000001, “Custom OV 2”, FOT_ANY, True)
‘Loop condition
fOV1.Value(currELEMID) = ‘Value
fOV2.Value(currELEMID) = ‘Value
‘Loop over every elementrc = fOV1.Put(9000000)
rc = fOV2.Put(9000001)rc = app.feappmessage(2, “Write operation complete…”)
rc = app.feFileRebuild(False, False)End Sub
Update 5-13-18: When you copy and paste the above snippet, the quote symbols may not paste in correctly, perhaps due to some web text encoding issue. If this is the case, just do a replace all in your text editor.
Hope this helps!