As I am using LT 2024, have limited programming skills and need to open and close a number of files I am trying to use a script (.scr) file not a lisp or VBA. The script below does some basic cleaning of files exported from GIS and saves the DXFs as DWGs but I would like this to use relative paths (relative to the working file) so I can avoid changing the paths for each project. Is there a way in can set the paths based on the current open file?
_.open "T:\DXF output\Canopies and Boles.dxf" _.Zoom E _.PURGE all * N _.save LT2018 "T:\DXF output\Canopies and Boles.dwg" Y _.close _.open "T:\DXF output\LabelLines.dxf" _.Zoom E _.PURGE all * N _.save LT2018 "T:\DXF output\LabelLines.dwg" Y _.close _.open "T:\DXF output\LabelText.dxf" _.Zoom E _.PURGE all * N _.save LT2018 "T:\DXF output\LabelText.dwg" Y _.close _.open "T:\DXF output\LabelWhiteOuts.dxf" _.Zoom E _.PURGE all * N _.save LT2018 "T:\DXF output\LabelWhiteOuts.dwg" Y _.close _.open "T:\DXF output\RPAs.dxf" _.Zoom E _.PURGE all * N _.save LT2018 "T:\DXF output\RPAs.dwg" Y _.close _.open "T:\DXF output\Tree Markers.dxf" _.Zoom E _.PURGE all * N _.save LT2018 "T:\DXF output\Tree Markers.dwg" Y _.close _.open "T:\DXF output\Zones Boles Canopies.dxf" _.Zoom E _.PURGE all * N _.save LT2018 "T:\DXF output\Zones Boles Canopies.dwg" Y _.close
I tried lisps and VBA but lisps would need to be nested inside a script and VBA isn't available on LT 2024.
You can use the AutoLISP strcat
function to concatenate your filenames with the current drawing path by referencing the value of the DWGPREFIX
system variable, which will return the path of the current drawing (with a trailing path delimiter), e.g.:
(strcat (getvar 'dwgprefix) "Canopies and Boles.dxf")