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")


'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.




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/

Qgis-user mailing list
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to