mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 12:41:18 -07:00 
			
		
		
		
	add some comments
This commit is contained in:
		
							parent
							
								
									359d4073df
								
							
						
					
					
						commit
						ca25494177
					
				
					 1 changed files with 12 additions and 10 deletions
				
			
		| 
						 | 
					@ -4,18 +4,20 @@ use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my $z = 0;
 | 
					my $z = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# read stdin and any/all files passed as parameters one line at a time
 | 
				
			||||||
for (<>) {
 | 
					for (<>) {
 | 
				
			||||||
	if (/Z(\d+(\.\d+)?)/) {
 | 
						# if we find a Z word, save it
 | 
				
			||||||
		$z = $1;
 | 
						$z = $1 if /Z(\d+(\.\d+)?)/;
 | 
				
			||||||
		print;
 | 
					
 | 
				
			||||||
 | 
						# if we don't have Z, but we do have X and Y
 | 
				
			||||||
 | 
						if (!/Z/ && /X/ && /Y/ && $z > 0) {
 | 
				
			||||||
 | 
							# chop off the end of the line (incl. comments), saving chopped section in $1
 | 
				
			||||||
 | 
							s/\s*([\r\n\;\(].*)//s;
 | 
				
			||||||
 | 
							# print start of line, insert our Z value then re-add the chopped end of line
 | 
				
			||||||
 | 
							print "$_ Z$z $1";
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		if (!/Z/ && /X/ && /Y/ && $z > 0) {
 | 
							# nothing interesting, print line as-is
 | 
				
			||||||
			s/\s*([\r\n\;\(].*)//gs;
 | 
							print;
 | 
				
			||||||
			print "$_ Z$z $1";
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		else {
 | 
					 | 
				
			||||||
			print;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue