CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > Siemens > STAR-CCM+

Macro for automated hardcopies in STAR-CCM+

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2020, 09:57
Default Macro for automated hardcopies in STAR-CCM+
  #1
New Member
 
Join Date: Dec 2020
Location: Germany
Posts: 7
Rep Power: 6
koecher is on a distinguished road
Hi everybody,

Maybe someone can help me with my following problem:
I have to post-process a huge amount of big machines, where I have to create a lot of plane sections as derived parts through the machine to show the airflow.
Is there a possibility to create a Macro, which is able to take all the planes i created and do for each plane the following:
1) Clip plane in front of plane section (--> take x-value of plane section, add Always f.e. 5mm, and enable Clip plane)
2) Do "Restore View 1"
3) Hardcopy Scene
4) Do "Restore View 2"
5) Hardcopy

and then starting again with 1) for the second plane section with the changed Clip plane infront of the second plane section and repeating These steps for all plane sections.
I guess the critical Topic might be if a value of a section plane can be taken, an additional value added and the new value taken for the Clip plane command.

Is this possible? Maybe via coding in Java?


Thank you very very much for your help in advance!

koecher
koecher is offline   Reply With Quote

Old   December 3, 2020, 04:08
Default
  #2
Senior Member
 
Ping
Join Date: Mar 2009
Posts: 556
Rep Power: 20
ping is on a distinguished road
sounds like you want just the results of one section plane displayed for each hard copy and although it will be possible to loop the clipping plane properties with java since almost everything is, i think this is a much easier:
- create just one section plane and then within java have a loop that shifts it to the required location before dumping the scene
- if you do want to create all the sections beforehand then in your macro you initially loop through them all and add a large value to one axis so it does not cut the fluid cells. then loop again and bring one back at a time to do the dump. this would be done with the collection manager to collect all sections to loop on.
ping is offline   Reply With Quote

Old   December 3, 2020, 05:59
Default
  #3
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 567
Rep Power: 21
bluebase will become famous soon enough
It's definitively doable with a macro. I have done many similar tasks with macros as well.


If you never have written a macro, i would suggest you to record the macro from doing these steps once manually.
Then you'll get most required code. You'll only need to include for loops and replace respective strings with variables.


getting a value from a plane might be done with a report. The value from reports can be read by macros. With that information you could adapt the coordinate of a created plane, among many other things.



Best,
Sebastian
bluebase is offline   Reply With Quote

Old   December 3, 2020, 10:34
Default
  #4
New Member
 
Join Date: Dec 2020
Location: Germany
Posts: 7
Rep Power: 6
koecher is on a distinguished road
Hello bluebase and ping,

thank you very much for your Input and tipps.
That will help me a lot.
Very very good! Thanks!!!
koecher is offline   Reply With Quote

Old   December 4, 2020, 03:40
Default
  #5
New Member
 
Join Date: Dec 2020
Location: Germany
Posts: 7
Rep Power: 6
koecher is on a distinguished road
Quote:
Originally Posted by bluebase View Post
It's definitively doable with a macro. I have done many similar tasks with macros as well.


If you never have written a macro, i would suggest you to record the macro from doing these steps once manually.
Then you'll get most required code. You'll only need to include for loops and replace respective strings with variables.


getting a value from a plane might be done with a report. The value from reports can be read by macros. With that information you could adapt the coordinate of a created plane, among many other things.



Best,
Sebastian
Hi bluebase,

which report did you think of to get the values? Is it the Expression Report?
But how can i refer this to my derived parts in the Expression editor?
koecher is offline   Reply With Quote

Old   December 4, 2020, 10:57
Default
  #6
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 567
Rep Power: 21
bluebase will become famous soon enough
It depends what "the values" are.

Expression report is likely not the first step you need, since this report class can only process scalar values.

You'll likely need something which computes a scalar from the area/volume of the input parts (the derived part in your case), e.g. min or max reports, or surface integrals.
bluebase is offline   Reply With Quote

Old   December 7, 2020, 06:19
Default
  #7
New Member
 
Join Date: Dec 2020
Location: Germany
Posts: 7
Rep Power: 6
koecher is on a distinguished road
Quote:
Originally Posted by bluebase View Post
It depends what "the values" are.

Expression report is likely not the first step you need, since this report class can only process scalar values.

You'll likely need something which computes a scalar from the area/volume of the input parts (the derived part in your case), e.g. min or max reports, or surface integrals.
Thank you, it worked with a max report and the field function Position, so after running the report the Position of the plane i selected as part got written.
But how can i put this value into the Clip plane properties? In the Expression Editor of the Clip plane properties arent any variables available and i dont know how to set my report value in the Clip plane properties.
Thanks!!
koecher is offline   Reply With Quote

Old   December 7, 2020, 06:33
Default
  #8
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 567
Rep Power: 21
bluebase will become famous soon enough
If I understand correctly...I cant find the a logic reason why you would want the position of a plane you have written before. That information is already available when the plane is created, e.g. x=0.5m, there is no need to run a report to get that same value into the macro.

Have you done some (brief) Java tutorials? I strongly suggest you do. Pay attention how to construct strings in various ways, how mathematical expressions can be used, and how you declare and assign variables in Java.

Start to record the essential operations you want to automatize and use StarCCM's Java API (the documentation) to understand how the recorded macros work.
If you are planning to replace a certain variable, or coordinate, i suggest you to actually change these variables, even if the first, default value seems acceptable.
The reason is, default values do not induce commands to be written to the recorded macro.
bluebase is offline   Reply With Quote

Old   February 13, 2023, 06:23
Default
  #9
New Member
 
Vaishali Ravishankar
Join Date: Nov 2022
Location: Munich, Germany
Posts: 2
Rep Power: 0
vaish99 is on a distinguished road
Quote:
Originally Posted by bluebase View Post
If I understand correctly...I cant find the a logic reason why you would want the position of a plane you have written before. That information is already available when the plane is created, e.g. x=0.5m, there is no need to run a report to get that same value into the macro.

Have you done some (brief) Java tutorials? I strongly suggest you do. Pay attention how to construct strings in various ways, how mathematical expressions can be used, and how you declare and assign variables in Java.

Start to record the essential operations you want to automatize and use StarCCM's Java API (the documentation) to understand how the recorded macros work.
If you are planning to replace a certain variable, or coordinate, i suggest you to actually change these variables, even if the first, default value seems acceptable.
The reason is, default values do not induce commands to be written to the recorded macro.
Hi,
I have worked with Java Macros but I cannot find any documentation on enabling a specific clipping plane of a scene. Currently, I have this code and it reports an error because of object and class mismatch:

ClipPlane cp_1 = scene_1.getPlaneManager().getClipPlane(1); //get the first clipping plane from scene_1
cp_1.invert(); // enable or invert clipping plane to write it as View 4
scene_1.printAndWait(resolvePath(path + "_" + scene_name + "_" + "View 4" + ".png"), 1, 2000, 1000, true, true);

Any help is greatly appreciated, thank you so much!
vaish99 is offline   Reply With Quote

Reply

Tags
automated, hardcopy, macro, post-processing


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
problem when imported geometry from 3D CAD to star ccm, TAREK GANAT STAR-CCM+ 1 May 21, 2013 23:15
[Commercial meshers] Using starToFoam clo OpenFOAM Meshing & Mesh Conversion 33 September 26, 2012 05:04
[Other] StarToFoam error Kart OpenFOAM Meshing & Mesh Conversion 1 February 4, 2010 05:38
error in star ccm maurizio Siemens 3 October 16, 2007 06:17
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 05:15


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