Highlighted

API properties NasNXStratTimeSteps and NasNXStratSkipFactor don't work

Experimenter
Experimenter
Hi there, I'm running FEMAP 11.4.1 and I'm setting up a model with API commands. It concerns a non-linear model. The following code is a selection of the model where the analysis setup is configured. Dim femap As Object Set femap = GetObject(, "femap.model") Dim aset As Object Set aset = femap.feAnalysisSet rc = aset.Get(1) aset.NasNXStratTimeSteps = 100 aset.NasNXStratTimeIncrement = 0.01 aset.NasNXStratSkipFactor = 1 rc = aset.Put(1) After the run only the Time incrment is set. The TimeStpes and SkipFactor (requesting the output every Nth step) are not set. It seems that these two commands are not working (bug?). Or do I miss something? How can I automate the analysis settings 'Number of Steps' and 'Output every Nth step'? Ssee also attached jpg file?
2 REPLIES 2

Re: API properties NasNXStratTimeSteps and NasNXStratSkipFactor don't work

Siemens Phenom Siemens Phenom
Siemens Phenom

If you take a look at the documentation, you'll see these parameters are looking for an array.  Also, you can try to test what the API is looking for by using the Watch window and see what a working object returns:

 

nonlinear_amanger.png

 

 

Therefore, your code should look something like this:


Sub Main
    Dim App As femap.model
    Set App = feFemap()

    Dim aset As Object
    Set aset = App.feAnalysisSet

    rc = aset.Get(1)

    Dim timeSteps(9) As Long
        timeSteps(0) = 100
    Dim timeIncrement(9) As Double
        timeIncrement(0) = 0.01
    Dim stratSkipFactor(9) As Long
        stratSkipFactor(0) = 1

    For i = 1 To 9
        timeSteps(i) = 0
        timeIncrement(i) = 0.0
        stratSkipFactor(i) = 0
    Next

    aset.NasNXStratTimeSteps = timeSteps
    aset.NasNXStratTimeIncrement = timeIncrement
    aset.NasNXStratSkipFactor = stratSkipFactor
    rc = aset.Put(1)

End Sub

Re: API properties NasNXStratTimeSteps and NasNXStratSkipFactor don't work

Experimenter
Experimenter
Ah thanks a lot. You are right that the input requested an array. I indeed noticed, but I was confused since the following line doesn't work: aset.NasNXStratTimeSteps(0) = 100 But the line below worked for the time increment aset.NasNXStratTimeIncrement = 0.01 Anyway, this mystery is solved ;-)