Jump to content

DXF import


Recommended Posts

I am trying create a script that automates the importing of a variety of files created by a QGIS script (DXF, SHP and some images). As I am new to scripting in VW (and not very good in general) I am trying to get started by importing a single DXF file. 

I have tried using vs.ImportSingleDXFDWG(pathtomyfile) but that just launches the import dialogue. The APi reference  doesn't provide many clues as to the arguments etc for the function or how it works so I don't really know where to start without going to square one  and start learning python properly. 

 

I am using a mac so I think there might be issues the the path format 

 

Link to comment

@Sloader ,

   From the function's description in the Script Reference there are no arguments, so you are not missing anything there. This function emulates the menu command Import Single DXF/DWG... There does not seem to be a command that will open DXF files without system dialogs opening.

 

Raymond

  • Like 1
Link to comment

Thanks for clarifying, maybe I need to look at the SDK.  

Not sure I really see the point in the function if all it does is launch the dialogue, that makes the process slower than dragging a dxf onto the page. 

 

 

Link to comment
  • 2 weeks later...

The call you're looking for is vs.ImportDXFDWGFile so your script could look like this:

isBatch = True
result = vs.ImportDXFDWGFile('C:\\155_01_237_1.dxf', isBatch)

vs.AlrtDialog('Result: {}'.format(result))

Setting isBatch to 'True' avoids annoying config dialogs. For macOS you should experiment with the path specifier I'm sure you have to use slashes but haven't tried it.

 

Warning: The online developer reference for this function is outdated, you should use the reference within the script editor accessed by the small clipboard with arrow button.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...