[Qgis-user] QGIS Actions
Richard McDonnell
richard.mcdonnell at opw.ie
Fri Jan 6 02:08:38 PST 2017
Morning,
Just a progress report!
Ive found another way of doing it, but it causes QGIS to hang (become
unresponsive) for about 2mins
import subprocess
subprocess.call(['C:/Program Files/Autodesk/AutoCAD 2015/acad.exe', '
"[% "root" %]itm/[% "subfolder" %][% "filename" %]" '])
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.
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.
Regards,
Richard.
On 05/01/2017 17:33, Richard McDonnell wrote:
> Hi all,
> I am trying to create a style for a Vector Index WFS (dxf's).
> 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.
> 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
>
> My working script is:
>
> qgis.utils.iface.addVectorLayer("[% "root" %]*itm/*[% "subfolder" %][%
> "filename" %]", "[% "sheet_no" %]","ogr")
>
> Where:
>
> 'root' = /////remotepc/////sharename/current
> /
> *itm/* = /relavent CRS folder///
>
> "subfolder" = /remaining sub-folders
> /
> "filename" = /File Name eg 1000.dxf
> /
> "sheet_no" = /File Name less file extension/
> So the resultant script is:
>
> qgis.utils.iface.addVectorLayer("/////remotepc///sharename/current//*itm/*///subfolder//
> /subfolder// /1000.dxf/", "1000", "ogr")
>
> This works perfectly!!
>
> 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.
>
> The drive is mapped to my PC, and if I replace the
> /////remotepc///sharename/ /with /z://\sharename\ /it will work.
>
> 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.
>
> I have a clunky Python work around and it is as follows:
>
> import os
>
> os.system(' "[% "root" %]itm/[% "subfolder" %][% "filename" %]" ')
>
>
>
> This works, but as I said its clunky opening a cmd window and not
> closing it. It does not work as well as /z://\sharename\/
> It is driving me mad, If someone can help point me in the correct
> direction, I would appreciate it greatly.
>
> Regards,
>
> Richard.
>
>
>
> // <http://www.opw.ie/>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
--
*_Richard McDonnell_*
*GIS Specialist PgD GIS AssocSCSI*
*OPW FRM Data Management*
*52 Stephens Green, Dublin 2.*
TEL: 01 6476543
OPW - Ag féachaint don am atá le teacht - Ag caomhnú ón am atá thart
OPW - Looking to the future - Caring for the past
***********************************************************
Email Disclaimer: http://www.opw.ie/en/disclaimer/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20170106/81be4584/attachment.html>
More information about the Qgis-user
mailing list