mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Parse AMF
This commit is contained in:
		
							parent
							
								
									dba6197935
								
							
						
					
					
						commit
						79ebb13bdb
					
				
					 8 changed files with 105 additions and 11 deletions
				
			
		
							
								
								
									
										28
									
								
								lib/Slic3r/AMF.pm
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								lib/Slic3r/AMF.pm
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| package Slic3r::AMF; | ||||
| use Moo; | ||||
| use XXX; | ||||
| 
 | ||||
| sub read_file { | ||||
|     my $self = shift; | ||||
|     my ($file) = @_; | ||||
|      | ||||
|     eval "require Slic3r::AMF::Parser; 1" | ||||
|         or die "AMF parsing requires XML::SAX::ExpatXS\n"; | ||||
|      | ||||
|     open my $fh, '<', $file or die "Failed to open $file\n"; | ||||
|      | ||||
|     my $vertices = []; | ||||
|     my $facets = []; | ||||
|     XML::SAX::ExpatXS | ||||
|         ->new(Handler => Slic3r::AMF::Parser->new( | ||||
|             _vertices    => $vertices, | ||||
|             _facets      => $facets, | ||||
|          )) | ||||
|         ->parse_file($fh); | ||||
|      | ||||
|     close $fh; | ||||
|      | ||||
|     return Slic3r::TriangleMesh->new(vertices => $vertices, facets => $facets); | ||||
| } | ||||
| 
 | ||||
| 1; | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci