CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   ANSYS Meshing & Geometry (http://www.cfd-online.com/Forums/ansys-meshing/)
-   -   [ICEM] Building topology command script files (http://www.cfd-online.com/Forums/ansys-meshing/71284-building-topology-command-script-files.html)

Anorky December 23, 2009 06:34

Building topology command script files
 
Hi everyone,

I have a question concerning the topology building for the geometry.
As already mentioned in my previous posts, I'm currently scripting the geometry, blocking and meshing.

When topology is build and this is recorded by the replay function the commands look like:

ic_undo_group_begin
ic_geo_delete_unattached { "LIST CONTAINING ALL PARTS" } 0 1
ic_build_topo 0.02 -angle 30 -no_concat "LIST CONTAINING ALL PARTS"
ic_geo_delete_unattached { "LIST CONTAINING ALL PARTS"}
ic_undo_group_end

The "LIST CONTAINING ALL PARTS" is automatically constructed when building the topology and recording and is valid for that geometry.

I would like to know if it is possible to construct this list automatically depending on the current geometry opened.

I mean, my geometry changes from analysis to analysis. Not always the geometry contains the same parts resulting in an error when running the scripting files if some parts are missing or extra parts are included.

If the list could be made automatically, the resulting script file would be a lot more variable. Otherwise, I have to record the topology building for all possible geometrical situations...

If I didn't make my question clear don't hesitate to tell me!

Thanks for reading my post and a happy christmas to all of you!

PSYMN December 24, 2009 12:27

Yes it is possible.
 
Yes, it is possible. There is a command to find all the parts in a model, you can set that into an array and then use the $array in the other command... Email me a reminder and I will get the command for you in the new year... Or you could look for it in the programmers guide...

Simon

PSYMN January 6, 2010 11:59

Code...
 
There are many different ways to do this (search help => programmers guide for "family" to see how many different ic_ commands there are), so I asked a developer what he thought would be the best way, and this is what he sent me.



The following 2 lines should work for geometry, mesh and blocking parts. The variable “parts” contains all existing part names , which are visible in the moment and/or set to “on” in the tree.

set parts ""
foreach f [array names fam_visible] { if $fam_visible($f) { append parts “$f “ } }

You can use the variable parts like:
ic_build_topo 0.006 -angle 30 -no_concat -new_family $parts


I hope this helps...

PSYMN January 6, 2010 12:12

For all existing parts...
 
Oh yea, to get all existing parts use:
foreach f [array names fam_visible] { append parts “$f “ }

Anorky January 7, 2010 08:42

You are a Genius
 
Hi Simon,

Thanks for the help, you are a genius!!

Kind regards,
K

Anorky January 7, 2010 09:40

You are a Genius
 
Hi Simon,

Thanks for the help, you are a genius!!

Kind regards,
K

PSYMN January 7, 2010 18:00

Nope, not a genius, just smarter than the average bear.

But I do work with a lot of really smart people (it is really quite humbling), one of whom supplied this solution (this is easy stuff for him).

Anorky January 11, 2010 06:50

Usage: TMP_BSP_FAM [ materials ]
 
Hi Simon,

I was wondering if you would know what is/ could be causing the following error:

Error in replay of source $scriptname
Usage: TMP_BSP_FAM [ materials ]

When I use the code you provided above in a replay file or script only blocking a part of my geometry everything works fine. Thus if I only run this script no problems occur.
But when I use this commmand in the same script that is called to run after some other blocking operations are done this error appears...
The structure looks like this in general:

1. Set some parameters
2. source $script 1 (geometry 1) when finished close project
3. source $script 2 (geometry 2) when finished close project
4. ...
5. source $script 5 (Blocking 1) when finished close project
6. source $script 6 (Blocking 2) when finished close project
7. ...
8. source $script 8 (script containing the commands in the above posts)


I only used the above command in the nr 8 script for blocking. When I run it like this the above mentioned error appears...

In the script I used it as follows:

#Place all the existing parts in a list
set listofparts ""
foreach f [array names fam_visible] { append listofparts "$f " }

#Initialize the 2D surface blocking
ic_undo_group_begin
ic_geo_new_family FLUID
ic_boco_set_part_color FLUID
eval ic_hex_surface_blocking FLUID -mapped -min_edge 0.0 -surfaces $LISTOFSURFACES
ic_hex_switch_blocking root
ic_hex_unblank_blocks
ic_hex_multi_grid_level
eval ic_hex_compute_mesh_size $listofparts FLUID
ic_hex_unstruct_face_type all_quads
ic_hex_switch_blocking root
ic_undo_group_end

Kind regards and thanks!!

Anorky January 11, 2010 08:25

Close project commands
 
Hi Simon,

I think it might have something to do with the close project commands I use...
I use the following commands to close the blocking:
ic_hex_unload_blocking
ic_geo_delete_family FLUID

And these for closing the geometry and remainder of the project:
ic_boco_unload
ic_csystem_display all 0
ic_csystem_set_current global
ic_unload_tetin
ic_empty_tetin
ic_geo_set_modified 0
ic_cart_is_loaded
ic_csystem_display all 0
ic_csystem_set_current global
ic_geo_set_modified 0

Up to this point in the scripts no mesh was created so there is no need to close that I imagine.

The "listofparts" made contains parts which aren't present in the geometry that is beeing blocked. But this parts of the geometry are made before the blocking process is started. I thougth that closing closing the project would suffice to avoid this but apperantly this is not the case. Do you see an error or missing commands in the list above?
The last list is also used to close the project when only geometry is created.

Thanks,


All times are GMT -4. The time now is 11:09.