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

[DesignModeler] Boolean Function for Script

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Kapi

Reply
 
LinkBack Thread Tools Display Modes
Old   October 22, 2012, 23:16
Lightbulb Boolean Function for Script
  #1
New Member
 
Mridul
Join Date: Mar 2011
Location: Melbourne, Australia
Posts: 26
Rep Power: 8
makkks is on a distinguished road
Hi guys,

I was just wondering if any1 knows the function which creates BOOLEAN thru script
I checked ansys help, WB scripting but I am not able to find any function or example which depicts how to boolean bodies via script.
Please please if any1 has any idea then let me know.

Cheerz
MAK
makkks is offline   Reply With Quote

Old   October 23, 2012, 20:58
Default
  #2
Super Moderator
 
diamondx's Avatar
 
Ghazlani M. Ali
Join Date: May 2011
Location: Tokyo, Japan
Posts: 1,384
Blog Entries: 23
Rep Power: 22
diamondx will become famous soon enough
as far as i know scripting in designmoder applies to sketches only.
Am i wrong ??
__________________
Regards,
New to ICEM CFD, try this document --> https://goo.gl/KAOIwm
Ali
diamondx is offline   Reply With Quote

Old   October 23, 2012, 21:04
Default
  #3
New Member
 
Mridul
Join Date: Mar 2011
Location: Melbourne, Australia
Posts: 26
Rep Power: 8
makkks is on a distinguished road
Hi Diamondx,

Thanks for reply.
Well U can record only sketching bit in designmodeler but there are heaps of different function with which u can do revolve, extrude, freeze and all which you may b able to find in Ansys help.
Basically in my model , I m doing sketching, revolving, freezing then boolean and forming new part.
Other than Boolean I was able to do everything thru script.
Basically Boolean and few functions like Body operation are not documented by ansys which is stopping me to go ahead!
makkks is offline   Reply With Quote

Old   October 25, 2012, 01:08
Unhappy
  #4
New Member
 
Mridul
Join Date: Mar 2011
Location: Melbourne, Australia
Posts: 26
Rep Power: 8
makkks is on a distinguished road
Any1 has any idea??
makkks is offline   Reply With Quote

Old   April 29, 2014, 09:15
Default
  #5
New Member
 
Join Date: Feb 2014
Posts: 2
Rep Power: 0
Blunaigel is on a distinguished road
Did you find any solution?
I'm looking for the same information right now.
Blunaigel is offline   Reply With Quote

Old   April 30, 2014, 02:47
Default
  #6
New Member
 
Join Date: Sep 2012
Posts: 26
Rep Power: 7
Nigirim is on a distinguished road
Hi Blunaigel and makkks,

the scriptcommand to create a boolean should be
Code:
ag.gui.CreateBoolean()
It is not documented like many more commands.

I have never used this command before so I can only tell you it exists but not how it works.

If I find something else I will edit it in this post.

Greets
Nigirim
Nigirim is offline   Reply With Quote

Old   November 6, 2014, 18:19
Default
  #7
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 7
Kapi is on a distinguished road
Nigirim you are right.

To create Boolean function

Quote:
ag.gui.CreateBoolean()
and to access the item in it, you have to use listview like

Quote:
ag.listview.ActivateItem("Tool Bodies");
once you have activated this item you can select body and "Apply" similarly.

Hope this helps
Kapi is offline   Reply With Quote

Old   November 9, 2016, 14:05
Default design modeler boolean operation via script
  #8
New Member
 
giosue giacoppo
Join Date: Sep 2012
Posts: 9
Rep Power: 7
giacoppo is on a distinguished road
I'm facing the geometry modeling trhough design modeler scripting..
I need some help to make boolean operation between bodies...
particularly I used the
ag.gui.CreateBoolean() command but I have some trouble in how select target and tool bodies...
Anyone can help me?
regards
giacoppo is offline   Reply With Quote

Old   November 9, 2016, 17:59
Default
  #9
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 7
Kapi is on a distinguished road
Hey mate,

you gotta do named selection of those bodies first then use below code
for ex: boolean substract body1 from all bodies:

