consider a .afm which is made of .fem, etc
Is there a way of "exporting" this "BOM" to either a text file/listing window or even better "excel"
I think what I am trying to understand is how to "walk" through tthe hierachy. Once this is understoed then It should be easy to output the data as one will most likely "collect" the data during the walk through. I suspect the work flow look like that
For each ComponentAssembly
get name of the ipart
get name of the part
I suspect there will be a brach if the ComponentAssembly is an .afm or a .fem
Solved! Go to Solution.
Thanks a lot for that. Just what I was looking for.
Didn't know about a function being able to call itself! May have read about it though
I'll need to have a look at the detail because the code does not return the names of the MasterCadPart & IdealizedPart- only the .fem. It also "crashes" on the the CAE.AssyFemPart call eventhough the test .afm I have only contains .fem, ipart, part
That's strange. Could you share the details of the crash.
I've tried it on a couple of different small assemblies and it seems to handle everything (loaded/unloaded parts; no cad part; cad part only; cad part + ideal part)
No CAD parts loaded:
Root Component: assembly1_afm_s Component: assembly1_afm Master cad part not loaded Component: component2_f Master cad part not loaded Component: component1_f Master cad part not loaded
Cad parts loaded manually or forceLoadCadParts=True (line 28):
Root Component: assembly1_afm_s Component: assembly1_afm Master cad part: assembly1 Component: component2_f Master cad part: component2 Idealized part: component2_f_i Component: component1_f Master cad part: component1 No Idealized part associated to this FEM part
run the offered code from an .afm which contains quite a few .fem (ipart & part) and .afm and I get the attached error.
If I exclude the call to function getCadPartNamesForAssyFem(), I get all the .fem but no Master cad part & Idealized part. I can see the lines where the code returns : No Idealized part associated to this FEM part.
If I change
then I get the name (no extension)
and one does get the the full path. For some reason the .Name returns a blank/empty string
As I work my way throuhg the kindly supplied code, I have noticed that repeated .fem are handled differently. Only the name of the.fem i.e. the component.displayname is listed the master cad and idealised part are skipped
In NX 11, the .Name property seems to default to the same value as the .Leaf property; in NX 10 and earlier it does not. See the following thread for another example: