cancel
Showing results for 
Search instead for 
Did you mean: 

Subcases are not copied when an Analysis Set is copied using FEMAP API

Valued Contributor
Valued Contributor

Hello, everybody!

 

I'm writing a routine using FEMAP API that in certain point should create an Analysis Set that is a copy of another preexisting Analysis Set. It should do the same as the command Model - Analysis... - Copy. Follows a sample of what I'm doing:

 

Sub Main   

 

   Dim App As femap.model  

   Set App = feFemap()   

 

   Dim AnaSet As femap.AnalysisMgr  

   Set AnaSet =    App.feAnalysisMgr

   

   rc = AnaSet.Get(1)

   rc = AnaSet.Put(2) 

 

End Sub 

 

The problem with this routine is that all the attributes of Analysis Set 1 are copied to Analysis Set 2, except the subcases. Using the Model - Analysis - Copy everything, including the subcases, is copied.I've tried hard, I couldn't find a way to copy the subcases from Analysis Set 1 to Analysis Set 2.I'd like some help. I don't know whether I'm writing the routine correctly and there is a bug in the FEMAP API language or whether there is another way to do what I'm intending. 

 

I'm counting with your comments. 

 

Fabiano.

2 REPLIES

Re: Subcases are not copied when an Analysis Set is copied using FEMAP API

Phenom
Phenom

Hello,

 

If you're familiar with output and outputsets the idea is somewhat similar: the analysis manager can be a container for analysis cases.

 

You need to use the "setID" property, keep in mind this sentence of page 5.6.1 in the API help: "AnalysisCases are stored with their SetID equal to the ID of the analysis set, and the ID equal to the analysis case that you are trying to access"

 

I have not thoroughly tested this, but try something llike:

 

AP

 

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

    Dim initAM As Long, newAM As Long

    Dim am As femap.AnalysisMgr
    Dim ac As femap.AnalysisCase, acSet As femap.Set

    Set am = App.feAnalysisMgr
    Set ac =App.feAnalysisCase
    Set acSet =App.feSet

    am.First  'could select here
    initAM = am.ID

    am.Put(am.NextEmptyID)
    newAM = am.ID

    'fill a set with available analysis case IDs in analysis mgr
    ac.setID = initAM
    While ac.Next
        acSet.Add(ac.ID)
    Wend

    'copy to newAM
    While acSet.Next
        ac.setID = initAM
        ac.Get(acSet.CurrentID)

        ac.setID = newAM
        ac.Put(ac.ID)
    Wend
End Sub

Re: Subcases are not copied when an Analysis Set is copied using FEMAP API

Valued Contributor
Valued Contributor

Thank you for this answer, astrium_tls. The routine has worked exactly as I needed.

 

Fabiano.