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 Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 2, 2017, 05:05
Default How to find center of model using ANSA Scripting?
  #1
New Member
 
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 8
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, 15:37
Cool Get COG of each ansa Part
  #2
New Member
 
Join Date: Sep 2017
Posts: 5
Rep Power: 8
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, 15:41
Default
  #3
New Member
 
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 8
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, 15:46
Talking Glad To Help
  #4
New Member
 
Join Date: Sep 2017
Posts: 5
Rep Power: 8
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, 16:02
Default
  #5
New Member
 
Renuka
Join Date: Aug 2017
Posts: 15
Rep Power: 8
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, 06:14
Default
  #6
New Member
 
Tam Nguyen
Join Date: Sep 2017
Posts: 4
Rep Power: 8
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


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 06:37
about Subgrid-scale model impecca OpenFOAM Running, Solving & CFD 4 December 20, 2013 10:36
Water subcooled boiling Attesz CFX 7 January 5, 2013 03:32
Please help a newbie find the drag on a 3d model David Amer Main CFD Forum 1 March 6, 2002 03:33
I wish to find the proper model to validate the temperature field. G.H.Lee Main CFD Forum 1 May 6, 1999 02:05


All times are GMT -4. The time now is 22:30.