cancel
Showing results for 
Search instead for 
Did you mean: 

GetUserDefinedStressRecoveryPoints

Valued Contributor
Valued Contributor

Hello,

 

I want to obtain the user defined stress recovery points from a 1D, "Key In", beam section.

therefore I use the following code:

                    Dim StressRecoveryPoints() As Point2d = Nothing
                    Dim fEModel1 As NXOpen.CAE.FEModel = CType(workFemPart.FindObject("FEModel"), NXOpen.CAE.FEModel)
                    Dim standardBeamSectionBuilder1 As NXOpen.CAE.StandardBeamSectionBuilder = fEModel1.BeamSections.CreateStandardBeamSectionBuilder(StandardBeamSections(ii))
                    standardBeamSectionBuilder1.GetUserDefinedStressRecoveryPoints(StressRecoveryPoints)
                    theLW.WriteLine(StressRecoveryPoints.Length.ToString())

However, the StressRecoveryPoints is empty. In the user interace I can see the stress recovery points. When I journal I can similar syntax as the one I used:

Dim fEModel1 As NXOpen.CAE.FEModel = CType(workFemPart.FindObject("FEModel"), NXOpen.CAE.FEModel)

Dim standardBeamSection1 As NXOpen.CAE.StandardBeamSection = CType(workFemPart.BaseFEModel.BeamSections.FindObject("BeamSection[HP100X6]"), NXOpen.CAE.StandardBeamSection)

Dim standardBeamSectionBuilder1 As NXOpen.CAE.StandardBeamSectionBuilder
standardBeamSectionBuilder1 = fEModel1.BeamSections.CreateStandardBeamSectionBuilder(standardBeamSection1)

Dim propertyTable1 As NXOpen.CAE.PropertyTable
propertyTable1 = standardBeamSectionBuilder1.PropertyTable

' ----------------------------------------------
'   Dialog Begin HP100X6
' ----------------------------------------------

standardBeamSectionBuilder1.SectionName = "HP100X6"

Dim unit1 As NXOpen.Unit = CType(workFemPart.UnitCollection.FindObject("MilliMeterFourth"), NXOpen.Unit)

propertyTable1.SetBaseScalarWithDataPropertyValue("K", "1.572213e-008", unit1)

Dim unit2 As NXOpen.Unit = CType(workFemPart.UnitCollection.FindObject("MilliMeterSixth"), NXOpen.Unit)

propertyTable1.SetBaseScalarWithDataPropertyValue("CW", "4.296535e-012", unit2)

Dim propertyValue1(-1) As String
propertyTable1.SetTextPropertyValue("description", propertyValue1)

Dim points1(4) As NXOpen.Point2d
points1(0) = New NXOpen.Point2d(4.10538, 26.8987)
points1(1) = New NXOpen.Point2d(4.09939, 26.8992)
points1(2) = New NXOpen.Point2d(4.09482, 26.9997)
points1(3) = New NXOpen.Point2d(4.11294, 26.9984)
points1(4) = New NXOpen.Point2d(4.1037, 26.9844)
standardBeamSectionBuilder1.SetUserDefinedStressRecoveryPoints(points1)

I tried some variations of passing StressRecoveryPoints to GetUserDefinedStressRecoveryPoints but without result.

 

Does anyone have any suggestions?

 

Regards,

frederik

3 REPLIES

Re: GetUserDefinedStressRecoveryPoints

Siemens Phenom Siemens Phenom
Siemens Phenom

You are not showing enough of your code. How is StandardBeamSections(ii) (i.e. the input argument to CreateStandardBeamSectionBuilder() being instantiated?

Re: GetUserDefinedStressRecoveryPoints

Siemens Phenom Siemens Phenom
Siemens Phenom

Actually, you don't need to instantiate a builder to get the recovery points. They are available directly as a CAE.BeamSection property

 

Here is code that will work:

 

Option Strict Off
Imports System
Imports NXOpen

Module ListStressRecoveryPoints

    Dim theSession As Session = Session.GetSession()
    Dim theLw As ListingWindow = theSession.ListingWindow

    Sub Main()

        theLw.Open()

        Dim femPart As CAE.FemPart = TryCast(theSession.Parts.BaseWork, CAE.FemPart)

        If femPart Is Nothing Then Return

        For Each beamSection As CAE.BeamSection In femPart.BaseFEModel.BeamSections

            theLw.WriteLine("Processing section: " + beamSection.Name)

            Dim StressRecoveryPoints(-1) As Point2d
            beamSection.GetStressRecoveryPoints(StressRecoveryPoints)

            theLw.WriteLine("  Number of stress recovery points: " + StressRecoveryPoints.Length.ToString())

            For Each stressRecoveryPoint As Point2d In StressRecoveryPoints
                theLw.WriteLine(String.Format("    Y: {0}    Z: {1}", stressRecoveryPoint.X, stressRecoveryPoint.Y))
            Next stressRecoveryPoint

        Next beamSection

    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image immediately after execution within NX
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

        '----Other unload options-------
        'Unloads the image when the NX session terminates
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

        'Unloads the image explicitly, via an unload dialog
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
        '-------------------------------

    End Function

End Module

Re: GetUserDefinedStressRecoveryPoints

Valued Contributor
Valued Contributor

Hello Jim,

 

Thank you for your swift reply!

 

The journal gave me the following code which mislead me:

standardBeamSectionBuilder1.SetUserDefinedStressRecoveryPoints(points1)

Therefore I was looking for the function GetUserDefinedStressRecoveryPoints. Since this function does not exist on a CAE.StandardBeamSection I tried to use the builder instead.

 

regards,

frederik