Code:
var fBoolean = ag.gui.CreateBoolean();
fBoolean.Name="Boolean_Subtract1";
fBoolean.Operation = 2;
fBoolean.Preserve=ag.c.No;
ag.listview.ActivateItem("Tool Bodies");
agb.ClearSelections();  
ag.bodyPick;
ag.gui.SelectAll(); 
ag.listview.ItemValue = "Apply";
ag.listview.ActivateItem("Target Bodies");
agb.ClearSelections();
ag.bodyPick;
agb.AddSelect(agc.TypeBody, body1);
ag.listview.ItemValue = "Apply";
ag.b.Regen();
var finalbody = agb.FormNewPartFromAllBodies();
finalbody.name = "Final_Body1";
where "body1" is named selection of substracted body.

hope it helps

Cheers
Kapi
Talayal likes this.
Kapi is offline   Reply With Quote

Old   November 10, 2016, 05:13
Default
  #10
New Member
 
giosue giacoppo
Join Date: Sep 2012
Posts: 9
Rep Power: 7
giacoppo is on a distinguished road
thank you Kapi,
It helped me to make a step forward...
now the problem is how to select bodies via scripting?

thanks
giacoppo is offline   Reply With Quote

Old   November 10, 2016, 07:01
Default
  #11
New Member
 
giosue giacoppo
Join Date: Sep 2012
Posts: 9
Rep Power: 7
giacoppo is on a distinguished road
dear Kapi,
I tried to implement your script after defining manually the named selection but I get the error:
body1 not defined error 800a1391 Jscript run time error...
any suggestion?
giacoppo is offline   Reply With Quote

Old   November 10, 2016, 12:33
Default
  #12
New Member
 
giosue giacoppo
Join Date: Sep 2012
Posts: 9
Rep Power: 7
giacoppo is on a distinguished road
Yeah!
Thanks to your Advice I got into the script and I found an interesting solution for selecting bodies in the treeview: here is the working script.

var fBoolean = ag.gui.CreateBoolean(); //Create a Boolean operation
fBoolean.Name="a_collector";//Assign a Name to the Boolean feature
fBoolean.Operation = 2; //Select the Boolean operation 1 for UNite 2 for Subtract
//3 for Intersect and 4 for Imprint Faces
fBoolean.Preserve=ag.c.Yes; //Specify if preserve tool bodies or not
ag.listview.ActivateItem("Target Bodies"); //Activate Target Bodies Item
agb.ClearSelections(); //now we start with the selection of bodies involved in the boolean
body = ag.fm.Body(5); //use the ag.fm.Body(i) identifier to access/modify bodies
agb.AddSelect(agc.TypeBody, body)
ag.listview.ItemValue = "Apply";
ag.listview.ActivateItem("Tool Bodies");
for (var i = 7; i<=9; i++){ //perform multiple selection
body = ag.fm.Body(i);
agb.AddSelect(agc.TypeBody, body) }
ag.listview.ItemValue = "Apply";
ag.Regen;
I hope it helps
giacoppo is offline   Reply With Quote

Old   November 10, 2016, 17:42
Default
  #13
Senior Member
 
Join Date: Apr 2014
Location: Melbourne
Posts: 584
Rep Power: 7
Kapi is on a distinguished road
glad it worked for you
Kapi is offline   Reply With Quote

Old   November 11, 2016, 08:30
Default
  #14
New Member
 
giosue giacoppo
Join Date: Sep 2012
Posts: 9
Rep Power: 7
giacoppo is on a distinguished road
Hello Dear,
Anyone know how silently accept the Warning pop-up "feature cannot be copy of another feature name, so modified number at end" .
or in general how overcome this warning?
Thanks,
gios
giacoppo is offline   Reply With Quote

Old   November 11, 2016, 11:48
Default
  #15
New Member
 
giosue giacoppo
Join Date: Sep 2012
Posts: 9
Rep Power: 7
giacoppo is on a distinguished road
solved!
the problem was due to same name assigned to different features...
gios
giacoppo is offline   Reply With Quote

Reply

Tags
boolean, design modeler, function, scripting

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile problem ivanyao OpenFOAM Running, Solving & CFD 1 October 12, 2012 09:31
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
latest OpenFOAM-1.6.x from git failed to compile phsieh2005 OpenFOAM Bugs 25 February 9, 2010 05:37
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 00:35
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00


All times are GMT -4. The time now is 18:45.