Cancel
Showing results for 
Search instead for 
Did you mean: 

Can't add constraint sets in a constraint combination (SPCADD)

Valued Contributor
Valued Contributor

Hello everybody!

 

I'm writing a routine that in certain point must create a combination of constraint sets (SPCADD) if none combination exists or add constraints in a preexisting constraint combination. I was able to create a constraint combination without any problem but when I tried to add constraints in a preexisting constraint combination, simply nothing happened. Below, follows a sample of I'm trying to do:

Sub Main

'Initialize variables.
    Dim App As femap.model
    Set App = feFemap()

    Dim BCSetAddID As Long
    Dim nSetID() As Long
    Dim i As Long

    Dim BC As femap.BCSet
    Set BC = App.feBCSet

'Create the constraint set that will
'receive the combination of sets.
    BCSetAddID = 90000000

    BC.title = "SPCADD"
    BC.Put(BCSetAddID)

'Create the constraint sets that will
'be combined
    ReDim nSetID(3)
    For i = 0  To UBound(nSetID)
        nSetID(i) = BCSetAddID + i+1
        BC.title = "Constraint " & i + 1 & ""
        BC.Put(nSetID(i))
    Next

'Combine the constraint sets through a 
'SPCADD
    BC.Get(BCSetAddID)
    BC.PutCombination(i,nSetID)
    BC.Put(BCSetAddID)

'******************************************
'Until here, everything works as I expected.
'The problem happens when I try to put some more
'constraint sets in the constraint combination
'as follows:
'******************************************

'Create some more constraint sets
    ReDim Preserve nSetID(7)
    For i = 4  To UBound(nSetID)
        nSetID(i) = BCSetAddID + i +1
        BC.title = "Constraint " & i + 1 & ""
        BC.Put(nSetID(i))
    Next

'Try to add the additional constrant sets
'in the preexisting constraint combination
    BC.Get(BCSetAddID)
    BC.PutCombination(i,nSetID)
    BC.Put(BCSetAddID)

'After put the modification I expected that the
'constraint combination was updated but instead
'of this, nothing happens.

End Sub

 

Could somebody help me? What am I doing wrong?

 

Fabiano