- Notifications
You must be signed in to change notification settings - Fork9
3D Manufacturing Format (3MF) implementation for Go
License
NotificationsYou must be signed in to change notification settings
HPInc/go3mf
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The 3D Manufacturing Format (3MF) is a 3D printing format that allows design applications to send full-fidelity 3D models to a mix of other applications, platforms, services and printers. The 3MF specification allows companies to focus on innovation, rather than on basic interoperability issues, and it is engineered to avoid the problems associated with other 3D file formats. Detailed info about the 3MF specification can be fint at3mf.io.
- High parsing speed and moderate memory consumption
- Complete 3MF Core spec implementation.
- Clean API.
- STL importer
- Spec conformance validation
- Robust implementation with full coverage and validated against real cases.
- Extensions
- Support custom and private extensions.
- Support lossless decoding and encoding of unknown extensions.
- spec_production.
- spec_slice.
- spec_beamlattice.
- spec_materials, missing the display resources.
package mainimport ("fmt""github.com/hpinc/go3mf")funcmain() {varmodel go3mf.Modelr,_:=go3mf.OpenReader("/testdata/cube.3mf")r.Decode(&model)for_,item:=rangemodel.Build.Items {fmt.Println("item:",*item)obj,_:=model.FindObject(item.ObjectPath(),item.ObjectID)fmt.Println("object:",*obj)ifobj.Mesh!=nil {for_,t:=rangeobj.Mesh.Triangles.Triangle {fmt.Println(t) }for_,v:=rangeobj.Mesh.Vertices.Vertex {fmt.Println(v.X(),v.Y(),v.Z()) } } }}
package mainimport ("bytes""fmt""io/ioutil""net/http""github.com/hpinc/go3mf")funcmain() {resp,_:=http.Get("zip file url")deferresp.Body.Close()body,_:=ioutil.ReadAll(resp.Body)varmodel go3mf.Modelr,_:=go3mf.NewDecoder(bytes.NewReader(body),int64(len(body)))r.Decode(&model)fmt.Println(model)}
package mainimport ("fmt""os""github.com/hpinc/go3mf")funcmain() {varmodel go3mf.Modelw,_:=go3mf.CreateWriter("/testdata/cube.3mf")w.Encode(&model)w.Close()}
Specs are automatically registered when importing them as a side effect of the init function.
package mainimport ("fmt""github.com/hpinc/go3mf""github.com/hpinc/go3mf/material""github.com/hpinc/go3mf/production")funcmain() {varmodel go3mf.Modelr,_:=go3mf.OpenReader("/testdata/cube.3mf")r.Decode(&model)fmt.Println(production.GetBuildAttr(&model.Build).UUID)model.Resources.Assets=append(model.Resources.Assets,&materials.ColorGroup{ID:10,Colors: []color.RGBA{{R:255,G:255,B:255,A:255}}, }}
About
3D Manufacturing Format (3MF) implementation for Go
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published