Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

vl-catch-all-apply and command

143 views
Skip to first unread message

Philippe

unread,
Mar 2, 2003, 9:20:02 AM3/2/03
to

Hi all
I would like to trap errors while using the "offset" command, but I
think I don't understand how vl-catch-all-apply works. I use this:
(vl-catch-all-apply 'command (list "_offset" offset_value
entitie_to_offset side ""))
I want to know if the command worked or if the entitie can't be
offseted.
I've read past discussions about this, but still don't understand...can
anyone help ?
Thanks
Philippe

Philippe

unread,
Mar 2, 2003, 9:20:27 AM3/2/03
to

Mark Propst

unread,
Mar 2, 2003, 2:19:49 PM3/2/03
to
Philippe,

I don't know if there's anything different while using "command"(i've only
used it with functions)
but my understanding of the general way to use vl-catch is as follows:

set a variable to the return value of catch-all-apply
(setq thisVar (vl-catch-all-apply 'your attempted function ))

then check the variable to see if it's an error object

(if (vl-catch-all-error-p thisVar)
; if it's an error, do something, maybe priint the error msg?
(princ "Exception: " (vl-catch-all-error-message thisVar))
;else it's not an error so do something else
...whatever
);end if

hth
Mark


John Uhden

unread,
Mar 2, 2003, 4:10:45 PM3/2/03
to
Tony will correct me if I'm way off base, but you won't have much luck
"catching" the (command) function because the arguments aren't AutoLisp
evaluations, but rather a sequence of responses just like a script.

Instead try studying up on the various ActiveX methods that are similar in
functionality to AutoCAD commands. In this case it would be the Offset method.
Make yourself a shortcut to the acad_dev.chm help file.

--
John Uhden, Cadlantic/formerly CADvantage
http://www.cadlantic.com
Sea Girt, NJ


"Philippe" <eas...@free.fr> wrote in message news:3E621311...@free.fr...

Philippe

unread,
Mar 2, 2003, 4:48:11 PM3/2/03
to
Thanks all, I'll try John solution
Philippe

John Uhden a écrit :

--
Delicad - Sharewares et Freewares en français pour AutoCAD.
http://easycad.free.fr


Marc'Antonio Alessi

unread,
Mar 3, 2003, 3:29:38 AM3/3/03
to
Not tested:
(vl-catch-all-apply
'(lambda ()
(command "_.OFFSET" offset_value entitie_to_offset "" side "")
)
)

Tested:
(vl-catch-all-apply '(lambda () (command "_.ARC" "" pause)))


--
________________________________________________

Marc'Antonio Alessi (TV) Italy - maal...@tin.it
(strcat "NOT a " (substr (ver) (if (= 15
(atoi (getvar "acadver"))) 8 5) 4) " guru.")

O.S. = XP Pro 2002 - Sp.1 - Ita
AutoCAD = 2002 Ita - Sp.1
_VERNUM = "K.0.44"
ACADVER = "15.06s (LMS Tech)"
(ver) = "Visual LISP 2000 (it)"
________________________________________________

"Philippe" <eas...@free.fr> ha scritto nel messaggio
news:3E621311...@free.fr...

Philippe

unread,
Mar 3, 2003, 8:30:34 AM3/3/03
to
Hi Marc
Tried your function, but the value returned by vl-catch-all-apply is not an
error message readable with vl-catch-all-error-message , so it works like
there's no error trapping. It returns nil or "entitie can not be offseted".
thanks anyway, I keep on searching
Philippe

Marc'Antonio Alessi a écrit :

--

Richard Paupy

unread,
Mar 3, 2003, 10:33:58 AM3/3/03
to


Philippe wrote:
>
> Hi all
> I would like to trap errors while using the "offset" command, but I
> think I don't understand how vl-catch-all-apply works. I use this:
> (vl-catch-all-apply 'command (list "_offset" offset_value
> entitie_to_offset side ""))
> I want to know if the command worked or if the entitie can't be
> offseted.

Et pourquoi tu passes pas par :
(if (vlax-method-applicable-p (vlax-ename->vla-object
entitie_to_offset)'Offset)
(vlax-invoke-method (vlax-ename->vla-object entitie_to_offset)
'Offset unpoint))
pour tester si l'objet et offsettable. A moins que tu veuille surveiller
les appels à Offset??

Richard

Philippe

unread,
Mar 3, 2003, 11:03:19 AM3/3/03
to
Merci Richard,
Je sais déja si l'entité est décalable ou pas, le problème c'est que je veux
savoir si le décalage produit une nouvelle entité ou une erreur (décaler un
arc de rayon 2 vers l'intérieur avec un offset de 3 = erreur!), et là je
sèche...

Richard Paupy a écrit :

--

Richard Paupy

unread,
Mar 3, 2003, 11:38:30 AM3/3/03
to
Bon, au vu des réponses déja données, il reste le bricolage : la combine
que je ferai, c'est avant d'appeler la commande de regarder la dernière
entité créée (entlast) et juste après idem et puis comparer. Si
identique alors erreur...Pas transandant qd même....Bonne soirée.

Philippe

unread,
Mar 3, 2003, 1:15:07 PM3/3/03
to
Pas con ça...j'essaye.
Merci

Richard Paupy a écrit :

Philippe

unread,
Mar 3, 2003, 4:55:04 PM3/3/03
to
Impeccable, le seul truc qui me gêne...c'est de ne pas y avoir pensé tout seul..
Merci
Philippe

Philippe a écrit :

Richard Paupy

unread,
Mar 4, 2003, 5:00:33 AM3/4/03
to

Philippe wrote:
> Impeccable, le seul truc qui me gêne...c'est de ne pas y avoir pensé tout seul..

Tout seul, pas d'humanité possible....;-)
> Merci
You're welcome.
> Philippe
>

>

Tony Tanzillo

unread,
Mar 8, 2003, 5:51:16 PM3/8/03
to
It's probably an oversight that Autodesk didn't define
an ERRNO for this, but the rejection of entities by
the OFFSET command doesn't result in a LISP error, so
(vl-catch-all-apply) doesn't work.

Generally, you would have to capture (entlast) before
and after the call to (command), and compare them using
the (eq) function to see if the offset succeeded or not.

"Philippe" <eas...@free.fr> wrote in message news:3E6358FA...@free.fr...

0 new messages