CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Mesh Generation & Pre-Processing Software > ANSA

How to find center of model using ANSA Scripting?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 2, 2017, 06:05
Default How to find center of model using ANSA Scripting?
  #1
New Member
 
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 7
Renu123 is on a distinguished road
Hello all,

I have .ansa files and wants to find center of each model.
Could anyone tell me wether ANSA software has the function to find center of model that will return center(I want x,y,z coordinates values of center) of model,if does where can I find the function. If not any suggestion how I do that.

Thank you
Renu123 is offline   Reply With Quote

Old   September 16, 2017, 16:37
Cool Get COG of each ansa Part
  #2
New Member
 
Join Date: Sep 2017
Posts: 5
Rep Power: 7
maddoxx is on a distinguished road
Quote:
Originally Posted by Renu123 View Post
Hello all,

I have .ansa files and wants to find center of each model.
Could anyone tell me wether ANSA software has the function to find center of model that will return center(I want x,y,z coordinates values of center) of model,if does where can I find the function. If not any suggestion how I do that.

Thank you
you can open each ansa file and get cog from card values. Refer the code for more.
Code:
import ansa
from ansa import *

def main():
	selected_files = utils.SelectOpenFileIn('/home/user/', 1) #for selecting multiple files
	for each_file in selected_files:
		ansa.base.Open(each_file) # for opening the file
		ansa_parts = ansa.base.CollectEntities(constants.NASTRAN, None, "ANSAPART", recursive=True, )
		for each_part in ansa_parts:
			cog = ansa.base.GetEntityCardValues(constants.NASTRAN, each_part, ('COG x','COG y','COG z'))
			print(" COG is",[cog['COG x'],cog['COG y'],cog['COG z']])

main()
maddoxx is offline   Reply With Quote

Old   September 16, 2017, 16:41
Default
  #3
New Member
 
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 7
Renu123 is on a distinguished road
Quote:
Originally Posted by maddoxx View Post
you can open each ansa file and get cog from card values. Refer the code for more.
Code:
import ansa
from ansa import *

def main():
	selected_files = utils.SelectOpenFileIn('/home/user/', 1) #for selecting multiple files
	for each_file in selected_files:
		ansa.base.Open(each_file) # for opening the file
		ansa_parts = ansa.base.CollectEntities(constants.NASTRAN, None, "ANSAPART", recursive=True, )
		for each_part in ansa_parts:
			cog = ansa.base.GetEntityCardValues(constants.NASTRAN, each_part, ('COG x','COG y','COG z'))
			print(" COG is",[cog['COG x'],cog['COG y'],cog['COG z']])

main()
Thank you for a reply
Renu123 is offline   Reply With Quote

Old   September 16, 2017, 16:46
Talking Glad To Help
  #4
New Member
 
Join Date: Sep 2017
Posts: 5
Rep Power: 7
maddoxx is on a distinguished road
I am interested in your "How to rotate plane 360 degree" post.
Post if any solution comes up..
maddoxx is offline   Reply With Quote

Old   September 16, 2017, 17:02
Default
  #5
New Member
 
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 7
Renu123 is on a distinguished road
Quote:
Originally Posted by maddoxx View Post
I am interested in your "How to rotate plane 360 degree" post.
Post if any solution comes up..
base.GeoRotate(input_function_type="MOVE", pid_offset="AUTO_OFFSET", group_offset="SAME PART", input_sets_type="NONE", fx=result[0], fy=result[1], fz=result[2], fx2=result[0]+100, fy2=result[1],fz2=result[2], angle=a, entities=pl1, draw_results=True, keep_connectivity=False)

Here in for loop give angel value in range 1 to 360
Renu123 is offline   Reply With Quote

Old   October 2, 2017, 07:14
Default
  #6
New Member
 
Tam Nguyen
Join Date: Sep 2017
Posts: 4
Rep Power: 7
tammttg is on a distinguished road
one third of the topics in this forum get no responses. mine, too
your topic will be useful to me some day
tammttg is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
trying to find the center of pressure of stratosail Jayakanth FLUENT 3 January 2, 2015 07:37
about Subgrid-scale model impecca OpenFOAM Running, Solving & CFD 4 December 20, 2013 11:36
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
Please help a newbie find the drag on a 3d model David Amer Main CFD Forum 1 March 6, 2002 04:33
I wish to find the proper model to validate the temperature field. G.H.Lee Main CFD Forum 1 May 6, 1999 03:05


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