1) --Somehow, I need to pass the path and name after the "Dxfout" command. Is this the right way to go about it? What I am getting saved is DxfName.dxf, but i want "Dxfname" to change depending on what i gave as "code" (codes are layer names in the main drawing and each layer will be saved as a separate dxf file after being queried from the main drawing)
(setq DxfName (strcat "C:\\Data\\DXF\\"Code".dxf"))
(command "dxfout" DxfName "")
Its part of the script below.
(defun C:SMQ ( / seam dwg ade_tmpprefval dwg_id Cat1 Cat2 Cat3 Cat4 DxfName)
(setvar "cmddia" 0)
(setvar "cmdecho" 0)
(setvar "Filedia" 0)
(command "-osnap" "end" "")
(command "mapoptions" "q" "N" "N" "N" "N" "N" "N" "N" "a" "i" "i" "red" "red" "N" "x")
(setq code (getstring "\nEnter code: "))
(setq dwg "C:\\Data\\DFX\\Main_Code.dwg")
(mapcar 'ade_dwgdeactivate (ade_dslist))
(setq ade_tmpprefval (ade_prefgetval "ActivateDwgsOnAttach"))
(ade_prefsetval "ActivateDwgsOnAttach" T)
(setq dwg_id(ade_dsattach dwg))
(ade_prefsetval "ActivateDwgsOnAttach" ade_tmpprefval)
(ade_qryclear)
(setq Cat1 (strcat ""code"_Cat1"))
(setq Cat2 (strcat ""code"_Cat2"))
(setq Cat3 (strcat ""code"_Cat3"))
(setq Cat4 (strcat ""code"_Cat4"))
(command "adequery" "c" "d" "P" "la" Cat1 "x" "E" "d")
(command "adequery" "c" "d" "P" "la" Cat2 "x" "E" "d")
(command "adequery" "c" "d" "P" "la" Cat3 "x" "E" "d")
(command "adequery" "c" "d" "P" "la" Cat4 "x" "E" "d")
(command "-layer" "THAW" "*" "")
;============================================
(setq DxfName (strcat "C:\\Data\\DXF\\"code".dxf"))
(command "dxfout" DxfName "")
;============================================
(command "zoom" "extents" )
(command "-layer" "unlock" "*" "")
(mapcar 'ade_dsdetach (ade_dslist))
(command "erase" "all" "")
(command "purge" "all" "" "n")
(setvar "cmddia" 1)
(setvar "cmdecho" 1)
(setvar "Filedia" 1)
(princ)
)