cancel
Showing results for 
Search instead for 
Did you mean: 

Disable NSM Region With the API

Experimenter
Experimenter

I would like to disable certian connection regions prior to  exporting an analysis file. According to the FEMap documentation Fluid, Bolt and Rotor regions can be enabled or disabled using:

 

ConnectionRegion.Enable(bEnable)

 

When I try to disable an NSM region using the .Enable method I get a FE_FAIL return code. Has anyone found a way to disable NSM regions using the API?

 

Chris

3 REPLIES

Re: Disable NSM Region With the API

Siemens Phenom Siemens Phenom
Siemens Phenom

Did you 'Get' the Connection Region before disabling the region and 'Put' the Connection Region after, similar to the following script?  This script also check the selected Region type to make sure it is a NSM region and returns the status of NSM region enabled status.

 

The HTML Clipboard

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

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

    Dim cr As femap.ConnectionRegion
    Set cr = App.feConnectionRegion
    Dim crID As Long

    rc = crSet.Select ( FT_CONTACT, True, "Select NSM Region to Disable" )
    If rc <> FE_OK Then
        End
    End If

    crSet.Reset
    crID = crSet.First
    For i = 0 To crSet.Count-1
        cr.Get ( crID )
        'Check for NSM Region
        If cr.type >=0 And cr.type <=3  Then
            App.feAppMessage ( FCM_ERROR, _
                ("Selected Region:" + Str$(crID) + " is not a NSM Region") )
        Else
            rc = cr.Enable ( False )
            If rc = -1 Then
                App.feAppMessage ( FCM_COMMAND, _
                    ("NSM Region:" + Str$(crID) + " is Enabled") )
            Else
                App.feAppMessage ( FCM_COMMAND, _
                    ("NSM Region:" + Str$(crID) + " is Disabled") )
            End If
            cr.Put ( crID )
        End If
        cr.Put ( crID )
        crID = crSet.Next
    Next
    App.feAppUpdatePanes ( True )

End Sub

 

 

 

 

Best Regards,
Chip Fricke
Principal Applications Engineer - Femap Product Development

Re: Disable NSM Region With the API

Experimenter
Experimenter

Hey Chip,

 

Thanks for the quick reply. Yes I am using 'Get' prior to disabling and 'Put' after disabling. I am looping through a set of Connection Region ID's that contain ID's for both fluid and NSM regions. The fluid regions are disabled with my code, but the NSM regions are not.

 

I have tried your code and it does not disable the NSM regions. It just outputs a statement to the Message window that the NSM region was disabled.

 

Per the documentation, the FE_FAIL return code occurs when you try to disable the wrong type of region. I suspect the problem is with the .Enable method. Is it possible to load the NSM region as some other type of entity and disable it that way? Since NSM regions can be enabled/disabled through the GUI is there some other way to enable/disable these regions without using the Connection Region .Enable method?

Re: Disable NSM Region With the API

Siemens Phenom Siemens Phenom
Siemens Phenom

Femap v11.4.1 will have the API method updated to include disabling/enabling NSM regions.

 

For now, you will have to disable/enable NSM regions via the Model Info pane.

Best Regards,
Chip Fricke
Principal Applications Engineer - Femap Product Development