using Group

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
User avatar
Sling
Posts: 5244
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

using Group

#1 Post by Sling »

I have a query related to the Group API functions.

The wiki does not suggest that you can add a group to another group with group_obj_add but out of curiosity I gave it a try. It turns out I can group 2 images and then create a new group with the first group and a new image. Using visible and just the group id's I can control the first 2 images(grp1) or all three (grp2).

I preceded to scale up from this simple test to a mixed image and text case of 50 items. I already had some groups created for these objects so I just added the group id's for these to a top level group. Some of the items were not in groups so these got added individually. I did this over approximately 8 statements (1 initial add and 7 obj_add's).

I ran the instrument and it caused AM to crash (usual Java stopped message). Troubleshooting found that adding a group_id to a group_id with the obj_add caused the crashing. If I added all the individual elements of each of the offending groups to the top level group then all was good.

So my question is should what I tried work or did I just get lucky with the simple test. It would be good if we could layer/combine groups like this rather than have to create a new group very similar to an existing one.

Tony

User avatar
Corjan
Posts: 2941
Joined: Thu Nov 19, 2015 9:04 am

Re: using Group

#2 Post by Corjan »

Hey,


You should be able to add groups into other groups.
I'll have a look (probably tomorrow) if I can also get it to crash.

To be clear, did it already crash when calling 'group_obj_add', or did you have to call something like 'visible' or 'move' to get it to crash?


Thanks for reporting this bug,

Corjan

User avatar
Sling
Posts: 5244
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: using Group

#3 Post by Sling »

Corjan,
No it crashes with just the adding. I was prepping an instrument ready for testing with opacity so I'm not doing anything with the group yet.

jedeen
Posts: 527
Joined: Fri Jan 13, 2017 5:41 pm

Re: using Group

#4 Post by jedeen »

So....I could replace these 300+ lines of code (nothing fancy)

