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

[ICEM] How to start ICEM interactively to load procedures

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 5, 2023, 14:15
Default How to start ICEM interactively to load procedures
  #1
New Member
 
Join Date: Oct 2023
Posts: 1
Rep Power: 0
mnasoft is on a distinguished road
Good day, colleagues.


Is it possible to launch ICEM interactivly using bat-file on Windows wich loading a tcl-script, in order to after the script is finished running, the procedures defined in this script are available in ICEM?

To launch ICEM CFD 14.5 I use a bat-file that looks like this:
Code:
path_to_icem/icemcfd.bat -script path_to_user_folder/script.tcl
The file script.tcl looks like this:
Code:
proc ch_vis {} {
    set surfaces [ic_geo_list_visible_objects surface]
    foreach surface $surfaces {
        set part [ic_geo_get_family surface $surface]
        foreach curve [ic_geo_boundary surface $surface 0 0 1] {
            ic_geo_set_part curve $curve $part 0
            foreach point [ic_geo_boundary curve $curve 0 0 1] {
                ic_geo_set_part point $point $part 0 } } } }
mess "script.tcl loaded \n"
it define procedure ch_vis and after that print message (which I can see).


Then I open apropriate project and trying to invoke ch_vis in console area.
But interpreter say that ch_vis command not defined.


Then if I invoke in console area command like this:
Code:
source path_to_user_folder/script.tcl
After that invokation of ch_vis becomes possible.


This behavior is a feature or a bug? Is it possible to change it somehow?
mnasoft is offline   Reply With Quote

Old   October 20, 2023, 07:29
Default
  #2
New Member
 
Ihor
Join Date: Sep 2022
Posts: 1
Rep Power: 0
tyrex is on a distinguished road
A similar question was resolved here:


https://forum.ansys.com/forums/topic...-startup-icem/


ICEM CFD has a scripting interpreter, GUI interpreter, and batch interpreter. A Tcl interpreter is an isolated code space that can have certain protections set. Sometimes interpreters can communicate with each other depending on the protections set. When you launch ICEM CFD by command line with the -script argument, it runs this script in the script interpreter. When you run script inside the ICEM CFD message window, by typing individual commands or with the "source" command it is run in the gui interpreter. It is not easy to call functions and variables from the gui interp that are defined in the script interp.
ic_gui_set allows gui_interp access from the script_interp that is used with "icemcfd -script" startup.
one argument retrieves variable value.
two arguments sets a variable value.
Three or more arguments executes a function. Include a blank 3rd argument to make 3 if only sending 1 argument to function.
Only works, though, for procedures that take in 2 arguments or more.
If 3rd arg is blank, such as {}, then it will not return the value of the function. ic_gui_set needs 3 or more non-blank args to return a function value.


For loading script in GUI interpreter from sripting interpreter try:
ic_gui_set eval source script.tcl
tyrex is offline   Reply With Quote

Reply

Tags
icem, procedure, script, start up, tcl


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
TimeVaryingMappedFixedValue irishdave OpenFOAM Running, Solving & CFD 32 June 16, 2021 07:55
Error When Starting ICEM CFD in Ubuntu cgriffin33 ANSYS Meshing & Geometry 22 October 3, 2019 12:48
Cfd to ansys thermal to ansys structural interface ssixr ANSYS 17 July 31, 2015 16:18
Cannot Start the post-processing tool of ICEM Jean-Francois Main CFD Forum 1 November 23, 2011 04:11
ICEM HEXA - Where to start? flattie CFX 3 May 26, 2009 10:12


All times are GMT -4. The time now is 16:04.