File: gpx.py

package info (click to toggle)
gpx 2.6.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,556 kB
  • sloc: ansic: 10,975; sh: 4,724; python: 436; makefile: 119
file content (27 lines) | stat: -rwxr-xr-x 698 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Name: GPX
#Info: GCode to x3g conversion post processor
#Help: GPX
#Depend: GCode
#Type: postprocess
#Param: gpxPath(str:/Applications/GPX) GPX path
#Param: flags(str:-m r2) Flags

import platform
import os
from Cura.util import profile
from subprocess import call

def getGpxAppName():
	if platform.system() == 'Windows':
		if os.path.exists(gpxPath + '/gpx.exe'):
			return gpxPath + '/gpx.exe'
		return gpxPath + 'gpx.exe'
	if os.path.isfile(gpxPath + '/gpx'):
		return gpxPath + '/gpx'
	return gpxPath + 'gpx'

x3gFile = profile.getPreference('lastFile')
x3gFile = x3gFile[0:x3gFile.rfind('.')] + '.x3g'

commandList = [getGpxAppName(), '-p', '-r', flags, filename, x3gFile]
call(commandList)