Code: Select all

	if mode == 2 and ctr_var == 0 then
	  nd_mode = 2
		--visible(group_map_img1, false)			--turn indicators
		visible(group_map_img1a,true)	
		visible(group_map_txt1, true)
		visible(group_map_img2, true)
		visible(group_map_txt2, true)
		visible(group_map_img3, true)
		visible(group_map_line1, true)			--magenta lines
		visible(group_img_wayp1, true)			--white waypoints
		visible(group_wpt_txt1, true)			--white waypoint text
		visible(group_wpt_txt2, true)			--magenta waypoint text
		visible(groupe_data_txt1, true)			--magenta data text
		visible(group_data_txt2, true)			--white data text
		visible(group_data_txt3, true)			--white eta text
		visible(group_arpt_txt, true)			--airport text
			visible(group_img_wptcw, true)			--white waypoints with circle
		visible(group_img_wptm, true)			--magenta waypoints
			visible(group_img_wptcm, true)			--magenta waypoins with circle
		visible(group_img_arpt, true)			--airports
		visible(group_img_1stat, true)			--stations of type 1
		--visible(group_img_2stat, true)			--stations of type 2
		visible(group_stat_txt, true)			--text for stations
		visible(group_tcas_diaw, true)			--tcas open white diamond
		visible(group_tcas_arrow_up, true)		--tcas white arrow up
		visible(group_tcas_arrow_down, true)	--tcas white arrow down
		visible(group_tcas_arrow_downa, true)	--tcas amber arrow down
		visible(group_tcas_arrow_downr, true)	--tcas red arrow down
		visible(group_tcas_arrow_upa, true)		--tcas amber arrow up
		visible(group_tcas_arrow_upr, true)		--tcas red arrow up
		visible(group_tcas_diawf, true)			--tcas filled white diamond
		visible(group_tcas_altt_txt1, true)		--tcas altitude text white top
		visible(group_tcas_alta_txtt, true)		--tcas altitude text amber top
		visible(group_tcas_txtb, true)			--tcas altitude text white bottom
		visible(group_tcas_txtab, true)			--tcas altitude text amber bottom
		visible(group_tcas_alt_txtrb, true)		--tcas altitude text red bottom
		visible(group_tcas_alt_txtrt, true)		--tcas altitude text red top
		visible(group_tcas_amber_circle, true)	--tcas amber circle
		visible(group_tcas_red_box, true)		--tcas red box
		
		--PLN groups
		visible(group_pln_wptw, false)			--all white waypoints for pln page
		visible(group_pln_img1, false)			--all imgages for pln page
		visible(group_pln_txt1, false)			--all textlined for pln page
		visible(pln_img_mask, false)
		visible(group_pln_img_line_magenta, false)
		visible(group_pln_wpt_text_white, false)
		visible(group_pln_wpt_text_magenta, false)
		visible(group_pln_img_wptm, false)       --xxxxxxxxxxxxxxxx
		visible(group_pln_img_wptcw, false)
		visible(group_pln_img_wptcm, false)
		
		--CTR groups
		visible(group_ctr_img1, false)				--images for ctr page
		visible(group_ctr_wptw, false)
		visible(group_ctr_img_wptm, false)
			visible(group_ctr_img_wptcm, false)			--if these 2 are on then they produce an error!!!!!!!!!
			visible(group_ctr_img_wptcw, false)			--if these 2 are on then they produce an error!!!!!!!!!
		visible(group_wptc_txt1, false)				--white text
		visible(group_wptc_txt2, false)				--magenta text
		visible(group_ctr_line1, false)				--magenta lines
		
		visible(group_ctr_text,false)
		
	elseif mode == 3 and ctr_var == 0 then
	  nd_mode = 3
		visible(group_pln_wptw, true)			--all white waypoints for pln page
		visible(group_pln_img1, true)			--all imgages for pln page
		visible(group_pln_txt1, true)			--all textlined for pln page
		visible(pln_img_mask, true)
		visible(group_pln_img_wptcw, true)
		visible(group_pln_img_wptcm, true)
		--visible(group_pln_wpt_text_white, true)
		--visible(group_pln_wpt_text_magenta, true)
		
		--MAP PAGE 
		--visible(group_map_img1, false)
		visible(group_map_txt1, false)
		visible(group_map_img2, false)
		visible(group_map_txt2, false)
		visible(group_map_img3, false)
		visible(group_map_line1, false)			--magenta lines
		visible(group_img_wayp1, false)			--white waypoints
		visible(group_wpt_txt1, false)			--white waypoint text
		visible(group_wpt_txt2, false)			--magenta waypoint text
		visible(groupe_data_txt1, false)		--magenta data text
		visible(group_data_txt2, false)			--white data text
		visible(group_data_txt3, false)			--white eta text
		visible(group_arpt_txt, false)			--airport text
		visible(group_img_wptcw, false)			--white waypoints with circle
		visible(group_img_wptm, false)			--magenta waypoints
		visible(group_img_wptcm, false)			--magenta waypoins with circle
		visible(group_img_arpt, false)			--airports
		visible(group_img_1stat, false)			--stations of type 1
		--visible(group_img_2stat, false)			--stations of type 2
		visible(group_stat_txt, false)			--text for stations
		visible(group_tcas_diaw, false)			--tcas open white diamond
		visible(group_tcas_arrow_up, false)		--tcas white arrow up
		visible(group_tcas_arrow_down, false)	--tcas white arrow down
		visible(group_tcas_arrow_downa, false)	--tcas amber arrow down
		visible(group_tcas_arrow_downr, false)	--tcas red arrow down
		visible(group_tcas_arrow_upa, false)		--tcas amber arrow up
		visible(group_tcas_arrow_upr, false)		--tcas red arrow up
		visible(group_tcas_diawf, false)			--tcas filled white diamond
		visible(group_tcas_altt_txt1, false)		--tcas altitude text white top
		visible(group_tcas_alta_txtt, false)		--tcas altitude text amber top
		visible(group_tcas_txtb, false)			--tcas altitude text white bottom
		visible(group_tcas_txtab, false)			--tcas altitude text amber bottom
		visible(group_tcas_alt_txtrb, false)		--tcas altitude text red bottom
		visible(group_tcas_alt_txtrt, false)		--tcas altitude text red top
		visible(group_tcas_amber_circle, false)	--tcas amber circle
		visible(group_tcas_red_box, false)		--tcas red box
		
		--CTR groups
		visible(group_ctr_img1, false)				--images for ctr page on
		visible(group_ctr_wptw, false)
		visible(group_ctr_img_wptm, false)
			--visible(group_ctr_img_wptcm, false)			--if these 2 are on then they produce an error!!!!!!!!!
			--visible(group_ctr_img_wptcw, false)			--if these 2 are on then they produce an error!!!!!!!!!
		visible(group_wptc_txt1, false)				--white text
		visible(group_wptc_txt2, false)				--magenta text
		visible(group_ctr_line1, false)				--magenta lines
		
		visible(group_ctr_text,false)
		
	elseif mode == 2 and ctr_var == 1 then				--ctr page is active
	  nd_mode = 4
		--CTR groups
		visible(group_ctr_img1, true)				--images for ctr page on
		visible(group_ctr_wptw, true)
		visible(group_ctr_img_wptm, true)
			--visible(group_ctr_img_wptcm, true)			--if these 2 are on then they produce an error!!!!!!!!!
			--visible(group_ctr_img_wptcw, true)			--if these 2 are on then they produce an error!!!!!!!!!
		visible(group_wptc_txt1, true)				--white text
		visible(group_wptc_txt2, true)				--magenta text
		visible(group_ctr_line1, true)				--magenta lines
		
		visible(group_ctr_text,true)				--text for center page
		
		--MAP groups
		visible(group_map_img1, false)
		visible(group_map_txt1, false)
		visible(group_map_img2, false)
		visible(group_map_txt2, false)
		visible(group_map_img3, false)
			visible(group_map_line1, false)			--magenta lines
			visible(group_img_wayp1, false)			--white waypoints
		visible(group_wpt_txt1, false)				--white waypoint text
		visible(group_wpt_txt2, false)				--magenta waypoint text
		visible(groupe_data_txt1, false)			--magenta data text
		visible(group_data_txt2, false)				--white data text
		visible(group_data_txt3, false)				--white eta text
		visible(group_arpt_txt, false)				--airport text
		--visible(group_img_wptcw, false)			--white waypoints with circle
		visible(group_img_wptm, false)				--magenta waypoints
		--visible(group_img_wptcm, false)			--magenta waypoins with circle
		visible(group_img_arpt, false)				--airports
		visible(group_img_1stat, false)				--stations of type 1
		visible(group_img_2stat, false)				--stations of type 2
		visible(group_stat_txt, false)				--text for stations
		visible(group_fix_img, false)				--fixes
		visible(group_fix_txt, false)				--fix text
		visible(group_tcas_diaw, false)				--tcas open white diamond
		visible(group_tcas_arrow_up, false)			--tcas white arrow up
		visible(group_tcas_arrow_down, false)		--tcas white arrow down
		visible(group_tcas_arrow_downa, false)		--tcas amber arrow down
		visible(group_tcas_arrow_downr, false)		--tcas red arrow down
		visible(group_tcas_arrow_upa, false)		--tcas amber arrow up
		visible(group_tcas_arrow_upr, false)		--tcas red arrow up
		visible(group_tcas_diawf, false)			--tcas filled white diamond
		visible(group_tcas_altt_txt1, false)		--tcas altitude text white top
		visible(group_tcas_alta_txtt, false)		--tcas altitude text amber top
		visible(group_tcas_txtb, false)				--tcas altitude text white bottom
		visible(group_tcas_txtab, false)			--tcas altitude text amber bottom
		visible(group_tcas_alt_txtrb, false)		--tcas altitude text red bottom
		visible(group_tcas_alt_txtrt, false)		--tcas altitude text red top
		visible(group_tcas_amber_circle, false)		--tcas amber circle
		visible(group_tcas_red_box, false)			--tcas red box
		
--PLN GROUPS
		visible(group_pln_wptw, false)			--all white waypoints for pln page
		visible(group_pln_img1, false)			--all imgages for pln page
		visible(group_pln_txt1, false)			--all textlines for pln page
		visible(pln_img_mask, false)
		visible(group_pln_wpt_text_white, false)
		visible(group_pln_wpt_text_magenta, false)
		--visible(group_pln_img_wptm, false)----------------
		visible(group_pln_img_wptcw, false)
		visible(group_pln_img_wptcm, false)
		visible(group_pln_img_line_magenta, false)
with only 12 lines ??????? ;)
Have fun
Jedeen

User avatar
Sling
Posts: 5244
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: using Group

#5 Post by Sling »

Jedeen,

Yes but did you add the items directly to the top level group or did you nest multiple smaller groups. My issue was only with the latter method.

Post Reply