cancel
Showing results for 
Search instead for 
Did you mean: 

RSS combination with VonMises stress API

Legend
Legend

I am trying to combined two output sets through "setcombination"

I am doing something wrong but I can not get what. I explain shortly what I am doing:

-  I have to output sets ID:1 and 2

-  I use the "setcombination" with the following settings:

      -enum=2(RSS)

     - numfactors=2 

     - vnSetID is an array with 1 and 2

     - xyz i also an array with scale factors set to 1

 

 

Sub Main()


Dim femap As Object
Set femap = GetObject(, "femap.model")

Dim outputset As Object
Set outputset = femap.feoutputset


Dim output As Object
Set output = femap.feoutput

Dim vnSETID(1) As Integer
vnSETID(0) = 1
vnSETID(1) = 2


Dim xyz(1) As Double
xyz(0) = 1
xyz(1) = 1


rc = outputset.setcombination(2, 2, vnSETID, xyz)
bSetTitles = True
rc = outputset.expandcombination(bSetTitles)
femap.feViewRegenerate (0)
End Sub

 

7 REPLIES

Re: RSS combination with VonMises stress API

Siemens Phenom Siemens Phenom
Siemens Phenom

I don't know if it's responsible for the issue you're seeing, but I would use the actual objects, not just a generic "Object" reference - this works fine - 

 

The HTML Clipboard

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

    Dim feOutputSet As femap.OutputSet
    Set feOutputSet = App.feOutputSet

    Dim lFactors(1) As Double
    Dim setIDs(1) As Long

    setIDs(0) =1
    setIDs(1) = 2
    lFactors(0) = 2.0
    lFactors(1) = 3.0

    feOutputSet.SetCombination(  FRPROC_RSS, 2, setIDs, lFactors )
    feOutputSet.ExpandCombination( True )
    rc = App.feViewRegenerate(0)
    
End Sub

Re: RSS combination with VonMises stress API

Legend
Legend

Hello,

 

I tried to use your macro but It does not work. First of all instead of defining as you did I do not why but it does not work (compilation error). I have to defined the objects as I did (see first four lines below). I am using excel (vb)

 I attached the macro that does not have compilation errors and adding lines from your code. It seems to be that it wroks but in FEMAP does come out nothing. No new output set is created

 

My defition of objects

Dim femap As Object

Set femap = GetObject(, "femap.model")

Dim feOutputSet As Object

Set feOutputSet = femap.feOutputSet

 

Your defintion of object

Dim App As femap.Model

Set App = feFemap()

Dim feOutputSet As femap.outputset

Set feOutputSet = App.feOutputSet

Re: RSS combination with VonMises stress API

Legend
Legend

Just to comments:

- I added again the *.bas file.

- your macro works if I launch the code inside FEMAP module API programming but not if I launch the macro from excel. My intention is to launch it from excel

Re: RSS combination with VonMises stress API

Legend
Legend

Definitily your code works fine when you are in the API programming in the FEMAP enviroment. If I change the code because I am launching the macro from excel with

 

Dim femap As Object
Set femap = GetObject(, "femap.model").....

 

It does work. There is no mistake but FEMAP does "nothing". It odes not crate any new output set

 

Any help? Thanks in advance

 

 

Re: RSS combination with VonMises stress API

Siemens Phenom Siemens Phenom
Siemens Phenom

In Excel's VBA environment, go to the Tools - References option, and Browse to and pick the FEMAP.TLB file in the main FEMAP directory.  Once this reference is loaded, this code will work -

 

Sub Button1_Click()

Dim App As femap.Model 'your code
Set App = GetObject(, "femap.model")
Dim feOutputSet As femap.outputset
Set feOutputSet = App.feOutputSet


Dim lFactors(1) As Double
Dim setIDs(1) As Long
setIDs(0) = 1
setIDs(1) = 2
lFactors(0) = 2#
lFactors(1) = 3#
rc = feOutputSet.SetCombination(FRPROC_RSS, 2, setIDs, lFactors)
feOutputSet.ExpandCombination (True)
App.feViewRegenerate (0)

End Sub

 

Re: RSS combination with VonMises stress API

Siemens Phenom Siemens Phenom
Siemens Phenom

With the reference to FEMAP's Type Library, VBA did not know what FRPROC_RSS means, it was "empty".  With the Type Library, and just using generic objects, this code works from Excel -

 

Sub Button1_Click()

Dim femap As Object ' my code
Set femap = GetObject(, "femap.model")
Dim feOutputSet As Object
Set feOutputSet = femap.feOutputSet

'Dim App As femap.Model 'your code
'Set App = feFemap()
'Dim feOutputSet As femap.outputset
'Set feOutputSet = App.feOutputSet


Dim lFactors(1) As Double
Dim setIDs(1) As Long
setIDs(0) = 1
setIDs(1) = 2
lFactors(0) = 2#
lFactors(1) = 3#
rc = feOutputSet.SetCombination(2, 2, setIDs, lFactors)
feOutputSet.ExpandCombination (True)
femap.feViewRegenerate (0)
End Sub

Re: RSS combination with VonMises stress API

Legend
Legend

Thanks masehrman,

 

Many trials and I did not realized about FRPROC_RSS. Thanks again.

Now it works.