ngcgui preamble postamble
- Rick G
- 
				 Topic Author Topic Author
- Offline
- Junior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 27
- Thank you received: 114
			
	
						17 Dec 2015 12:48				#67086
		by Rick G
	
	
		
			
	
			
			 		
													
	
				ngcgui preamble postamble was created by Rick G			
			
				One of the neat features of NGCGUI is that you can string together several subs before you finalize.
You can select a preamble to run just once with the "features" parameter.
So your preamble could start the spindle with a M3 or call a sub to light a plasma torch.
And not be repeated for the remaining subs.
You can also select a postamble to run at the end, such as a M5.
However it appears that the postamble runs at the end of each sub not just the last one.
Is there a parameter to avoid this?
Rick G
					You can select a preamble to run just once with the "features" parameter.
So your preamble could start the spindle with a M3 or call a sub to light a plasma torch.
And not be repeated for the remaining subs.
You can also select a postamble to run at the end, such as a M5.
However it appears that the postamble runs at the end of each sub not just the last one.
Is there a parameter to avoid this?
Rick G
Please Log in or Create an account to join the conversation.
- dgarrett
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 492
- Thank you received: 297
			
	
						17 Dec 2015 13:37				#67087
		by dgarrett
	
	
		
			
				
1) Make a subroutine that does what you want (M5.ngc for example) and invoke
it as the last subroutine in the chain
or
2) Use a 'custom' tab, specify a final subroutine (no-op.ngc if necessary),
specify a final postamble in the tab, invoke this subroutine last in the chain.
(A custom tab is specified with NGCGU_SUBFILE="")
or
3) Use the option "NGCGUI_OPTIONS=noiframe and manually specify a different
postamble for the last subroutine in the chain
					
	
	
			 		
													
	
				Replied by dgarrett on topic ngcgui preamble postamble			
			I think you are referring to the #<_feature> global that is incremented for each feature.You can select a preamble to run just once with the "features" parameter.
ngcgui inserts a special global variable named #<_feature:> that begins
with a value of 0 and is incremented for each added feature.  This
_global can be tested in subroutines; no entry box is created for it.There is no such parameter but you could:Is there a parameter to avoid this?
1) Make a subroutine that does what you want (M5.ngc for example) and invoke
it as the last subroutine in the chain
or
2) Use a 'custom' tab, specify a final subroutine (no-op.ngc if necessary),
specify a final postamble in the tab, invoke this subroutine last in the chain.
(A custom tab is specified with NGCGU_SUBFILE="")
or
3) Use the option "NGCGUI_OPTIONS=noiframe and manually specify a different
postamble for the last subroutine in the chain
		The following user(s) said Thank You: Rick G 	
			Please Log in or Create an account to join the conversation.
- Rick G
- 
				 Topic Author Topic Author
- Offline
- Junior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 27
- Thank you received: 114
			
	
						17 Dec 2015 14:03				#67089
		by Rick G
	
	
		
			
	
			
			 		
													
	
				Replied by Rick G on topic ngcgui preamble postamble			
			
				dgarrett,
Yes, I was away from the computer.
I have used both 1 and 2 above in the past, but it would nice to have something more automatic.
Again thanks for your work on NGCGUI!
Rick G
					I think you are referring to the #<_feature> global that is incremented for each feature.
Yes, I was away from the computer.
I have used both 1 and 2 above in the past, but it would nice to have something more automatic.
Again thanks for your work on NGCGUI!
Rick G
Please Log in or Create an account to join the conversation.
- dgarrett
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 492
- Thank you received: 297
			
	
						17 Dec 2015 17:01		 -  17 Dec 2015 18:45		#67093
		by dgarrett
	
	
		
			
	
	
			 		
													
	
				Replied by dgarrett on topic ngcgui preamble postamble			
			
				Rick,
