|
[Sponsors] |
July 20, 2016, 11:11 |
Same macro for different files
|
#1 |
New Member
Join Date: Jun 2016
Posts: 11
Rep Power: 10 |
hi everyone,
I'm doing a parametric study, which means that I use a lot of different files with the same parameters (but two or three of courses!). As a consequence, I would like to have a macro that does everything that is shared by all files (for instance define physics model or name surfaces (wall, inlet 1 ...)). Unfortunately, all my files that come from a CAD software (CREO) have different name (the name has to be different since it describes the geometry "inside" the file). So if I record a macro to split the "big part" imported from CREO into several ones, it won't work on another file because the macro can't find this part. (the error message says "named object does not exist in manager") Do you know how I can fix it? thank you in advance ( and sorry for bad English) EDIT : in the macro, I would like to change this line CadPart cadPart_0 = ((CadPart) simulation_0.get(SimulationPartManager.class).getP art("VWy6d6h4w1")); but instead of "VWy6d6h4w1" I need to have the current name. I hope it helps |
|
July 20, 2016, 17:03 |
|
#2 |
Member
Join Date: Nov 2015
Posts: 38
Rep Power: 11 |
The answer is as always, "it depends...". The name that you show as an example doesn't contain any obvious information in form of naming convention to grab exactly that one. So now there is the question, how you start after the import. You descrine that you want to "split the "big part". Is there only one part after the import, that has an arbitrary name or are there multiple where you choose the biggest to split it afterwards?
If there is only one, you can grab all the parts beneath the top level folder "Parts" with a syntax like: Collection<GeometryPart> collGP = simulation_0.get(SimulationPartManager.class).getP arts(); you simply grab the first and only one in the collection and split it like. GeometryPart gp = (GeometryPart) collGP.toArray()[0]; gp.split.... If there are more parts after the import, you will need any kind of naming convention or an other information to identify the right one. E.g. if the there is it always contains the string "Big" you could get the full collection of parts like described above and then loop over them to get the one that contains the search string like: Collection<GeometryPart> collGP = simulation_0.get(SimulationPartManager.class).getP arts(); for(GeometryPart gp : collGP){ if(gp.getPresentationName().contains("Big"){ gp.split... } } If you have no naming convention but know that you want to split the part with the biggest extent, you can Min- and Max Reports to grab all the min and max X,Y,Z values and identify the one that is the biggest one. Maybe this helps a little bit. Howver you will need a little bit more java knowledge tha just recording plus an editor like Netbeans or Eclipse. |
|
July 21, 2016, 06:56 |
|
#3 |
New Member
Join Date: Jun 2016
Posts: 11
Rep Power: 10 |
Thank you for your help, that is exactly what I need.
I was trying to use Part instead of GeometryPart and so I didn't find anything on the Internet. FYI, I have only one part, so your function "toArray()[0]" will be helpful. Once again, thank you so much for this quick answer |
|
Tags |
macro |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Workbench] Converting mesh files back into geometry files | dufferbrady | ANSYS Meshing & Geometry | 1 | April 7, 2016 20:38 |
problem compiling with header files | jreiter164 | Fluent UDF and Scheme Programming | 2 | August 14, 2015 18:31 |
UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 01:53 |
critical error during installation of openfoam | Fabio88 | OpenFOAM Installation | 21 | June 2, 2010 04:01 |
TECPLOT 10 macro problem | Matthew Morse | Tecplot | 5 | July 5, 2004 02:31 |