How do I delete a named view without closing, then reopening a custom DCL dialog box?
This is the command equivalent: (command "-VIEW" "Delete" "View01").
I can supply the view name and will send to a subroutine as shown below.
Remove one at a time:
(EVC_Remove "View01")
and
Remove all of them:
(EVC_Remove "*")
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
Solved! Go to Solution.
Solved by Lee_Mac. Go to Solution.
Something as simple as this [minimally tested]:
(defun EVC_Remove (viewname)
(command "_.view" "_delete" viewname)
(princ)
)
Add something like this [untested] if you like:
(prompt
(strcat
"\n"
(if (= viewname "*") "All named Views" (strcat "View " viewname))
" deleted."
); strcat
); prompt
@KenT: As far as I'm aware, you cannot evaluate an AutoCAD command whilst a modal dialog is active, as the user has indicated:
@scot-65 wrote:How do I delete a named view without closing, then reopening a custom DCL dialog box?
The following is untested, but may be suitable:
(defun evc_remove ( view / lst ) (vlax-for v (vla-get-views (vla-get-activedocument (vlax-get-acad-object))) (if (wcmatch (strcase (vla-get-name v)) view) (setq lst (cons v lst)) ) ) (and lst (not (apply 'or (mapcar '(lambda ( x ) (vl-catch-all-error-p (vl-catch-all-apply 'vla-delete (list x)) ) ) lst ) ) ) ) )
Call the function with a case-insensitive view name, or wildcard pattern, e.g.:
(evc_remove "myview") (evc_remove "*")
The function will then return T if all matching views are successfully deleted, else nil if one or more views could not be deleted for whatever reason, or if no matching views are found.
Lee
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.