I made a patch that causes (py)ngcgui to create a global that
can be tested in the subroutine (or the preamble or postamble):
The tar file includes the patch and updated ngcgui.tcl, pyngcgui.py:
www.panix.com/~dgarrett/stuff/last_feature.tgz
If you test both files and this fix meets your needs, i would make
a commit to put it in git master.
Note: if a subroutine that tests this variable is used in other
contexts (e.g., not ngcgui), it should test first for the existence
of the variable using the EXISTS[arg] function
ref: linuxcnc.org/docs/2.7/html/gcode/overview.html#gcode:functionsj
					I made a patch that causes (py)ngcgui to create a global that
can be tested in the subroutine (or the preamble or postamble):
#<_last_feature:> == 1 if last feature, 0 otherwiseThe tar file includes the patch and updated ngcgui.tcl, pyngcgui.py:
www.panix.com/~dgarrett/stuff/last_feature.tgz
If you test both files and this fix meets your needs, i would make
a commit to put it in git master.
Note: if a subroutine that tests this variable is used in other
contexts (e.g., not ngcgui), it should test first for the existence
of the variable using the EXISTS[arg] function
ref: linuxcnc.org/docs/2.7/html/gcode/overview.html#gcode:functionsj
		Last edit: 17 Dec 2015 18:45  by dgarrett.			
			Please Log in or Create an account to join the conversation.
- dgarrett
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 492
- Thank you received: 297
			
	
						17 Dec 2015 20:53		 -  17 Dec 2015 21:16		#67103
		by dgarrett
	
	
		
			
	
	
			 		
													
	
				Replied by dgarrett on topic ngcgui preamble postamble			
			
				Rick,
I had a better idea and made a new patch for a more general solution:
www.panix.com/~dgarrett/stuff/remaining_features.tgz
With this version, the global variable created is a count of the
number of features remaining after the current feature:So a value of zero indicates the current feature is the last.
You could also use it to print the number of features remaining.
					I had a better idea and made a new patch for a more general solution:
www.panix.com/~dgarrett/stuff/remaining_features.tgz
With this version, the global variable created is a count of the
number of features remaining after the current feature:
#<_remaining_features:>You could also use it to print the number of features remaining.
		Last edit: 17 Dec 2015 21:16  by dgarrett.			
	
		The following user(s) said Thank You: Rick G 	
			Please Log in or Create an account to join the conversation.
- Rick G
- 
				 Topic Author Topic Author
- Offline
- Junior Member
- 
				  
		Less
		More
		
			
	
		- Posts: 27
- Thank you received: 114
			
	
						18 Dec 2015 07:26				#67123
		by Rick G
	
	
		
			
	
			
			 		
													
	
				Replied by Rick G on topic ngcgui preamble postamble			
			
				Dewey,
That is great! Just tried it on ngcgui with no postamble and I think it is a great new feature.
For example I edited slot.ngc by adding...
As you said with this you get a running count down on the screen of the features that are running and a action to be taken after the last feature.
Thanks for the great addition.
Rick G
					That is great! Just tried it on ngcgui with no postamble and I think it is a great new feature.
For example I edited slot.ngc by adding...
;adding to test remaining features
(debug, remaining features, #<_remaining_features:>)
o<i3> if [#<_remaining_features:> EQ 0]
        m5
        (debug, m5 last remaining features, #<_remaining_features:>)
o<i3> endifAs you said with this you get a running count down on the screen of the features that are running and a action to be taken after the last feature.
Thanks for the great addition.
Rick G
Please Log in or Create an account to join the conversation.
- dgarrett
- Offline
- Platinum Member
- 
				  
		Less
		More
		
			
	
		- Posts: 492
- Thank you received: 297
			
	
						18 Dec 2015 13:49				#67129
		by dgarrett
	
	
		
			
	
			
			 		
													
	
				Replied by dgarrett on topic ngcgui preamble postamble			
			
				ok -- pushed to master, thanks for the suggestion
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...2e28958f6e440f00dd65
					git.linuxcnc.org/gitweb?p=linuxcnc.git;a...2e28958f6e440f00dd65
Please Log in or Create an account to join the conversation.
		Time to create page: 0.069 seconds	
