<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
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>
<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>