This is an example of a session file that will create a fem model, make 4 groups and assign colors to them.

1uil_file_new.go( "C:\Program Files\MSC.Software\Patran_x64\2020/template.db",  @
2"C:\project\wordpress\ex260\ex260.db" )
3set_current_dir( "C:\project\wordpress\ex260" )
4STRING asm_create_grid_xyz_created_ids[VIRTUAL]
5asm_const_grid_xyz( "1", "[0 0 0]", "Coord 0", asm_create_grid_xyz_created_ids )
6$# 1 Point created: Point 1
7asm_const_grid_xyz( "2", "[10 0 0]", "Coord 0",  @
8asm_create_grid_xyz_created_ids )
9$# 1 Point created: Point 2
10asm_const_grid_xyz( "3", "[10 10 0]", "Coord 0",  @
11asm_create_grid_xyz_created_ids )
12$# 1 Point created: Point 3
13asm_const_grid_xyz( "4", "[0 10 0]", "Coord 0",  @
14asm_create_grid_xyz_created_ids )
15$# 1 Point created: Point 4
16STRING asm_line_2point_created_ids[VIRTUAL]
17asm_const_line_2point( "1", "Point 1", "Point 2", 0, "", 50., 1,  @
18asm_line_2point_created_ids )
19$# 1 Line created: Line 1
20asm_const_line_2point( "2", "Point 2", "Point 3", 0, "", 50., 1,  @
21asm_line_2point_created_ids )
22$# 1 Line created: Line 2
23asm_const_line_2point( "3", "Point 3", "Point 4", 0, "", 50., 1,  @
24asm_line_2point_created_ids )
25$# 1 Line created: Line 3
26asm_const_line_2point( "4", "Point 4", "Point 1", 0, "", 50., 1,  @
27asm_line_2point_created_ids )
28$# 1 Line created: Line 4
29STRING sgm_surface_2curve_created_ids[VIRTUAL]
30sgm_const_surface_2curve( "1", "Curve 1", "Curve 3",  @
31sgm_surface_2curve_created_ids )
32$# 1 Surface Created: Surface 1
33uil_toolbar.shaded_smooth(  )
34ui_exec_function( "mesh_seed_display_mgr", "init" )
35INTEGER fem_create_mesh_surfa_num_nodes
36INTEGER fem_create_mesh_surfa_num_elems
37STRING fem_create_mesh_s_nodes_created[VIRTUAL]
38STRING fem_create_mesh_s_elems_created[VIRTUAL]
39fem_create_mesh_surf_4( "IsoMesh", 49152, "Surface 1", 1, ["1"], "Quad4", "#", @
40 "#", "Coord 0", "Coord 0", fem_create_mesh_surfa_num_nodes,  @
41fem_create_mesh_surfa_num_elems, fem_create_mesh_s_nodes_created,  @
42fem_create_mesh_s_elems_created )
43STRING g1[25],g2[25],g3[25],g4[25]
44STRING e1[36],e2[36],e3[36],e4[36]
45STRING created_ids_list[VIRTUAL]
46sys_poll_option( 2 )
47g1 = "Group 1"
48e1 = "Elm 1:5 11:15 21:25 31:35 41:45"
49ga_group_create(g1)
50ga_group_current_set(g1)
51uil_list_a.clear( )
52list_create_target_list( "lista", e1 )
53list_create_node_ass_elem( e1, "lista", created_ids_list )
54list_save_group( "lista", g1, FALSE )
55ga_group_color_set(g1,1)
56g2 = "Group 2"
57e2 = "Elm 6:10 16:20 26:30 36:40 46:50"
58ga_group_create(g2)
59ga_group_current_set(g2)
60uil_list_a.clear( )
61list_create_target_list("lista", e2)
62list_create_node_ass_elem( e2, "lista", created_ids_list )
63list_save_group("lista", g2, FALSE)
64ga_group_color_set(g2,2)
65g3 = "Group 3"
66e3 = "Elm 51:55 61:65 71:75 81:85 91:95"
67ga_group_create(g3)
68ga_group_current_set(g3)
69uil_list_a.clear( )
70list_create_target_list("lista", e3)
71list_create_node_ass_elem( e3, "lista", created_ids_list )
72list_save_group( "lista", g3, FALSE )
73ga_group_color_set(g3,5)
74g4 = "Group 4"
75e4 = "Elm 56:60 66:70 76:80 86:90 96:100"
76ga_group_create(g4)
77ga_group_current_set(g4)
78uil_list_a.clear( )
79list_create_target_list("lista", e4)
80list_create_node_ass_elem(e4, "lista", created_ids_list)
81list_save_group("lista", g4, FALSE)
82ga_group_color_set(g4,7)
83uil_list_a.clear( )
84coloring_method( 2 )
85sys_poll_option( 0 )
86uil_toolbar.shaded_smooth()
87uil_toolbar.wireframe(  )
88node_size( 15 )
89uil_imaging_bw_reverse(  )
90ui_repaint_tree( TRUE )
91uil_imaging_bw_reverse(  )
92ga_view_aa_set( 0., 0., 0. )
93uil_viewport_post_groups.posted_groups( "default_viewport", 4, ["Group 1", "Group 2", "Group 3", "Group 4"] )
94uil_primary_file.db_save( )

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading