This repository contains the official Go bindings for the lib3mf library.
To include lib3mf in your Go project, run the following command:
go get github.com/3MFConsortium/lib3mf.go/v2@v2.5.0Once installed, you can use the lib3mf package in your Go projects as shown below:
import (
"fmt"
lib3mf "github.com/3MFConsortium/lib3mf.go/v2"
"log"
)
func main() {
wrapper, err := lib3mf.GetWrapper()
if err != nil {
log.Fatal("Error loading 3MF library:", err)
}
}The GetWrapper() function is a convenience method similar to the one in the lib3mf Python bindings. It simplifies handling the library paths for lib3mf, so you do not need to use LoadLibrary() manually to load the lib3mf library.
Use prepare_go_release.py to sync this repository from an SDK release:
python prepare_go_release.py 2.5.0By default, this downloads lib3mf_sdk_v<version>.zip from the lib3mf GitHub release artifacts.
Use --dry-run to preview changes:
python prepare_go_release.py 2.5.0 --dry-runFor local/offline artifacts, override source:
python prepare_go_release.py 2.5.0 --source /path/to/lib3mf_sdk_v2.5.0.zip --dry-run