I recorded a journal file for exporting results to as unv-files. These results are generated by using the combined load case option.
I tried to use the recorded journal file on a secound model. I just changed the paths and output names in the file. Everything else is the same as in the recorded one, but I always get the following error:
In NX 9 I got a similar message when I forgot to load the results in the post processing navigator, but I checked everything and also the results are loaded. I also unloaded and loaded the results and tried again, but I still get the same error.
Interesting thing is, that in the original file the export by using the journal file is working.
The line to which at the error is referred to is the following:
Dim nXObject1 As NXOpen.NXObject
nXObject1 = resultsEnvelopeBuilder1.Commit()
Does anybody have an idea whats going wrong here?
Thanks and regards,
It sounds like you are using a journal recorded in NX 9 with NX 10? If so, then this may be a migration issue. Sometimes the code changes between releases in ways that require journals and NX Open programs to be updated. I don't know if this is the case here, but wanted to point out that it is a possibility.
Simulation Product Management
Product Engineering Software
Siemens Industry Sector
Siemens Product Lifecycle Management Software Inc.
Journals will typically only work "as-is" for the specific model they were recorded in. Some editing is required to make them more general for use in any model. This primarily involves modifying selection of model specific objects.
The first thing to look for is any calls to a FindObject() method. The input to this method is the journal identifier string of an object. You can find more information about this in Chapter 16 of the "Getting Started With Snap" guide (much of the content of this document is not specific to SNAP and applies equally well to NX Open).
The second thing to look for is any entity selection. If you select nodes, elements, faces, etc. at any step of the process, you will typically see a tagged object array being build with these objects added one at a time. These need to be replaced by a generic selection mechanism.
Since you are in post dealing with results, I'll also mention PostView ID's. Many calls in Post take the PostView ID as the first argument. In a recorded journal, these are hardcoded as integer values. You need to modify the code in this area to capture the postview ID that was generated when a postview was created as a variable. Then use this variable when calling downstream post methods.
I can't make any more specific recommendations without seeing the code in question.
unfortunately I am really bad in programming issues.
In my opinion the recorded journal file must work also for the second model, because it is exactly the same as the model in which it was generated.
I used this procedure already earlier in NX9 and it worked perfect.
Below please find the code of the journal file.
The only thing I am editing here are the namings "LC_F_1" e.g. to "LC_F_2" and of course additionally the path of the output file. \M1_Unten\ is changed to \M2_Unten\.
The error message for this journal file is reffering to line number 51:
nXObject1 = resultsCombinationBuilder1.Commit()
I also tried to generate the journal file for my second model and compared it to the manually edited file based on the journal file form model 1 and it is the exat same structure.
Therefore I don´t understand why the manually edited journal file shouldn´t work.
' NX 10.0.0.24 ' Journal created by z0033yrc on Wed Feb 18 12:21:49 2015 Mitteleuropäische Zeit Option Strict Off Imports System Imports NXOpen Module NXJournal Sub Main (ByVal args() As String) Dim theSession As NXOpen.Session = NXOpen.Session.GetSession() Dim workSimPart As NXOpen.CAE.SimPart = CType(theSession.Parts.BaseWork, NXOpen.CAE.SimPart) Dim displaySimPart As NXOpen.CAE.SimPart = CType(theSession.Parts.BaseDisplay, NXOpen.CAE.SimPart) Dim markId1 As NXOpen.Session.UndoMarkId markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibili
ty.Visible, "Start") theSession.SetUndoMarkName(markId1, "Results Combination Dialog") Dim markId2 As NXOpen.Session.UndoMarkId markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibili ty.Invisible, "Results Combination") theSession.DeleteUndoMark(markId2, Nothing) Dim markId3 As NXOpen.Session.UndoMarkId markId3 = theSession.SetUndoMark(NXOpen.Session.MarkVisibili ty.Invisible, "Results Combination") Dim resultsCombinationBuilder1 As NXOpen.CAE.ResultsCombinationBuilder resultsCombinationBuilder1 = theSession.ResultManager.CreateResultsCombinationB uilder() Dim types1(0) As NXOpen.CAE.BaseResultType Dim resultManager1 As NXOpen.CAE.ResultManager = CType(theSession.ResultManager, NXOpen.CAE.ResultManager) Dim solutionResult1 As NXOpen.CAE.SolutionResult = CType(resultManager1.FindObject("SolutionResult[Ma ster_B4_H800_assyfem_sim1.sim_Master_B4_H800]"), NXOpen.CAE.SolutionResult) Dim loadcase1 As NXOpen.CAE.Loadcase = CType(solutionResult1.Find("Loadcase"), NXOpen.CAE.Loadcase) Dim iteration1 As NXOpen.CAE.Iteration = CType(loadcase1.Find("Iteration"), NXOpen.CAE.Iteration) Dim resultType1 As NXOpen.CAE.ResultType = CType(iteration1.Find("ResultType[[Stress][Element -Nodal]]"), NXOpen.CAE.ResultType) types1(0) = resultType1 Dim names1(0) As String names1(0) = "STRE" Dim units1(0) As NXOpen.Unit Dim unit1 As NXOpen.Unit = CType(workSimPart.UnitCollection.FindObject("Stres sMilliNewtonPerSquareMilliMeter"), NXOpen.Unit) units1(0) = unit1 resultsCombinationBuilder1.SetResultTypes(types1, names1, units1) resultsCombinationBuilder1.SetFormula("STRE") resultsCombinationBuilder1.SetOutputResultType(NXO pen.CAE.ResultsManipulationBuilder.OutputResultTyp e.Full) resultsCombinationBuilder1.SetCreateSolution(False ) resultsCombinationBuilder1.SetImportResult(True) resultsCombinationBuilder1.SetImportedSolutionName ("LC_F_1") resultsCombinationBuilder1.SetOutputQuantity(NXOpe n.CAE.Result.Quantity.NXXShellResultant) resultsCombinationBuilder1.SetOutputName("LC_F_1") resultsCombinationBuilder1.SetLoadcaseName("LC_F_1 ") resultsCombinationBuilder1.SetIncludeModel(True) resultsCombinationBuilder1.SetOutputFile("F:\1_Pro jekte\Projects_2015\20150109_JSW_Torangallu_Ladle Turret B4 H800mm\NX\20_Turm\21_Drehturm_Original\HMB AA\M1_Unten_0\Export\LC_F_1.unv") resultsCombinationBuilder1.SetUnitsSystem(NXOpen.C AE.ResultsManipulationBuilder.UnitsSystem.FromResu lt) resultsCombinationBuilder1.SetUnitsSystemResult(so lutionResult1) resultsCombinationBuilder1.SetIncompatibleResultsO ption(NXOpen.CAE.ResultsCombinationBuilder.Incompa tibleResults.Skip) resultsCombinationBuilder1.SetNoDataOption(NXOpen. CAE.ResultsCombinationBuilder.NoData.Skip) resultsCombinationBuilder1.SetEvaluationErrorOptio n(NXOpen.CAE.ResultsCombinationBuilder.EvaluationE rror.Skip) Dim nXObject1 As NXOpen.NXObject nXObject1 = resultsCombinationBuilder1.Commit() resultsCombinationBuilder1.Destroy() theSession.DeleteUndoMark(markId3, Nothing) theSession.SetUndoMarkName(markId1, "Results Combination") End Sub End Module
It's hard to debug without being able to run the code, but "Result File not found" sounds like a problem with:
Dim solutionResult1 As NXOpen.CAE.SolutionResult = CType(resultManager1.FindObject("SolutionResult[Master_B4_H800_assyfem_sim1.sim_Ma
Is "Master_B4_H800_assyfem_sim1.sim_Master_B4_H800" the name of a solution? Did you modify this string between the file you recorded the journal in and the one you are running it in?
thank you for your help.
Yes, this is the name of the solution. It is also the same in all other models.
For me also a hint that it must be the correct string is, that the journal file is starting. Otherwise it would abort immediatelly.
In my case the journal file is running through all the steps (loading the necessary subcase, combining results,...) but when it is finished (it is indicated in the bottom information bar by the blue bar is reaching 100%) and the exported file in the folder should be finalized suddenly this error message pops up and the procedure is canceld.
thank you for your support on this topic.
Finaly I found the mistake. It was simply a wrong letter in the output path. Although it was the first thing I checked and I checked it several times afterwards I was not able to see it. But finally I recognized it though.