CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > ANSYS Meshing & Geometry

[ICEM] Viewer update from replay script

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Sune
  • 1 Post By Sune

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 21, 2014, 03:46
Default Viewer update from replay script
  #1
New Member
 
Sune Niemann
Join Date: Aug 2011
Posts: 18
Rep Power: 15
Sune is on a distinguished road
Hello,

I started during what I supposed would be a very simple task, I still believe it is, but I ran into some problems. I want to create a small check mesh script where some of the output are pictures of different parts of the surface mesh.

In my first attempt I used the tdv library commands to set an appropriate view and then take a picture of that. This method worked without flaw. But since my geometry is very large and varies somewhat in shape from case to case, it is not allways straight forward figuring out where the surface that I want to take a picture of is located.

So I came up with another method of doing it. I simply blank out all the parts except those which contains the surface of interest, then i zoom to fit, orient the view and take a picture. Should be straight forward.

The problem is, when I execute the replay script, the blanking out part is not reflected in the viewer.

I can enter the commands manually one by one and it will work.

So, I'm sure that all my commands work, I'm just missing the bit where I force the viewer to update. Can anyone here help me out with this problem?



Example of the commands I use:
Code:
# Hide every type except surfaces
set family_list [ic_geo_list_families] 
ic_geo_update_visibility point $family_list 0
ic_geo_update_visibility curve $family_list 0
ic_geo_update_visibility surface $family_list 1
ic_geo_update_visibility density $family_list 0
ic_geo_update_visibility body $family_list 0
 
# Show all surfaces as solid with wire frams
ic_geo_configure_objects surface 1 solid 0 0 0 0 0 0 0 {} 0 0 0 0 {} 0 0 0 0 0 0 0 0
 
# Alternatively use
#ic_uns_subset_configure All -shade flat_wire
#ic_uns_subset_configure Selected -shade flat_wire
 
# Hide all parts
ic_uns_update_family_type visible {} {!NODE LINE_2 QUAD4 !HEXA_8} update 0
 
# Show the parts I want to take a picture off
ic_uns_update_family_type visible {_SRF_1 _SRF_2 _SRF_3} {!NODE LINE_2 QUAD4 !HEXA_8} update 0
Sune is offline   Reply With Quote

Old   May 23, 2014, 04:33
Default
  #2
New Member
 
Sune Niemann
Join Date: Aug 2011
Posts: 18
Rep Power: 15
Sune is on a distinguished road
After spell checking my original post I found the error in the code, it was simply a case of copy-pasting lines and forgetting to update properly.

If anyone can use it here is my code to take pictures of the surface mesh. It is missing a check to see whether the mesh is loaded but is otherwise functional.

The code is intended for a replay script and can not be run in batch mode.

/Sune


Code:
# Find viewer
global tdv_default str_option
 
# Hide everything
set family_list [ic_geo_list_families] 
ic_geo_update_visibility curve $family_list 0
ic_geo_update_visibility point $family_list 0
ic_geo_update_visibility surface $family_list 0
ic_uns_update_family_type visible $family_list {!NODE !LINE !QUAD_4 !HEXA_8} update 0
 
# Show all surfaces as solid
set str_option(surface,stype) solid 
update_geom_visible all p
 
# Show only the surfaces of interest
set family_surfs {_SRF_SURFACES _SRF_OF _SRF_INTEREST}
ic_geo_update_visibility surface $family_surfs 1
ic_uns_update_family_type visible $family_surfs {!NODE !LINE QUAD_4 !HEXA_8} update 0
 
# Set isometric view
tdv_isoview $tdv_default
 
# Zoom to fit
tdv_scale_to_fit $tdv_default
 
# Save JPEG of current view
ic_print format jpeg jpeg_quality 95 outfile checkmesh_1
mess "saved screenshot: checkmesh_1.jpeg"
 
# Other interesting views
tdv_reverse $tdv_default
ic_print format jpeg jpeg_quality 95 outfile checkmesh_2
mess "saved screenshot: checkmesh_2.jpeg"
 
tdv_set_current_orientation $tdv_default $pos $rot $scale $center
ic_print format jpeg jpeg_quality 95 outfile checkmesh_3
mess "saved screenshot: checkmesh_3.jpeg"
 
# Hide the surfaces again
ic_geo_update_visibility surface $family_list 0
ic_uns_update_family_type visible $family_surfs {!NODE !LINE !QUAD_4 !HEXA_8} update 0
Sune is offline   Reply With Quote

Old   June 12, 2015, 12:23
Default TDV Library Commands
  #3
New Member
 
Utah
Join Date: Jun 2015
Posts: 6
Rep Power: 11
baozhi xie is on a distinguished road
Dear friend,

I want to take a picture of my Geometry and Mesh in Batch model. But I can't change current view using ICEM script command.

I found your method: "In my first attempt I used the tdv library commands to set an appropriate view and then take a picture of that. This method worked without flaw. "

But I don't know TDV Library Commands, Can you help me?

Thanks,
Baozhi
baozhi xie is offline   Reply With Quote

Old   June 15, 2015, 08:53
Default
  #4
New Member
 
Sune Niemann
Join Date: Aug 2011
Posts: 18
Rep Power: 15
Sune is on a distinguished road
Take a look in your ICEM install directory under lib/tdv/
there should be a couple of tcl files in there, which can give you some inspiration.

some example of usage:

Code:
# Find default viewer
global tdv_default

# alternatively
global tdv_current_viewer

