Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I have a lisp that prompts the user for information based on which it selects an available layer and sets it as current. Then it selects all its elements and saves it to a new file with the _wblock command.
The problem is the _wblock command in the last two lines of code, because after running Lisp in AC it stops at the "specify base point" place and after clicking manually (which is not wanted, because the point is indifferent), everything works, but it does not execute the last _OOPS command.
Could anyone tell me what is wrong here? Thank you in advance for all your tips.
my code
<code>
(defun c:foo (/ s1 s2 i)
(setq obszar (getstring "Podaj obszar do exportu: "))
(initget "poprzeczNe Podluzne")
(setq rodzaj (getkword "[poprzeczNe/Podluzne]/<Podluzne>: "))
(setq warstwa_pracy (strcat obszar "_" rodzaj))
(alert warstwa_pracy)
(if (not (tblsearch "layer" warstwa_pracy))
(progn
(alert "NIE MA TAKIEJ WARSTWY W BAZIE")
(exit))
)
(setvar "clayer" warstwa_pracy)
(setq myFile (browseforfolder "Select a folder" "C:" 0) )
;(alert myfile)
(if (findfile (setq dwg (strcat myfile "\\" warstwa_pracy ".dwg" )))
(progn
(vl-file-delete dwg)
)
)
(setq XN 0)
(setq YN 0)
(setq N (list XN YN ))
(sssetfirst nil (ssget "X" (list (cons 8 (getvar "clayer")))))
(command "._wblock" dwg "" "0,0,0" )
(command "_OOPS" )
(princ)
)
(defun browseforfolder ( msg dir bit / err fld pth shl slf )
(setq err
(vl-catch-all-apply
(function
(lambda ( / app hwd )
(if (setq app (vlax-get-acad-object)
shl (vla-getinterfaceobject app "shell.application")
hwd (vl-catch-all-apply 'vla-get-hwnd (list app))
fld (vlax-invoke-method shl 'browseforfolder (if (vl-catch-all-error-p hwd) 0 hwd) msg bit dir)
)
(setq slf (vlax-get-property fld 'self)
pth (vlax-get-property slf 'path)
pth (vl-string-right-trim "\\" (vl-string-translate "/" "\\" pth))
)
)
)
)
)
)
(if slf (vlax-release-object slf))
(if fld (vlax-release-object fld))
(if shl (vlax-release-object shl))
(if (vl-catch-all-error-p err)
(prompt (vl-catch-all-error-message err))
pth
)
)
<code/>
Solved! Go to Solution.