<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Morning,<br>
Just a progress report!<br>
Ive found another way of doing it, but it causes QGIS to hang
(become unresponsive) for about 2mins<br>
<br>
import subprocess
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">subprocess.call(['C:/Program
Files/Autodesk/AutoCAD 2015/acad.exe', ' "[% "root" %]itm/[%
"subfolder" %][% "filename" %]" '])<br>
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br>
Its cleaner than the clunky option, but what I am doing that's
causing QGIS to hang, well after the file has opened in the CAD
program.<br>
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">The above
is not an ideal solution either, as it uses a direct link to
AutoCad, as opposed to using the system default program like the
Open Action does.<br>
</p>
<br>
Regards,<br>
<br>
Richard.<br>
<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 05/01/2017 17:33, Richard McDonnell
wrote:<br>
</div>
<blockquote cite="mid:586E834E.1070500@opw.ie" type="cite">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
Hi all,<br>
I am trying to create a style for a Vector Index WFS (dxf's).<br>
The Idea is that it can be used within QGIS to both load the
vector data directly into QGIS and also to open it in AutoCAD, if
required.<br>
I have a working action which loads the dxf into QGIS, but I am
running into issues relating to file paths and windows when I try
to have it open the file in AutoCAD<br>
<br>
My working script is:<br>
<br>
qgis.utils.iface.addVectorLayer("[% "root" %]<font color="#000099"><b>itm/</b></font>[%
"subfolder" %][% "filename" %]", "[% "sheet_no" %]","ogr")<br>
<br>
Where:<br>
<br>
'root' = <span style="color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 27px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; display: inline !important;
float: none; background-color: rgb(255, 255, 255);"><em>//</em></span><em
style="margin: 0px; padding: 0px; word-wrap: break-word; color:
rgb(17, 17, 17); font-family: Georgia, 'Times New Roman', Times,
serif; font-size: 16px; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: 27px; orphans:
auto; text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);">remotepc</em><span style="color: rgb(17, 17, 17);
font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 16px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: 27px;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: 1;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display:
inline !important; float: none; background-color: rgb(255, 255,
255);"><em>/</em></span><em style="margin: 0px; padding: 0px;
word-wrap: break-word; color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">sharename/current<br>
</em><br>
<font color="#000099"><b>itm/</b></font> = <span style="color:
rgb(17, 17, 17); font-family: Georgia, 'Times New Roman', Times,
serif; font-size: 16px; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><em>relavent CRS folder</em></span><em
style="margin: 0px; padding: 0px; word-wrap: break-word; color:
rgb(17, 17, 17); font-family: Georgia, 'Times New Roman', Times,
serif; font-size: 16px; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: 27px; orphans:
auto; text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);"></em><br>
<br>
"subfolder" = <span style="color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 27px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; display: inline !important;
float: none; background-color: rgb(255, 255, 255);"><em>remaining
sub-folders<br>
</em></span><br>
"filename" = <span style="color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 27px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; display: inline !important;
float: none; background-color: rgb(255, 255, 255);"><em>File
Name eg 1000.dxf<br>
</em></span><br>
"sheet_no" = <span style="color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 27px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; display: inline !important;
float: none; background-color: rgb(255, 255, 255);"><em>File
Name less file extension</em></span><br>
So the resultant script is:<br>
<br>
qgis.utils.iface.addVectorLayer("<span style="color: rgb(17, 17,
17); font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 16px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: 27px;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: 1;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display:
inline !important; float: none; background-color: rgb(255, 255,
255);"><em>//</em></span><em style="margin: 0px; padding: 0px;
word-wrap: break-word; color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">remotepc</em><span
style="color: rgb(17, 17, 17); font-family: Georgia, 'Times New
Roman', Times, serif; font-size: 16px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);">/</span><em style="margin: 0px; padding:
0px; word-wrap: break-word; color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">sharename/current/</em><font
color="#000099"><b>itm/</b></font><em style="margin: 0px;
padding: 0px; word-wrap: break-word; color: rgb(17, 17, 17);
font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 16px; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 27px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);"></em><span style="color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-style: normal; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 27px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; display: inline !important;
float: none; background-color: rgb(255, 255, 255);"></span><em
style="margin: 0px; padding: 0px; word-wrap: break-word; color:
rgb(17, 17, 17); font-family: Georgia, 'Times New Roman', Times,
serif; font-size: 16px; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: 27px; orphans:
auto; text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);">subfolder/</em> <em style="margin: 0px; padding: 0px;
word-wrap: break-word; color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">subfolder/</em> <span
style="color: rgb(17, 17, 17); font-family: Georgia, 'Times New
Roman', Times, serif; font-size: 16px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><em>1000.dxf</em></span>", "1000", "ogr")<br>
<br>
This works perfectly!!<br>
<br>
Now if I use the same attributes in the standard Open Actions, It
fails (nothing happens), if I use the standard Windows or Generic
Action, I get an error stating it cant find the file.<br>
<br>
The drive is mapped to my PC, and if I replace the <span
style="color: rgb(17, 17, 17); font-family: Georgia, 'Times New
Roman', Times, serif; font-size: 16px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><em>//</em></span><em style="margin: 0px;
padding: 0px; word-wrap: break-word; color: rgb(17, 17, 17);
font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 16px; font-variant: normal; font-weight: normal;
letter-spacing: normal; line-height: 27px; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);">remotepc</em><span style="color: rgb(17, 17, 17);
font-family: Georgia, 'Times New Roman', Times, serif;
font-size: 16px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: 27px;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: 1;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display:
inline !important; float: none; background-color: rgb(255, 255,
255);">/</span><em style="margin: 0px; padding: 0px; word-wrap:
break-word; color: rgb(17, 17, 17); font-family: Georgia, 'Times
New Roman', Times, serif; font-size: 16px; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: 27px;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: 1;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">sharename/ </em>with <span
style="color: rgb(17, 17, 17); font-family: Georgia, 'Times New
Roman', Times, serif; font-size: 16px; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><em>z:</em></span><span style="color:
rgb(17, 17, 17); font-family: Georgia, 'Times New Roman', Times,
serif; font-size: 16px; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"></span><em style="margin: 0px; padding:
0px; word-wrap: break-word; color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">\sharename\ </em>it will
work.<br>
<br>
Due to the fact that not everyone will have this drive mapped, and
even those that do, don't necessarily have it mapped to Z you can
understand why I cant use this.<br>
<br>
I have a clunky Python work around and it is as follows:<br>
<br>
import os
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">os.system('
"[% "root" %]itm/[% "subfolder" %][% "filename" %]" ')<br>
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br>
</p>
<br>
This works, but as I said its clunky opening a cmd window and not
closing it. It does not work as well as <span style="color:
rgb(17, 17, 17); font-family: Georgia, 'Times New Roman', Times,
serif; font-size: 16px; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"><em>z:</em></span><span style="color:
rgb(17, 17, 17); font-family: Georgia, 'Times New Roman', Times,
serif; font-size: 16px; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal;
line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
display: inline !important; float: none; background-color:
rgb(255, 255, 255);"></span><em style="margin: 0px; padding:
0px; word-wrap: break-word; color: rgb(17, 17, 17); font-family:
Georgia, 'Times New Roman', Times, serif; font-size: 16px;
font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 27px; orphans: auto; text-align: start;
text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);">\sharename\</em><br>
It is driving me mad, If someone can help point me in the correct
direction, I would appreciate it greatly.<br>
<br>
Regards,<br>
<br>
Richard.<br>
<br>
<br>
<br>
<em style="margin: 0px; padding: 0px; word-wrap: break-word;
color: rgb(17, 17, 17); font-family: Georgia, 'Times New Roman',
Times, serif; font-size: 16px; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: 27px;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: 1;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255);"></em> <a
moz-do-not-send="true" href="http://www.opw.ie/"><img
moz-do-not-send="true"
src="http://www.opw.ie/en/media/opw-logo-december-2016.gif"
height="225" width="405"></a>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Qgis-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a></pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<b><u>Richard McDonnell</u></b><br>
<b><small><small><small>GIS Specialist PgD GIS AssocSCSI</small></small></small></b><br>
<b><small>OPW FRM Data Management</small></b><br>
<b><small>52 Stephens Green, Dublin 2.</small></b><br>
<small><small>TEL: 01 6476543</small></small></div>
<p></p>
<a href="http://www.opw.ie/"><img src="http://www.opw.ie/en/media/opw-logo-december-2016.gif" width="405" height="225" /></a>
</body>
</html>