# Set isometric view
tdv_isoview $tdv_current_viewer

# Zoom to fit
tdv_scale_to_fit $tdv_current_viewer

# Rotate view dynamically 360 degrees
for {set view_angle 0} {$view_angle < [expr 2 * 3.14159]} {set view_angle [expr $view_angle + 3.14159 / 180]} {
tdv_rotate_axis $tdv_current_viewer 0 1 0  [expr 3.14159 / 180]
tdv_trans_update $tdv_current_viewer
update}
bluebase likes this.
Sune is offline   Reply With Quote

Old   June 15, 2015, 14:38
Default Thanks
  #5
New Member
 
Utah
Join Date: Jun 2015
Posts: 6
Rep Power: 11
baozhi xie is on a distinguished road
Thank you very much for helping me.

Now I can use the codes you give me to adjust the current viewer in GUI. However, I cannot take a picture. The command IC_Print doesn't work in batch and GUI model. Is there other commands or methods?

I hope you can give me some good advice.

Thanks.

Baozhi
baozhi xie is offline   Reply With Quote

Old   June 15, 2015, 14:57
Default Supplement
  #6
New Member
 
Utah
Join Date: Jun 2015
Posts: 6
Rep Power: 11
baozhi xie is on a distinguished road
there is a mistake, tdv_current_viewer no such variable, when I do the following code in batch model:

# Find default viewer
global tdv_default
# alternatively
global tdv_current_viewer
# Set isometric view
tdv_isoview $tdv_current_viewer
# Zoom to fit
tdv_scale_to_fit $tdv_current_viewer
baozhi xie is offline   Reply With Quote

Old   June 16, 2015, 03:32
Default
  #7
New Member
 
Sune Niemann
Join Date: Aug 2011
Posts: 18
Rep Power: 15
Sune is on a distinguished road
Quote:
Originally Posted by baozhi xie View Post
there is a mistake, tdv_current_viewer no such variable
Then use tdv_default instead.

Unfortunately you cannot take pictures of your geometry/mesh in batch mode, since the graphics are not rendered. You can, if it's no difference to you give the replay script as input when starting ICEM (-script REPLAYSCRIPTPATH), if you include an exit command at the end of your script, it will open the GUI execute your script and close down again.
baozhi xie likes this.
Sune is offline   Reply With Quote

Old   June 16, 2015, 11:09
Default problem still exists
  #8
New Member
 
Utah
Join Date: Jun 2015
Posts: 6
Rep Power: 11
baozhi xie is on a distinguished road
I try to replace tdv_current_viewer with tdv_default.

# Find default viewer
global tdv_default
# alternatively
global tdv_current_viewer
# Set isometric view
tdv_isoview $tdv_default
# Zoom to fit
tdv_scale_to_fit $tdv_default

The problem still a problem.
'can't read tdv_default, no such variable.
baozhi xie is offline   Reply With Quote

Old   June 18, 2015, 06:06
Default
  #9
New Member
 
Sune Niemann
Join Date: Aug 2011
Posts: 18
Rep Power: 15
Sune is on a distinguished road
Are you running the commands in batch mode? tdv_default is the default viewer window, which doesn't exist in batch mode.
Sune is offline   Reply With Quote

Old   June 18, 2015, 09:33
Default
  #10
New Member
 
Utah
Join Date: Jun 2015
Posts: 6
Rep Power: 11
baozhi xie is on a distinguished road
Yes, I run the batch model. I want to change the view and take a picture by batch model. However, the two things all failed. Could you please give me some advice?
Thanks,

Baozhi
baozhi xie is offline   Reply With Quote

Old   June 19, 2015, 06:07
Default
  #11
New Member
 
Sune Niemann
Join Date: Aug 2011
Posts: 18
Rep Power: 15
Sune is on a distinguished road
I already wrote in my previous post #7, that doing what you want in batch mode is not possible (to my best knowledge) and my suggestion to an alternative approach.

Sune
Sune is offline   Reply With Quote

Old   June 19, 2015, 09:56
Default
  #12
New Member
 
Utah
Join Date: Jun 2015
Posts: 6
Rep Power: 11
baozhi xie is on a distinguished road
Thank you for your kindness. I didn't describe my question clearly. Please help me. I didn't add -batch in my command.

"C:\Program Files\ANSYS Inc\v150\icemcfd\win64_amd\bin\icemcfd.bat" -script d:\ICEM\test5/getpic.rpl

#getpic.rpl
ic_load_tetin Slice-1.tin
# Find default viewer
global tdv_default
# alternatively
global tdv_current_viewer
# Set isometric view
tdv_isoview $tdv_default
# Zoom to fit
tdv_scale_to_fit $tdv_default
ic_print format jpeg jpeg_quality 95 outfile check_1
Exit
baozhi xie is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ICEM] Remeshing script using ICEM CFD replay mateusdias89 ANSYS Meshing & Geometry 2 February 15, 2015 15:18
[ICEM] [Workbench] Access WB-parameter from ICEM replay script. AdamAL ANSYS Meshing & Geometry 5 October 14, 2014 15:29
[ICEM] Save Message Log automatic with Replay Script survADe ANSYS Meshing & Geometry 3 July 11, 2013 06:49
[ICEM] ICEM Replay Script Automatization Mesh Generation polokus ANSYS Meshing & Geometry 0 April 19, 2013 06:15
CentFOAM Python Script Installation: Error socon009 OpenFOAM Installation 2 May 26, 2012 10:36


All times are GMT -4. The time now is 01:15.