Cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the "initial gap" for a plurality of elements GAP

Valued Contributor
Valued Contributor

Hello all.

Help option to assign "initial gap" simultaneously for a plurality of properties of the elements GAP

3 REPLIES

Re: Changing the "initial gap" for a plurality of elements GAP

Siemens Genius Siemens Genius
Siemens Genius

This API should be able to change the "Initial Gap" of each of the Gap properties you have to what you specify. 

 

The HTML Clipboard

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

    Dim e As femap.Elem
    Set e = App.feElem

    Dim prp As femap.Prop
    Set prp = App.feProp

    Dim eSet As femap.Set
    Set eSet = App.feSet

    Dim eID As Long
    Dim pID As Long
    Dim newGap As Double

    'set Initial Gap value
    App.feGetReal ("Enter Initial Gap", 0, 9999, newGap)
    App.feAppMessage(FCM_NORMAL, Str$(newGap))

    eSet.AddRule (9, FGD_ELEM_BYTYPE )

    eID = eSet.First

    While eID > 0
        e.Get(eID)
        pID = e.propID
        prp.Get(pID)
        prp.PutValueArray(1, pID, 0, newGap)
        prp.Put(pID)
        eID = eSet.Next
    Wend
    
End Sub

Re: Changing the "initial gap" for a plurality of elements GAP

Valued Contributor
Valued Contributor

This script changes the initial gap in all elements in the model. It is possible to add the option of choice of specific elements gap?

Re: Changing the "initial gap" for a plurality of elements GAP

Siemens Genius Siemens Genius
Siemens Genius

Here's a few modifications to select which elements you would like to change the initial gap.

 

The HTML Clipboard

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

    Dim e As femap.Elem
    Set e = App.feElem

    Dim prp As femap.Prop
    Set prp = App.feProp

    Dim eSet As femap.Set
    Set eSet = App.feSet

    Dim gapSet As femap.Set
    Set gapSet = App.feSet

    Dim eSetGap As femap.Set
    Set eSetGap = App.feSet

    Dim pID As Long
    Dim newGap As Double

    If eSet.Select(FT_ELEM, True, "Select GAP Elements") <> FE_OK Then End
    eSetGap.AddRule (9, FGD_ELEM_BYTYPE )
    gapSet.AddCommon(eSet.ID, eSetGap.ID)

    'set Initial Gap value
    If App.feGetReal ("Enter Initial Gap", 0, 9999, newGap) <> FE_OK Then End
    App.feAppMessage(FCM_NORMAL, Str$(newGap))

    While gapSet.Next
        e.Get(gapSet.CurrentID)
        pID = e.propID
        prp.Get(pID)
        prp.PutValueArray(1, pID, 0, newGap)
        prp.Put(pID)
    Wend
    
End Sub