slices

package
v0.24.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2023 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const Namespace = "http://schemas.microsoft.com/3dmanufacturing/slice/2015/07"

Namespace is the canonical name of this extension.

Variables

View Source
var (
	ErrSliceExtRequired          = errors.New("a 3MF package which uses low resolution objects MUST enlist the slice extension as required")
	ErrNonSliceStack             = errors.New("slicestackid MUST reference a slice stack resource")
	ErrSlicesAndRefs             = errors.New("may either contain slices or refs, but they MUST NOT contain both element types")
	ErrSliceRefSamePart          = errors.New("the path of the referenced slice stack MUST be different than the path of the original slice stack")
	ErrSliceRefRef               = errors.New("a referenced slice stack MUST NOT contain any further sliceref elements")
	ErrSliceSmallTopZ            = errors.New("slice ztop is smaller than stack zbottom")
	ErrSliceNoMonotonic          = errors.New("the first ztop in the next slicestack MUST be greater than the last ztop in the previous slicestack")
	ErrSliceInsufficientVertices = errors.New("slice MUST contain at least 2 vertices")
	ErrSliceInsufficientPolygons = errors.New("slice MUST contain at least 1 polygon")
	ErrSliceInsufficientSegments = errors.New("slice polygon MUST contain at least 1 segment")
	ErrSlicePolygonNotClosed     = errors.New("objects with type 'model' and 'solidsupport' MUST not reference slices with open polygons")
	ErrSliceInvalidTranform      = errors.New("any transform applied to an object that references a slice stack MUST be planar")
)
View Source
var DefaultExtension = go3mf.Extension{
	Namespace:  Namespace,
	LocalName:  "s",
	IsRequired: false,
}

Functions

This section is empty.

Types

type MeshResolution

type MeshResolution uint8

MeshResolution defines the resolutions for a slice.

const (
	ResolutionFull MeshResolution = iota
	ResolutionLow
)

Supported slice resolution.

func (MeshResolution) String

func (c MeshResolution) String() string

type ObjectAttr

type ObjectAttr struct {
	SliceStackID   uint32
	MeshResolution MeshResolution
}

ObjectAttr defines the attributes added to Object.

func GetObjectAttr

func GetObjectAttr(obj *go3mf.Object) *ObjectAttr

func (*ObjectAttr) Marshal3MF added in v0.24.0

func (s *ObjectAttr) Marshal3MF(_ spec.Encoder, start *xml.StartElement) error

Marshal3MF encodes the resource attributes.

func (ObjectAttr) Namespace added in v0.24.0

func (ObjectAttr) Namespace() string

func (*ObjectAttr) Unmarshal3MFAttr added in v0.24.0

func (u *ObjectAttr) Unmarshal3MFAttr(a spec.XMLAttr) error

type Polygon

type Polygon struct {
	StartV   uint32
	Segments []Segment
}

The Polygon element contains a set of 1 or more Segment elements to describe a 2D contour. If a Slice contains content, there MUST be at least one Polygon to describe it.

type Segment

type Segment struct {
	V2  uint32
	PID uint32
	P1  uint32
	P2  uint32
}

A Segment element represents a single line segment (or edge) of a polygon. It runs from the vertex specified by the previous segment (or the startv Polygon attribute for the first segment) to the specified vertex, v2.

type Slice

type Slice struct {
	TopZ     float32
	Vertices Vertices
	Polygons []Polygon
}

Slice defines the resource object for slices.

type SliceRef

type SliceRef struct {
	SliceStackID uint32
	Path         string
}

SliceRef reference to a slice stack.

type SliceStack

type SliceStack struct {
	ID      uint32
	BottomZ float32
	Slices  []Slice
	Refs    []SliceRef
}

SliceStack defines a slice stack resource. It can either contain a SliceStack or a Refs slice.

func (*SliceStack) Identify

func (s *SliceStack) Identify() uint32

Identify returns the unique ID of the resource.

func (*SliceStack) Marshal3MF

func (s *SliceStack) Marshal3MF(x spec.Encoder, _ *xml.StartElement) error

Marshal3MF encodes the resource.

func (SliceStack) XMLName added in v0.24.0

func (SliceStack) XMLName() xml.Name

XMLName returns the xml identifier of the resource.

type Spec

type Spec struct{}

func (Spec) NewAttrGroup added in v0.24.0

func (Spec) NewAttrGroup(parent xml.Name) spec.AttrGroup

func (Spec) NewElementDecoder added in v0.24.0

func (Spec) NewElementDecoder(name xml.Name) spec.GetterElementDecoder

func (Spec) Validate

func (Spec) Validate(model interface{}, path string, e interface{}) error

type Vertices added in v0.24.0

type Vertices struct {
	Vertex []go3mf.Point2D
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL