Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
laser-gcode-exporter-inkscape-plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
laser-gcode-exporter-inkscape-plugin
Commits
40d201ca
Commit
40d201ca
authored
Mar 22, 2015
by
leonmuller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug for exporting groups of paths
parent
6fe1c3ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
turnkeylaser.py
turnkeylaser.py
+16
-8
No files found.
turnkeylaser.py
View file @
40d201ca
...
...
@@ -465,8 +465,6 @@ class Gcode_tools(inkex.Effect):
# del p[dist[1]]
# p = np[:]
#Vector path data, cut from x to y in a line or curve
inkex
.
errormsg
(
"Building gcode for "
+
path
[
'type'
]
+
" type object."
)
if
(
path
[
'type'
]
==
"vector"
)
:
lst
=
{}
...
...
@@ -604,7 +602,7 @@ class Gcode_tools(inkex.Effect):
#R = 1 / dots per mm
#90dpi = 1 / (90 / 25.4)
gcode
+=
'
\n\n
;Beginning of Raster Image '
+
str
(
curve
[
'id'
])
+
' pixel size: '
+
str
(
curve
[
'width'
])
+
'x'
+
str
(
curve
[
'height'
])
+
'
\n
'
gcode
+=
'M649 S'
+
str
(
laserPower
)
+
' B2 D0 R0.
2822
\n
'
gcode
+=
'M649 S'
+
str
(
laserPower
)
+
' B2 D0 R0.
09406
\n
'
gcode
+=
'G28
\n
'
#Do not remove these two lines, they're important. Will not raster correctly if feedrate is not set prior.
...
...
@@ -639,6 +637,7 @@ class Gcode_tools(inkex.Effect):
return
end
first
=
True
#Flip the image top to bottom
row
=
curve
[
'data'
][::
-
1
]
previousRight
=
99999999999
...
...
@@ -879,7 +878,8 @@ class Gcode_tools(inkex.Effect):
# This node is a group of other nodes
pathsGroup
=
[]
for
child
in
node
.
iterchildren
():
pathsGroup
+=
compile_paths
(
child
,
trans
)
data
=
compile_paths
(
child
,
trans
)
pathsGroup
.
append
(
data
.
copy
())
return
pathsGroup
elif
node
.
tag
==
SVG_IMAGE_TAG
:
#inkex.errormsg( )
...
...
@@ -905,12 +905,12 @@ class Gcode_tools(inkex.Effect):
imageDataWidth
,
imageDataheight
=
img
.
size
#Resize to match the dimensions in Inkscape
im_resized
=
img
.
resize
((
inkscapeWidth
,
inkscapeHeight
),
Image
.
ANTIALIAS
)
im_resized
=
img
.
resize
((
inkscapeWidth
*
3
,
inkscapeHeight
*
3
),
Image
.
ANTIALIAS
)
#Resize the image here for highter DPI - say 300dpi
#Compile the pixels.
pixels
=
list
(
im_resized
.
getdata
())
pixels
=
[
pixels
[
i
*
inkscapeWidth
:(
i
+
1
)
*
inkscapeWidth
]
for
i
in
xrange
(
inkscapeHeight
)]
pixels
=
[
pixels
[
i
*
(
inkscapeWidth
*
3
):(
i
+
1
)
*
(
inkscapeWidth
*
3
)]
for
i
in
xrange
(
inkscapeHeight
*
3
)]
path
[
'type'
]
=
"raster"
path
[
'width'
]
=
inkscapeWidth
...
...
@@ -975,9 +975,17 @@ class Gcode_tools(inkex.Effect):
for
node
in
layer
.
iterchildren
():
if
(
node
in
selected
):
#Vector path data, cut from x to y in a line or curve
inkex
.
errormsg
(
"Building gcode for "
+
str
(
node
.
tag
)
+
" object."
)
logger
.
write
(
"node
%
s"
%
str
(
node
.
tag
))
selected
.
remove
(
node
)
pathList
.
append
(
compile_paths
(
node
,
trans
)
.
copy
())
selected
.
remove
(
node
)
try
:
pathList
.
append
(
compile_paths
(
node
,
trans
)
.
copy
())
except
:
for
objectData
in
compile_paths
(
node
,
trans
):
pathList
.
append
(
objectData
)
else
:
logger
.
write
(
"skipping node
%
s"
%
node
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment