kompas

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2023 License: MIT Imports: 3 Imported by: 0

README

Kompas 3D files Reader

Package to read specifications data from the Kompas files.

Usage

Add library to project:

go get github.com/kukymbr/kompas

Import packages and read Kompas file:

package main

import (
	"fmt"

	"github.com/kukymbr/kompas"
	"github.com/kukymbr/kompas/kompasconv"
)

func main() {
	var doc *kompas.Document
	var err error
	
	filepath := "testdata/example.spw"

	reader, err := kompasconv.NewReader(filepath)
	if err != nil {
		panic(err)
	}

	doc, err = reader.Read()
	if err != nil {
		panic(err)
	}
	
	fmt.Println(doc.FileInfo.Author)
}

Documentation

Index

Constants

View Source
const (
	// FileTypeSpw is an .spw file type
	FileTypeSpw = FileType(5)
)

Variables

View Source
var (
	ErrInvalidFilePath = errors.New("kompas file path is not valid")
	ErrInvalidFileType = errors.New("unknown or disabled kompas file type given")
)

Package errors

Functions

This section is empty.

Types

type Document

type Document struct {
	FileInfo *FileInfo
	MetaInfo *MetaInfo
}

Document is a processed Kompas file data

type FileInfo

type FileInfo struct {
	Author     string
	Comment    string
	FileType   FileType
	AppVersion version.Version
	CreatedAt  time.Time
	UpdatedAt  time.Time
}

FileInfo is a data from the Kompas' FileInfo ini file

type FileType

type FileType int

FileType is a Kompas 3d file type

func NewFileType

func NewFileType(typeCode int) (filetype FileType, err error)

NewFileType creates new FileType if typeCode is valid

func (FileType) IsValid

func (t FileType) IsValid() bool

IsValid checks if file type is valid and enabled

type MetaInfo

type MetaInfo struct {
	SpcStructSections SpcStructSections
}

MetaInfo is a parsed content of the Kompas' MetaInfo file

type SpcObject

type SpcObject struct {
	ID                string `example:"374729415333.000000"`
	Text              string `example:"УПИГ-01.000-32  Рама"`
	Columns           []*SpcObjectColumn
	AdditionalColumns []*SpcObjectColumn
}

type SpcObjectColumn

type SpcObjectColumn struct {
	Name     string `example:"Наименование"`
	TypeName string `example:"name"`
	Value    string `example:"Рама"`
}

type SpcStructSection

type SpcStructSection struct {
	Name    string `example:"Сборочные единицы"`
	Objects []*SpcObject
}

SpcStructSection is a one section of the SpcStructSections

type SpcStructSections

type SpcStructSections []*SpcStructSection

SpcStructSections is a parsed struct of the spcStruct part of the Kompas' xml

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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