Small fix in DXF/DWG Importer
This commit is contained in:
parent
2ec01ffc77
commit
9bcfcc3f47
@ -23,6 +23,7 @@
|
|||||||
<option value="px">px</option>
|
<option value="px">px</option>
|
||||||
</param>
|
</param>
|
||||||
<param name="inputfile" type="path" gui-text="Import File (*.dxf, .dwg)" gui-description="Full path to your file, e.g. 'C:\Users\Username\Documents\myimage.jpg'" filetypes="dxf,dwg" mode="file">C:\Users\</param>
|
<param name="inputfile" type="path" gui-text="Import File (*.dxf, .dwg)" gui-description="Full path to your file, e.g. 'C:\Users\Username\Documents\myimage.jpg'" filetypes="dxf,dwg" mode="file">C:\Users\</param>
|
||||||
|
<param name="opendironerror" type="bool" gui-text="Open containing output directory on conversion errors">true</param>
|
||||||
<spacer/>
|
<spacer/>
|
||||||
<label appearance="header">About</label>
|
<label appearance="header">About</label>
|
||||||
<separator/>
|
<separator/>
|
||||||
@ -148,7 +149,6 @@
|
|||||||
<label appearance="header">sk1 UniConvertor 1.1.X</label>
|
<label appearance="header">sk1 UniConvertor 1.1.X</label>
|
||||||
<separator/>
|
<separator/>
|
||||||
<param name="sk1_uniconverter" type="path" gui-text="uniconvertor executable" gui-description="Full path to 'uniconvertor' executable" filetypes="cmd" mode="file">C:\Program Files (x86)\sK1 Project\UniConvertor-1.1.6\uniconvertor.cmd</param>
|
<param name="sk1_uniconverter" type="path" gui-text="uniconvertor executable" gui-description="Full path to 'uniconvertor' executable" filetypes="cmd" mode="file">C:\Program Files (x86)\sK1 Project\UniConvertor-1.1.6\uniconvertor.cmd</param>
|
||||||
<param name="opendironerror" type="bool" gui-text="Open containing output directory on conversion errors">true</param>
|
|
||||||
</page>
|
</page>
|
||||||
</param>
|
</param>
|
||||||
<effect needs-live-preview="true">
|
<effect needs-live-preview="true">
|
||||||
|
@ -110,7 +110,11 @@ class DXFDWGImport(inkex.Effect):
|
|||||||
self.arg_parser.add_argument("--UNDERLAY", type=inkex.Boolean, default=True)
|
self.arg_parser.add_argument("--UNDERLAY", type=inkex.Boolean, default=True)
|
||||||
self.arg_parser.add_argument("--XLINE", type=inkex.Boolean, default=True)
|
self.arg_parser.add_argument("--XLINE", type=inkex.Boolean, default=True)
|
||||||
|
|
||||||
|
def openExplorer(self, temp_output_dir):
|
||||||
|
if os.name == 'nt':
|
||||||
|
subprocess.Popen(["explorer",temp_output_dir],close_fds=True)
|
||||||
|
else:
|
||||||
|
subprocess.Popen(["xdg-open",temp_output_dir],close_fds=True)
|
||||||
|
|
||||||
def effect(self):
|
def effect(self):
|
||||||
#get input file and copy it to some new temporary directory
|
#get input file and copy it to some new temporary directory
|
||||||
@ -270,7 +274,7 @@ class DXFDWGImport(inkex.Effect):
|
|||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
inkex.errormsg("UniConverter failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
inkex.errormsg("UniConverter failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
if self.options.opendironerror:
|
if self.options.opendironerror:
|
||||||
subprocess.Popen(["explorer",temp_output_dir],close_fds=True)
|
self.openExplorer(temp_output_dir)
|
||||||
|
|
||||||
elif self.options.dxf_to_svg_parser == "bjnortier":
|
elif self.options.dxf_to_svg_parser == "bjnortier":
|
||||||
if which("node") is None:
|
if which("node") is None:
|
||||||
@ -284,7 +288,7 @@ class DXFDWGImport(inkex.Effect):
|
|||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
inkex.errormsg("node.js DXF to SVG conversion failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
inkex.errormsg("node.js DXF to SVG conversion failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
if self.options.opendironerror:
|
if self.options.opendironerror:
|
||||||
subprocess.Popen(["explorer",temp_output_dir],close_fds=True)
|
self.openExplorer(temp_output_dir)
|
||||||
|
|
||||||
elif self.options.dxf_to_svg_parser == "kabeja":
|
elif self.options.dxf_to_svg_parser == "kabeja":
|
||||||
wd = os.path.join(os.getcwd(), "kabeja")
|
wd = os.path.join(os.getcwd(), "kabeja")
|
||||||
@ -293,6 +297,8 @@ class DXFDWGImport(inkex.Effect):
|
|||||||
stdout, stderr = proc.communicate()
|
stdout, stderr = proc.communicate()
|
||||||
if proc.returncode != 0:
|
if proc.returncode != 0:
|
||||||
inkex.errormsg("kabeja failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
inkex.errormsg("kabeja failed: %d %s %s" % (proc.returncode, stdout, stderr))
|
||||||
|
if self.options.opendironerror:
|
||||||
|
self.openExplorer(temp_output_dir)
|
||||||
|
|
||||||
elif self.options.dxf_to_svg_parser == "ezdxf":
|
elif self.options.dxf_to_svg_parser == "ezdxf":
|
||||||
doc = ezdxf.readfile(dxf_file)
|
doc = ezdxf.readfile(dxf_file)
|
||||||
|
Reference in New Issue
Block a user