ansa model browser script
hi.
example model browser open > 'A' part , 'B' part , ..... 'Z' part 1. I want to see each part in order according to a certain time. How do I create a script? please help me thank you! |
Hi, what do you mean by "according to a certain time."?
|
sorry, I didn't explain it right
all i want to say is if i can see each part by name i'm practicing my ANSA script next script is example import os.path from os.path import expanduser import ansa from ansa import base from ansa import utils import time home = expanduser("./path") abs_filename_1 = os.path.join(home, 'image1.png') def main(): t=time.time() base.Open("./path/file_name.ansa") base.SetViewButton({"SHADOW": "on", "VIEWMODE": "PID", "GRIDs": "off", "PERIMs": "off", "PERIM_POINTs": "off"}) set_view = base.SetViewAngles(f_key="F10") status = utils.SnapShot(abs_filename_1, image_format='PNG', transparent=True, text_axes=False) if status == 0: print('Image saved in ' + abs_filename_1) main() this script can only be taken as a whole, but i want to take a snapshot by part |
You need to collect all parts and then loop over them using a for loop. To collect entities in ANSA you can use base.CollectEntities().
Then use base.Or() to isolate each part on the screen: Code:
import os.path |
wow.. thank you !
Is it possible for each Properties ID or properties NAME I designated, not by part? |
Yes you can collect all PIDs using:
pids = base.CollectEntities(constants.OPENFOAM, None, 'SHELL_PROPERTY') and then: for pid in pids: base.Or(pid) ... ... All these are basic ANSA-entity and python interactions and you can find more info under: Help Menu>Documentation Index>Scripting>Guides>ANSA & META Python API |
I'm doing it little by little, and it really helps a lot. Thanks for letting me know. You're a genius!!!!
I'm sorry, but can I ask you one more question? what does base.Or mean?? |
You're wellcome. base.Or() is the script equivalent of the OR focus command in GUI. It isolates entities on the screen (keeps them visible while hiding everything else).
You can see what each script function does in its help text in the script editor. Search for the function in the search list and double click on it to get the help text. |
All times are GMT -4. The time now is 01:57. |