Small enhancements in slicer stl input
This commit is contained in:
parent
e053781ac7
commit
c5b169321f
@ -10,7 +10,7 @@
|
|||||||
<param name="inputfile" type="path" gui-text="Input file (OBJ/OFF/PLY/STL)" filetypes="obj,off,ply,stl" mode="file">/your/object/file.stl</param>
|
<param name="inputfile" type="path" gui-text="Input file (OBJ/OFF/PLY/STL)" filetypes="obj,off,ply,stl" mode="file">/your/object/file.stl</param>
|
||||||
<param name="max_num_faces" type="int" min="1" max="99999" gui-text="Maximum allowed faces" gui-description="If the STL file has too much detail it contains a large number of faces. This will make processing extremely slow. So we can limit it.">200</param>
|
<param name="max_num_faces" type="int" min="1" max="99999" gui-text="Maximum allowed faces" gui-description="If the STL file has too much detail it contains a large number of faces. This will make processing extremely slow. So we can limit it.">200</param>
|
||||||
<param name="layer_height" type="float" min="0.001" max="99999.000" precision="3" gui-text="Layer height [mm]">1.000</param>
|
<param name="layer_height" type="float" min="0.001" max="99999.000" precision="3" gui-text="Layer height [mm]">1.000</param>
|
||||||
<param name="layer_number" type="int" min="0" max="99999" gui-text="Specific layer number" gui-description="Set to 0 to import all numbers or set a number 1+ to import a specific layer.">0</param>
|
<param name="layer_number" type="int" min="-99999" max="99999" gui-text="Specific layer number" gui-description="Set to 0 to import all numbers or set a number + or - to import a specific layer. Negative values will invert (count backwards)">0</param>
|
||||||
<hbox>
|
<hbox>
|
||||||
<vbox>
|
<vbox>
|
||||||
<label appearance="header">Transforms</label>
|
<label appearance="header">Transforms</label>
|
||||||
|
@ -168,7 +168,7 @@ class SlicerSTLInput(inkex.EffectExtension):
|
|||||||
'--no-gui',
|
'--no-gui',
|
||||||
'--scale', str(scale),
|
'--scale', str(scale),
|
||||||
'--rotate-x', str(args.rx),
|
'--rotate-x', str(args.rx),
|
||||||
'--rotate-y', str(args.ry),
|
'--rotate-y', str(180+args.ry), #we import the style like PrusaSlicer would import on the plate
|
||||||
'--rotate', str(args.rz),
|
'--rotate', str(args.rz),
|
||||||
'--first-layer-height', '0.1mm',
|
'--first-layer-height', '0.1mm',
|
||||||
'--export-svg', '-o', svgfile, args.inputfile]
|
'--export-svg', '-o', svgfile, args.inputfile]
|
||||||
@ -338,11 +338,15 @@ class SlicerSTLInput(inkex.EffectExtension):
|
|||||||
#inkex.utils.debug("{0}: {1} polygons in {2} layers converted to paths.".format(svgfile, polygoncount, layercount))
|
#inkex.utils.debug("{0}: {1} polygons in {2} layers converted to paths.".format(svgfile, polygoncount, layercount))
|
||||||
|
|
||||||
if self.options.layer_number != 0:
|
if self.options.layer_number != 0:
|
||||||
for element in doc.xpath("//svg:g", namespaces=inkex.NSS):
|
groups = doc.xpath("//svg:g", namespaces=inkex.NSS)
|
||||||
|
for element in groups:
|
||||||
#for element in doc.getroot().iter("{http://www.w3.org/2000/svg}g"):
|
#for element in doc.getroot().iter("{http://www.w3.org/2000/svg}g"):
|
||||||
if element.get('id').split('stl-layer')[1] != str(self.options.layer_number):
|
if self.options.layer_number > 0:
|
||||||
element.getparent().remove(element) #element.delete() does not work. why?
|
if element.get('id').split('stl-layer')[1] != str(self.options.layer_number):
|
||||||
|
element.getparent().remove(element) #element.delete() does not work. why?
|
||||||
|
else:
|
||||||
|
if element.get('id').split('stl-layer')[1] != str(len(groups) + self.options.layer_number):
|
||||||
|
element.getparent().remove(element) #element.delete() does not work. why?
|
||||||
if layercount == 0:
|
if layercount == 0:
|
||||||
inkex.utils.debug("No layers imported. Try to lower your layer height")
|
inkex.utils.debug("No layers imported. Try to lower your layer height")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
Reference in New Issue
Block a user