Acessing femoccurrence in .afm without opening the .afm?

To all,

I am playing around with accessing the fems making up an .afm, see code below. Just general stuff nothing specific at the moment. As I making some notes for a possible program (hence the testing) I realised that the program could be even better (!) if one could access the info in the .afm without having it open (in Nx.CAE).

so the question is the following:
Assuming the user can select an .afm in a folder, is there a way of accessing which fems are making up the .afm without opening it? And the question could even be extended to a sim. Given a selected .sim is there a way of getting which .afm or fem is "attached" to the .sim.

Thanks
Regards

Dim theAssyFEMPart As CAE.AssyFemPart
Dim theAssyFEModel As CAE.AssyFEModel

theAssyFEMPart = CType(theBasePart, CAE.AssyFemPart)
theAssyFEModel = CType(theAssyFEMPart.BaseFEModel(), CAE.AssyFEModel)

theLW.WriteLine ("Assy FEM Full path is : " & theAssyFEMPart.FullPath)
theLW.WriteLine ("Assy FEM Leaf is : " & theAssyFEMPart.Leaf)

For Each theFEModelOccur As CAE.FEModelOccurrence In theAssyFEModel.GetChildren()
theLW.WriteLine("--------")
theLW.WriteLine(" Component Name:" & theFEModelOccur.GetCOmponent().Name)
theLW.WriteLine(" Display Name:" & theFEModelOccur.GetCOmponent().DisplayName)
Dim thefemoccattr AS CAE.FEModelOccAttribute = theFEModelOccur.GetAttributes()
theLW.WriteLine(" Attribute Name is: " & thefemoccattr.Name & "Label is:" & thefemoccattr.GetLabel)
Next

NX ships with a command line utility called "ugpc.exe" that will list all the components of an assembly (whether a "normal" assembly or a "sim" assembly).

Thanks for the tip about ugpc.exe. Never heard of it so will look into it.

Unless I am mistaken there is no way of executing a .exe from a "NX program" (a advanced kind-of journal).

The reason I am doing some testing is for a possible program to speed up the creation of a new rev for multiple fems, making an .afm (which in turn is used in a sim). At the moment, assuming you have the .sim & .afm opened, if you do "save as" for one of the .fem then you have to rename the .afm and then the .sim. If you then do the next .fem you have to rename the .afm and .sim, and so on.

A (perfect) starting point

Sim_v1
Afm_v1
Fem1_v1
Fem2_v23

User wants to update both fems to the next rev to get
Sim_v2
Afm_v2
Fem1_v2
Fem2_v24

I have in mind something along the lines
1. User selects a .sim file
2. program then get associated .afm and the the fems making up the .afm (display list in a UIBuilder GUI maybe)
3. user selects which .fems to up-rev (a naming convention exists for .fem name which contains the rev ID, so the rev ID can easily be extracted)
4 . program loops through the .fem and up-rev them and up-rev the .afm and .sim file

Just some thoughts at the moment....

Thanks
Regards
JXB

Thanks
Regards

"Unless I am mistaken there is no way of executing a .exe from a "NX program" (a advanced kind-of journal)."

Fortunately for you, you are mistaken :)

You can start an external program from your program; you can even start one from an uncompiled journal. The journal found at the link below starts the "ug_convert_part.exe" to convert a part file's units. Something similar could be done with the "ugpc" program.

http://nxjournaling.com/content/convert-part-units

Delighted to be mistaken. I think I was probably thinking about calling another uncompiled journal from an uncompiled journal.

Will take me fair bit of time to go through the provided link, but just started. Some stuff I have never seen (Not being a programmer and all that..). I guess I'll need to see if one can "pipe" (is that the "old UNIX term!!) the output of 'ugpc.exe' to a string to extract whatever info is created by the program.

Thanks
Regards

Thanks
Regards

Be on the lookout for .RedirectStandardOutput and .RedirectStandardError in the example code...