Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

It's either "all" or "nothing"

23 REPLIES 23
Reply
Message 1 of 24
Anonymous
398 Views, 23 Replies

It's either "all" or "nothing"

Well, it's Monday, so let's start with a deep bug to waken up the old brain
cells...

It seems I'm caught like a squirrel on a road with a car coming in either
direction. Due to the large amount of customization I have done over the
years, I have far too much code to port fully to VBA or even full VL ActiveX
support in a brief period of time. So I do what any good programmer would
do, identify core subroutines that that can be improved by either VBA or
(vla-) functions.

Until...

This last week I switched my setvars/getvars to ActiveX (on my test bed) to
see if that stabilized AutoCAD any, as I was using ActiveX in much of my
core already. And it seemed to help. But just as I was getting ready to roll
that out, I ran a program (not just a core subr) that switches from model to
paperspace. In this program, I am still using (setvar). This program is used
to convert a R14 drawing to TuTu, so the users would run it upon opening a
drawing. And the 'cotton-pickin' stupid program crashed, never getting to
paperspace via (setvar "TileMode" 0). "What the...", I muttered, as it _had_
worked for weeks. Well, after 12 hours of debugging, I was able to replicate
the problem.

There's something funky (and it ain't my socks) in AutoCAD's interpretive
processes. Here is the outline of the bug:
#1 Use (vla-SetVariable) in (S::StartUp)
#2 Use (vla-LoadDVB) in (S::StartUp) [this can even be a bogus load]
#3 Once in AutoCAD, use a lisp program that does the following:
#3a Use (command) or (vl-cmdf)
#3b Use (setvar)

That last (setvar) will *not* be 'honored' by AutoCAD. Oh, (setvar) won't
error out, it thinks all is happy, but AutoCAD itself blissfully ignores
you. But, wait! there's more! Run you program again, and the (setvar) *is*
honored. Oh, joy... And if your program uses (vla-SetVariable) the bug is
avoided. Looks like I need to alter those 1000's of line of code after
all...

For your further fun, I have included an AcadDoc.lsp file (remember,
S::StartUp is involved in the mess) that you can use to see "what's a
happenin' hotstuff".
(C:Test1) demonstrates the bug
(C:Test2) demonstrates the bug
(C:Test3) avoids the bug

--
R. Robert Bell, MCSE
http://www.acadx.com
23 REPLIES 23
Message 2 of 24
Anonymous
in reply to: Anonymous

No crash here, Robert.

A2000
Windows Pro
Network

-Luis

"R. Robert Bell" wrote in message
news:65ACB91929A8E9FCBAB024B0FF81F942@in.WebX.maYIadrTaRb...
> Well, it's Monday, so let's start with a deep bug to waken up the old
brain
> cells...
>
> It seems I'm caught like a squirrel on a road with a car coming in either
> direction. Due to the large amount of customization I have done over the
> years, I have far too much code to port fully to VBA or even full VL
ActiveX
> support in a brief period of time. So I do what any good programmer would
> do, identify core subroutines that that can be improved by either VBA or
> (vla-) functions.
>
> Until...
>
> This last week I switched my setvars/getvars to ActiveX (on my test bed)
to
> see if that stabilized AutoCAD any, as I was using ActiveX in much of my
> core already. And it seemed to help. But just as I was getting ready to
roll
> that out, I ran a program (not just a core subr) that switches from model
to
> paperspace. In this program, I am still using (setvar). This program is
used
> to convert a R14 drawing to TuTu, so the users would run it upon opening a
> drawing. And the 'cotton-pickin' stupid program crashed, never getting to
> paperspace via (setvar "TileMode" 0). "What the...", I muttered, as it
_had_
> worked for weeks. Well, after 12 hours of debugging, I was able to
replicate
> the problem.
>
> There's something funky (and it ain't my socks) in AutoCAD's interpretive
> processes. Here is the outline of the bug:
> #1 Use (vla-SetVariable) in (S::StartUp)
> #2 Use (vla-LoadDVB) in (S::StartUp) [this can even be a bogus load]
> #3 Once in AutoCAD, use a lisp program that does the following:
> #3a Use (command) or (vl-cmdf)
> #3b Use (setvar)
>
> That last (setvar) will *not* be 'honored' by AutoCAD. Oh, (setvar) won't
> error out, it thinks all is happy, but AutoCAD itself blissfully ignores
> you. But, wait! there's more! Run you program again, and the (setvar) *is*
> honored. Oh, joy... And if your program uses (vla-SetVariable) the bug is
> avoided. Looks like I need to alter those 1000's of line of code after
> all...
>
> For your further fun, I have included an AcadDoc.lsp file (remember,
> S::StartUp is involved in the mess) that you can use to see "what's a
> happenin' hotstuff".
> (C:Test1) demonstrates the bug
> (C:Test2) demonstrates the bug
> (C:Test3) avoids the bug
>
> --
> R. Robert Bell, MCSE
> http://www.acadx.com
>
>


----------------------------------------------------------------------------
----


(cond
((and objApp objDoc))
((setq objApp (vlax-Get-Acad-Object)
objDoc (vla-Get-ActiveDocument objApp)
)))

(defun test:SetVar (varN VarV)
(vla-SetVariable objDoc VarN VarV)
)

(defun S::Startup ()
(test:SetVar "CmdEcho" 0) ; innocuous setvar using ActiveX
(vl-Catch-All-Apply 'vla-LoadDVB (list
objApp
(findfile "Bogus.dvb")
)
)
)

(defun C:Test1 ()
(vl-cmdf "._Point" "0,0")
(setvar "TileMode" 0)
(alert "In paperspace.")
(princ)
)

(defun C:Test2 ()
(command "._Point" "0,0")
(setvar "TileMode" 0)
(alert "In paperspace.")
(princ)
)

(defun C:Test3 ()
(vl-cmdf "._Point" "0,0")
(test:SetVar "TileMode" 0)
(alert "In paperspace.")
(princ)
)
Message 3 of 24
Anonymous
in reply to: Anonymous

There isn't a crash. The (setvar "TileMode" 0) *doesn't*. The drawing
remains in modelspace.

Tested under vanilla A2k and TuTu.

It is important to run this under a vanilla profile, with just this AcadDoc
running, to duplicate the error. You can only run Test1 or Test2 once upon
drawing load to see the error.

--
R. Robert Bell, MCSE
http://www.acadx.com


"Luis Esquivel" wrote in message
news:E20D0B9549E442BCD3AF5366C32D535C@in.WebX.maYIadrTaRb...
| No crash here, Robert.
|
| A2000
| Windows Pro
| Network
|
| -Luis
|
| "R. Robert Bell" wrote in message
| news:65ACB91929A8E9FCBAB024B0FF81F942@in.WebX.maYIadrTaRb...
| > Well, it's Monday, so let's start with a deep bug to waken up the old
| brain
| > cells...
| >
| > It seems I'm caught like a squirrel on a road with a car coming in
either
| > direction. Due to the large amount of customization I have done over the
| > years, I have far too much code to port fully to VBA or even full VL
| ActiveX
| > support in a brief period of time. So I do what any good programmer
would
| > do, identify core subroutines that that can be improved by either VBA or
| > (vla-) functions.
| >
| > Until...
| >
| > This last week I switched my setvars/getvars to ActiveX (on my test bed)
| to
| > see if that stabilized AutoCAD any, as I was using ActiveX in much of my
| > core already. And it seemed to help. But just as I was getting ready to
| roll
| > that out, I ran a program (not just a core subr) that switches from
model
| to
| > paperspace. In this program, I am still using (setvar). This program is
| used
| > to convert a R14 drawing to TuTu, so the users would run it upon opening
a
| > drawing. And the 'cotton-pickin' stupid program crashed, never getting
to
| > paperspace via (setvar "TileMode" 0). "What the...", I muttered, as it
| _had_
| > worked for weeks. Well, after 12 hours of debugging, I was able to
| replicate
| > the problem.
| >
| > There's something funky (and it ain't my socks) in AutoCAD's
interpretive
| > processes. Here is the outline of the bug:
| > #1 Use (vla-SetVariable) in (S::StartUp)
| > #2 Use (vla-LoadDVB) in (S::StartUp) [this can even be a bogus load]
| > #3 Once in AutoCAD, use a lisp program that does the following:
| > #3a Use (command) or (vl-cmdf)
| > #3b Use (setvar)
| >
| > That last (setvar) will *not* be 'honored' by AutoCAD. Oh, (setvar)
won't
| > error out, it thinks all is happy, but AutoCAD itself blissfully ignores
| > you. But, wait! there's more! Run you program again, and the (setvar)
*is*
| > honored. Oh, joy... And if your program uses (vla-SetVariable) the bug
is
| > avoided. Looks like I need to alter those 1000's of line of code after
| > all...
| >
| > For your further fun, I have included an AcadDoc.lsp file (remember,
| > S::StartUp is involved in the mess) that you can use to see "what's a
| > happenin' hotstuff".
| > (C:Test1) demonstrates the bug
| > (C:Test2) demonstrates the bug
| > (C:Test3) avoids the bug
| >
| > --
| > R. Robert Bell, MCSE
| > http://www.acadx.com
| >
| >
|
|
| --------------------------------------------------------------------------
--
| ----
|
|
| (cond
| ((and objApp objDoc))
| ((setq objApp (vlax-Get-Acad-Object)
| objDoc (vla-Get-ActiveDocument objApp)
| )))
|
| (defun test:SetVar (varN VarV)
| (vla-SetVariable objDoc VarN VarV)
| )
|
| (defun S::Startup ()
| (test:SetVar "CmdEcho" 0) ; innocuous setvar using ActiveX
| (vl-Catch-All-Apply 'vla-LoadDVB (list
| objApp
| (findfile "Bogus.dvb")
| )
| )
| )
|
| (defun C:Test1 ()
| (vl-cmdf "._Point" "0,0")
| (setvar "TileMode" 0)
| (alert "In paperspace.")
| (princ)
| )
|
| (defun C:Test2 ()
| (command "._Point" "0,0")
| (setvar "TileMode" 0)
| (alert "In paperspace.")
| (princ)
| )
|
| (defun C:Test3 ()
| (vl-cmdf "._Point" "0,0")
| (test:SetVar "TileMode" 0)
| (alert "In paperspace.")
| (princ)
| )
|
|
|
Message 4 of 24
Anonymous
in reply to: Anonymous

I meant ERROR...

>You can only run Test1 or Test2 once upon
> drawing load to see the error.

That's what I did.

-Le

"R. Robert Bell" wrote in message
news:9B7F0D1CA36D819068BD160172F9787F@in.WebX.maYIadrTaRb...
> There isn't a crash. The (setvar "TileMode" 0) *doesn't*. The drawing
> remains in modelspace.
>
> Tested under vanilla A2k and TuTu.
>
> It is important to run this under a vanilla profile, with just this
AcadDoc
> running, to duplicate the error. You can only run Test1 or Test2 once upon
> drawing load to see the error.
>
> --
> R. Robert Bell, MCSE
> http://www.acadx.com
>
>
> "Luis Esquivel" wrote in message
> news:E20D0B9549E442BCD3AF5366C32D535C@in.WebX.maYIadrTaRb...
> | No crash here, Robert.
> |
> | A2000
> | Windows Pro
> | Network
> |
> | -Luis
> |
> | "R. Robert Bell" wrote in message
> | news:65ACB91929A8E9FCBAB024B0FF81F942@in.WebX.maYIadrTaRb...
> | > Well, it's Monday, so let's start with a deep bug to waken up the old
> | brain
> | > cells...
> | >
> | > It seems I'm caught like a squirrel on a road with a car coming in
> either
> | > direction. Due to the large amount of customization I have done over
the
> | > years, I have far too much code to port fully to VBA or even full VL
> | ActiveX
> | > support in a brief period of time. So I do what any good programmer
> would
> | > do, identify core subroutines that that can be improved by either VBA
or
> | > (vla-) functions.
> | >
> | > Until...
> | >
> | > This last week I switched my setvars/getvars to ActiveX (on my test
bed)
> | to
> | > see if that stabilized AutoCAD any, as I was using ActiveX in much of
my
> | > core already. And it seemed to help. But just as I was getting ready
to
> | roll
> | > that out, I ran a program (not just a core subr) that switches from
> model
> | to
> | > paperspace. In this program, I am still using (setvar). This program
is
> | used
> | > to convert a R14 drawing to TuTu, so the users would run it upon
opening
> a
> | > drawing. And the 'cotton-pickin' stupid program crashed, never getting
> to
> | > paperspace via (setvar "TileMode" 0). "What the...", I muttered, as it
> | _had_
> | > worked for weeks. Well, after 12 hours of debugging, I was able to
> | replicate
> | > the problem.
> | >
> | > There's something funky (and it ain't my socks) in AutoCAD's
> interpretive
> | > processes. Here is the outline of the bug:
> | > #1 Use (vla-SetVariable) in (S::StartUp)
> | > #2 Use (vla-LoadDVB) in (S::StartUp) [this can even be a bogus load]
> | > #3 Once in AutoCAD, use a lisp program that does the following:
> | > #3a Use (command) or (vl-cmdf)
> | > #3b Use (setvar)
> | >
> | > That last (setvar) will *not* be 'honored' by AutoCAD. Oh, (setvar)
> won't
> | > error out, it thinks all is happy, but AutoCAD itself blissfully
ignores
> | > you. But, wait! there's more! Run you program again, and the (setvar)
> *is*
> | > honored. Oh, joy... And if your program uses (vla-SetVariable) the bug
> is
> | > avoided. Looks like I need to alter those 1000's of line of code after
> | > all...
> | >
> | > For your further fun, I have included an AcadDoc.lsp file (remember,
> | > S::StartUp is involved in the mess) that you can use to see "what's a
> | > happenin' hotstuff".
> | > (C:Test1) demonstrates the bug
> | > (C:Test2) demonstrates the bug
> | > (C:Test3) avoids the bug
> | >
> | > --
> | > R. Robert Bell, MCSE
> | > http://www.acadx.com
> | >
> | >
> |
> |
>
| --------------------------------------------------------------------------
> --
> | ----
> |
> |
> | (cond
> | ((and objApp objDoc))
> | ((setq objApp (vlax-Get-Acad-Object)
> | objDoc (vla-Get-ActiveDocument objApp)
> | )))
> |
> | (defun test:SetVar (varN VarV)
> | (vla-SetVariable objDoc VarN VarV)
> | )
> |
> | (defun S::Startup ()
> | (test:SetVar "CmdEcho" 0) ; innocuous setvar using ActiveX
> | (vl-Catch-All-Apply 'vla-LoadDVB (list
> | objApp
> | (findfile "Bogus.dvb")
> | )
> | )
> | )
> |
> | (defun C:Test1 ()
> | (vl-cmdf "._Point" "0,0")
> | (setvar "TileMode" 0)
> | (alert "In paperspace.")
> | (princ)
> | )
> |
> | (defun C:Test2 ()
> | (command "._Point" "0,0")
> | (setvar "TileMode" 0)
> | (alert "In paperspace.")
> | (princ)
> | )
> |
> | (defun C:Test3 ()
> | (vl-cmdf "._Point" "0,0")
> | (test:SetVar "TileMode" 0)
> | (alert "In paperspace.")
> | (princ)
> | )
> |
> |
> |
Message 5 of 24
Anonymous
in reply to: Anonymous

Robert

I ran your test, and noted the same problem using A2Ki.

Bill
Message 6 of 24
Anonymous
in reply to: Anonymous

Well,

Robert, I was able to emulate the BUG or problem even that I run it with A2K
ADT, but just after open the second drawing session and without closing the
first one, stays in model-space.

-Luis

"R. Robert Bell" wrote in message
news:65ACB91929A8E9FCBAB024B0FF81F942@in.WebX.maYIadrTaRb...
> Well, it's Monday, so let's start with a deep bug to waken up the old
brain
> cells...
>
> It seems I'm caught like a squirrel on a road with a car coming in either
> direction. Due to the large amount of customization I have done over the
> years, I have far too much code to port fully to VBA or even full VL
ActiveX
> support in a brief period of time. So I do what any good programmer would
> do, identify core subroutines that that can be improved by either VBA or
> (vla-) functions.
>
> Until...
>
> This last week I switched my setvars/getvars to ActiveX (on my test bed)
to
> see if that stabilized AutoCAD any, as I was using ActiveX in much of my
> core already. And it seemed to help. But just as I was getting ready to
roll
> that out, I ran a program (not just a core subr) that switches from model
to
> paperspace. In this program, I am still using (setvar). This program is
used
> to convert a R14 drawing to TuTu, so the users would run it upon opening a
> drawing. And the 'cotton-pickin' stupid program crashed, never getting to
> paperspace via (setvar "TileMode" 0). "What the...", I muttered, as it
_had_
> worked for weeks. Well, after 12 hours of debugging, I was able to
replicate
> the problem.
>
> There's something funky (and it ain't my socks) in AutoCAD's interpretive
> processes. Here is the outline of the bug:
> #1 Use (vla-SetVariable) in (S::StartUp)
> #2 Use (vla-LoadDVB) in (S::StartUp) [this can even be a bogus load]
> #3 Once in AutoCAD, use a lisp program that does the following:
> #3a Use (command) or (vl-cmdf)
> #3b Use (setvar)
>
> That last (setvar) will *not* be 'honored' by AutoCAD. Oh, (setvar) won't
> error out, it thinks all is happy, but AutoCAD itself blissfully ignores
> you. But, wait! there's more! Run you program again, and the (setvar) *is*
> honored. Oh, joy... And if your program uses (vla-SetVariable) the bug is
> avoided. Looks like I need to alter those 1000's of line of code after
> all...
>
> For your further fun, I have included an AcadDoc.lsp file (remember,
> S::StartUp is involved in the mess) that you can use to see "what's a
> happenin' hotstuff".
> (C:Test1) demonstrates the bug
> (C:Test2) demonstrates the bug
> (C:Test3) avoids the bug
>
> --
> R. Robert Bell, MCSE
> http://www.acadx.com
>
>


----------------------------------------------------------------------------
----


(cond
((and objApp objDoc))
((setq objApp (vlax-Get-Acad-Object)
objDoc (vla-Get-ActiveDocument objApp)
)))

(defun test:SetVar (varN VarV)
(vla-SetVariable objDoc VarN VarV)
)

(defun S::Startup ()
(test:SetVar "CmdEcho" 0) ; innocuous setvar using ActiveX
(vl-Catch-All-Apply 'vla-LoadDVB (list
objApp
(findfile "Bogus.dvb")
)
)
)

(defun C:Test1 ()
(vl-cmdf "._Point" "0,0")
(setvar "TileMode" 0)
(alert "In paperspace.")
(princ)
)

(defun C:Test2 ()
(command "._Point" "0,0")
(setvar "TileMode" 0)
(alert "In paperspace.")
(princ)
)

(defun C:Test3 ()
(vl-cmdf "._Point" "0,0")
(test:SetVar "TileMode" 0)
(alert "In paperspace.")
(princ)
)
Message 7 of 24
Anonymous
in reply to: Anonymous

Robert,

what you are talking about is part of the eLockViolation error.
It is covered by a handful of threads is this group.
Switching from (setvar) to (vla-SetVariable) doesn't help a
lot because if (setvar) doesn't work AutoCAD is unstable
and can crash when using (entmake).
Add this to your AcadDoc.lsp:

(defun c:test4 ()
(command "._undo" "_g")
(entmake '((0 . "POINT")(10 0 0 0)))
(command "._undo" "_end")
)

When calling this as first command in a new drawing AutoCAD crashes
immediately.
One way to prevent all this hassle is using my PreventLockError.arx.
You can find it in your thread "Releasing ActiveX objects *IMPORTANT*"
from 01/09/19.
Load it and run your tests again.

Stephan

P.S.: I am using A2Ki and don't know if the bug still exists in A2K2

"R. Robert Bell" wrote:
>
> Well, it's Monday, so let's start with a deep bug to waken up the old brain
> cells...
>
> It seems I'm caught like a squirrel on a road with a car coming in either
> direction. Due to the large amount of customization I have done over the
> years, I have far too much code to port fully to VBA or even full VL ActiveX
> support in a brief period of time. So I do what any good programmer would
> do, identify core subroutines that that can be improved by either VBA or
> (vla-) functions.
>
> Until...
>
> This last week I switched my setvars/getvars to ActiveX (on my test bed) to
> see if that stabilized AutoCAD any, as I was using ActiveX in much of my
> core already. And it seemed to help. But just as I was getting ready to roll
> that out, I ran a program (not just a core subr) that switches from model to
> paperspace. In this program, I am still using (setvar). This program is used
> to convert a R14 drawing to TuTu, so the users would run it upon opening a
> drawing. And the 'cotton-pickin' stupid program crashed, never getting to
> paperspace via (setvar "TileMode" 0). "What the...", I muttered, as it _had_
> worked for weeks. Well, after 12 hours of debugging, I was able to replicate
> the problem.
>
> There's something funky (and it ain't my socks) in AutoCAD's interpretive
> processes. Here is the outline of the bug:
> #1 Use (vla-SetVariable) in (S::StartUp)
> #2 Use (vla-LoadDVB) in (S::StartUp) [this can even be a bogus load]
> #3 Once in AutoCAD, use a lisp program that does the following:
> #3a Use (command) or (vl-cmdf)
> #3b Use (setvar)
>
> That last (setvar) will *not* be 'honored' by AutoCAD. Oh, (setvar) won't
> error out, it thinks all is happy, but AutoCAD itself blissfully ignores
> you. But, wait! there's more! Run you program again, and the (setvar) *is*
> honored. Oh, joy... And if your program uses (vla-SetVariable) the bug is
> avoided. Looks like I need to alter those 1000's of line of code after
> all...
>
> For your further fun, I have included an AcadDoc.lsp file (remember,
> S::StartUp is involved in the mess) that you can use to see "what's a
> happenin' hotstuff".
> (C:Test1) demonstrates the bug
> (C:Test2) demonstrates the bug
> (C:Test3) avoids the bug
>
> --
> R. Robert Bell, MCSE
> http://www.acadx.com
>
> ----------------------------------------------------------------------------------------------------
> Name: AcadDoc.lsp
> AcadDoc.lsp Type: AutoLISP Application source (application/x-unknown-content-type-AutoLISPFile)
> Encoding: quoted-printable
Message 8 of 24
Anonymous
in reply to: Anonymous

(c:test4)

did not crash here with A2K2

First command, new drawing.

-Jason

"Stephan Koster" wrote in message
news:3BC22A64.BB560962@web.de...
> Robert,
>
> what you are talking about is part of the eLockViolation error.
> It is covered by a handful of threads is this group.
> Switching from (setvar) to (vla-SetVariable) doesn't help a
> lot because if (setvar) doesn't work AutoCAD is unstable
> and can crash when using (entmake).
> Add this to your AcadDoc.lsp:
>
> (defun c:test4 ()
> (command "._undo" "_g")
> (entmake '((0 . "POINT")(10 0 0 0)))
> (command "._undo" "_end")
> )
>
> When calling this as first command in a new drawing AutoCAD crashes
> immediately.
> One way to prevent all this hassle is using my PreventLockError.arx.
> You can find it in your thread "Releasing ActiveX objects *IMPORTANT*"
> from 01/09/19.
> Load it and run your tests again.
>
> Stephan
>
> P.S.: I am using A2Ki and don't know if the bug still exists in A2K2
>
> "R. Robert Bell" wrote:
> >
> > Well, it's Monday, so let's start with a deep bug to waken up the old
brain
> > cells...
> >
> > It seems I'm caught like a squirrel on a road with a car coming in
either
> > direction. Due to the large amount of customization I have done over the
> > years, I have far too much code to port fully to VBA or even full VL
ActiveX
> > support in a brief period of time. So I do what any good programmer
would
> > do, identify core subroutines that that can be improved by either VBA or
> > (vla-) functions.
> >
> > Until...
> >
> > This last week I switched my setvars/getvars to ActiveX (on my test bed)
to
> > see if that stabilized AutoCAD any, as I was using ActiveX in much of my
> > core already. And it seemed to help. But just as I was getting ready to
roll
> > that out, I ran a program (not just a core subr) that switches from
model to
> > paperspace. In this program, I am still using (setvar). This program is
used
> > to convert a R14 drawing to TuTu, so the users would run it upon opening
a
> > drawing. And the 'cotton-pickin' stupid program crashed, never getting
to
> > paperspace via (setvar "TileMode" 0). "What the...", I muttered, as it
_had_
> > worked for weeks. Well, after 12 hours of debugging, I was able to
replicate
> > the problem.
> >
> > There's something funky (and it ain't my socks) in AutoCAD's
interpretive
> > processes. Here is the outline of the bug:
> > #1 Use (vla-SetVariable) in (S::StartUp)
> > #2 Use (vla-LoadDVB) in (S::StartUp) [this can even be a bogus load]
> > #3 Once in AutoCAD, use a lisp program that does the following:
> > #3a Use (command) or (vl-cmdf)
> > #3b Use (setvar)
> >
> > That last (setvar) will *not* be 'honored' by AutoCAD. Oh, (setvar)
won't
> > error out, it thinks all is happy, but AutoCAD itself blissfully ignores
> > you. But, wait! there's more! Run you program again, and the (setvar)
*is*
> > honored. Oh, joy... And if your program uses (vla-SetVariable) the bug
is
> > avoided. Looks like I need to alter those 1000's of line of code after
> > all...
> >
> > For your further fun, I have included an AcadDoc.lsp file (remember,
> > S::StartUp is involved in the mess) that you can use to see "what's a
> > happenin' hotstuff".
> > (C:Test1) demonstrates the bug
> > (C:Test2) demonstrates the bug
> > (C:Test3) avoids the bug
> >
> > --
> > R. Robert Bell, MCSE
> > http://www.acadx.com
> >
>
--------------------------------------------------------------------------
--------------------------
> > Name: AcadDoc.lsp
> > AcadDoc.lsp Type: AutoLISP Application source
(application/x-unknown-content-type-AutoLISPFile)
> > Encoding: quoted-printable
Message 9 of 24
Anonymous
in reply to: Anonymous

Stephan
First, a big *thank you* for sharing PreventLockError.arx

I added Test4 to Roberts AcadDoc.lsp using A2Ki with "out of the box settings"
and as predicted, *bam* eLockViolation. Next I added Acad.RX calling
PreventLockError.arx, in separate drawings I ran Test2 then Test4, each worked.
The only note is that Test2 took about 30sec before the routine was complete.

I have been using PreventLockError since March, but the eLockViolation still
will occur (yes, I am a shade tree lisper). Last week one of the guys here keep
getting the eLockViolation when using my leader routine, I opened the dwg and
did a leader and *bam* eLockViolation. So I purged the dwg (out of frustration)
and to my surprise the eLockViolation went away, for now anyway (very strange).

Bill



"Stephan Koster" wrote in message
news:3BC22A64.BB560962@web.de...
> Robert,
>
> what you are talking about is part of the eLockViolation error.
> It is covered by a handful of threads is this group.
> Switching from (setvar) to (vla-SetVariable) doesn't help a
> lot because if (setvar) doesn't work AutoCAD is unstable
> and can crash when using (entmake).
> Add this to your AcadDoc.lsp:
>
> (defun c:test4 ()
> (command "._undo" "_g")
> (entmake '((0 . "POINT")(10 0 0 0)))
> (command "._undo" "_end")
> )
>
> When calling this as first command in a new drawing AutoCAD crashes
> immediately.
> One way to prevent all this hassle is using my PreventLockError.arx.
> You can find it in your thread "Releasing ActiveX objects *IMPORTANT*"
> from 01/09/19.
> Load it and run your tests again.
>
> Stephan
>
> P.S.: I am using A2Ki and don't know if the bug still exists in A2K2
>
> "R. Robert Bell" wrote:
> >
> > Well, it's Monday, so let's start with a deep bug to waken up the old brain
> > cells...
> >
> > It seems I'm caught like a squirrel on a road with a car coming in either
> > direction. Due to the large amount of customization I have done over the
> > years, I have far too much code to port fully to VBA or even full VL ActiveX
> > support in a brief period of time. So I do what any good programmer would
> > do, identify core subroutines that that can be improved by either VBA or
> > (vla-) functions.
> >
> > Until...
> >
> > This last week I switched my setvars/getvars to ActiveX (on my test bed) to
> > see if that stabilized AutoCAD any, as I was using ActiveX in much of my
> > core already. And it seemed to help. But just as I was getting ready to roll
> > that out, I ran a program (not just a core subr) that switches from model to
> > paperspace. In this program, I am still using (setvar). This program is used
> > to convert a R14 drawing to TuTu, so the users would run it upon opening a
> > drawing. And the 'cotton-pickin' stupid program crashed, never getting to
> > paperspace via (setvar "TileMode" 0). "What the...", I muttered, as it _had_
> > worked for weeks. Well, after 12 hours of debugging, I was able to replicate
> > the problem.
> >
> > There's something funky (and it ain't my socks) in AutoCAD's interpretive
> > processes. Here is the outline of the bug:
> > #1 Use (vla-SetVariable) in (S::StartUp)
> > #2 Use (vla-LoadDVB) in (S::StartUp) [this can even be a bogus load]
> > #3 Once in AutoCAD, use a lisp program that does the following:
> > #3a Use (command) or (vl-cmdf)
> > #3b Use (setvar)
> >
> > That last (setvar) will *not* be 'honored' by AutoCAD. Oh, (setvar) won't
> > error out, it thinks all is happy, but AutoCAD itself blissfully ignores
> > you. But, wait! there's more! Run you program again, and the (setvar) *is*
> > honored. Oh, joy... And if your program uses (vla-SetVariable) the bug is
> > avoided. Looks like I need to alter those 1000's of line of code after
> > all...
> >
> > For your further fun, I have included an AcadDoc.lsp file (remember,
> > S::StartUp is involved in the mess) that you can use to see "what's a
> > happenin' hotstuff".
> > (C:Test1) demonstrates the bug
> > (C:Test2) demonstrates the bug
> > (C:Test3) avoids the bug
> >
> > --
> > R. Robert Bell, MCSE
> > http://www.acadx.com
> >
>
------------------------------------------------------------------------------
----------------------
> > Name: AcadDoc.lsp
> > AcadDoc.lsp Type: AutoLISP Application source
(application/x-unknown-content-type-AutoLISPFile)
> > Encoding: quoted-printable
Message 10 of 24
Anonymous
in reply to: Anonymous

Tried it in a "scratch" drawing (win98/2000i). No crashes. What did I do
wrong?

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juhden@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"Stephan Koster" wrote in message
news:3BC22A64.BB560962@web.de...
> Robert,
>
> what you are talking about is part of the eLockViolation error.
> It is covered by a handful of threads is this group.
> Switching from (setvar) to (vla-SetVariable) doesn't help a
> lot because if (setvar) doesn't work AutoCAD is unstable
> and can crash when using (entmake).
> Add this to your AcadDoc.lsp:
>
> (defun c:test4 ()
> (command "._undo" "_g")
> (entmake '((0 . "POINT")(10 0 0 0)))
> (command "._undo" "_end")
> )
>
> When calling this as first command in a new drawing AutoCAD crashes
> immediately.
> One way to prevent all this hassle is using my PreventLockError.arx.
> You can find it in your thread "Releasing ActiveX objects *IMPORTANT*"
> from 01/09/19.
> Load it and run your tests again.
Message 11 of 24
Anonymous
in reply to: Anonymous

John,
Same confusion as me, what happens is that if you run the test 1 and 2, even
if is call the setvar tilemode 0 it will remain the session in model space.

I run it and was able to recreate it in a2k adt.

-Luis

"John Uhden" wrote in message
news:9FA4370661EB491391600A92F28ADB4D@in.WebX.maYIadrTaRb...
> Tried it in a "scratch" drawing (win98/2000i). No crashes. What did I do
> wrong?
>
> --
> John Uhden, Cadlantic/formerly CADvantage
> --> mailto:juhden@cadlantic.com
> --> http://www.cadlantic.com
> 2 Village Road
> Sea Girt, NJ 08750
> Tel. 732-974-1711
> FAX 732-528-1332
>
> "Stephan Koster" wrote in message
> news:3BC22A64.BB560962@web.de...
> > Robert,
> >
> > what you are talking about is part of the eLockViolation error.
> > It is covered by a handful of threads is this group.
> > Switching from (setvar) to (vla-SetVariable) doesn't help a
> > lot because if (setvar) doesn't work AutoCAD is unstable
> > and can crash when using (entmake).
> > Add this to your AcadDoc.lsp:
> >
> > (defun c:test4 ()
> > (command "._undo" "_g")
> > (entmake '((0 . "POINT")(10 0 0 0)))
> > (command "._undo" "_end")
> > )
> >
> > When calling this as first command in a new drawing AutoCAD crashes
> > immediately.
> > One way to prevent all this hassle is using my PreventLockError.arx.
> > You can find it in your thread "Releasing ActiveX objects *IMPORTANT*"
> > from 01/09/19.
> > Load it and run your tests again.
>
>
>
Message 12 of 24
Anonymous
in reply to: Anonymous

I can understand the SETVAR TILEMODE issue in 2000+. But I don't understand
why Stephan's C:TEST4 crashes on some, but not on mine.

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juhden@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"Luis Esquivel" wrote in message
news:851DF50A3EE5533C237C08BD6C3C1EEB@in.WebX.maYIadrTaRb...
> John,
> Same confusion as me, what happens is that if you run the test 1 and 2,
even
> if is call the setvar tilemode 0 it will remain the session in model
space.
>
> I run it and was able to recreate it in a2k adt.
>
> -Luis
>
> "John Uhden" wrote in message
> news:9FA4370661EB491391600A92F28ADB4D@in.WebX.maYIadrTaRb...
> > Tried it in a "scratch" drawing (win98/2000i). No crashes. What did I
do
> > wrong?
> >
> > --
> > John Uhden, Cadlantic/formerly CADvantage
> > --> mailto:juhden@cadlantic.com
> > --> http://www.cadlantic.com
> > 2 Village Road
> > Sea Girt, NJ 08750
> > Tel. 732-974-1711
> > FAX 732-528-1332
> >
> > "Stephan Koster" wrote in message
> > news:3BC22A64.BB560962@web.de...
> > > Robert,
> > >
> > > what you are talking about is part of the eLockViolation error.
> > > It is covered by a handful of threads is this group.
> > > Switching from (setvar) to (vla-SetVariable) doesn't help a
> > > lot because if (setvar) doesn't work AutoCAD is unstable
> > > and can crash when using (entmake).
> > > Add this to your AcadDoc.lsp:
> > >
> > > (defun c:test4 ()
> > > (command "._undo" "_g")
> > > (entmake '((0 . "POINT")(10 0 0 0)))
> > > (command "._undo" "_end")
> > > )
> > >
> > > When calling this as first command in a new drawing AutoCAD crashes
> > > immediately.
> > > One way to prevent all this hassle is using my PreventLockError.arx.
> > > You can find it in your thread "Releasing ActiveX objects *IMPORTANT*"
> > > from 01/09/19.
> > > Load it and run your tests again.
> >
> >
> >
>
>
Message 13 of 24
Anonymous
in reply to: Anonymous

Okay,
I familiar with Stephan's examples using his arx, and I did the test long
time ago on A2000, 2000i and A2K-ADT and never got or catch the error or
crash, but I was able to emulate some of this behaviors by mixing setvar and
entmod with activex methods and probably also including reactors too or even
if I run two separate routines one in plain autolisp and another with
vlisp/activex/and some with reactors

-Luis
www.arqcom.com.mx


"John Uhden" wrote in message
news:F2774255FF10799C65E9C47D74C8CB8A@in.WebX.maYIadrTaRb...
> I can understand the SETVAR TILEMODE issue in 2000+. But I don't
understand
> why Stephan's C:TEST4 crashes on some, but not on mine.
>
> --
> John Uhden, Cadlantic/formerly CADvantage
> --> mailto:juhden@cadlantic.com
> --> http://www.cadlantic.com
> 2 Village Road
> Sea Girt, NJ 08750
> Tel. 732-974-1711
> FAX 732-528-1332
>
> "Luis Esquivel" wrote in message
> news:851DF50A3EE5533C237C08BD6C3C1EEB@in.WebX.maYIadrTaRb...
> > John,
> > Same confusion as me, what happens is that if you run the test 1 and 2,
> even
> > if is call the setvar tilemode 0 it will remain the session in model
> space.
> >
> > I run it and was able to recreate it in a2k adt.
> >
> > -Luis
> >
> > "John Uhden" wrote in message
> > news:9FA4370661EB491391600A92F28ADB4D@in.WebX.maYIadrTaRb...
> > > Tried it in a "scratch" drawing (win98/2000i). No crashes. What did
I
> do
> > > wrong?
> > >
> > > --
> > > John Uhden, Cadlantic/formerly CADvantage
> > > --> mailto:juhden@cadlantic.com
> > > --> http://www.cadlantic.com
> > > 2 Village Road
> > > Sea Girt, NJ 08750
> > > Tel. 732-974-1711
> > > FAX 732-528-1332
> > >
> > > "Stephan Koster" wrote in message
> > > news:3BC22A64.BB560962@web.de...
> > > > Robert,
> > > >
> > > > what you are talking about is part of the eLockViolation error.
> > > > It is covered by a handful of threads is this group.
> > > > Switching from (setvar) to (vla-SetVariable) doesn't help a
> > > > lot because if (setvar) doesn't work AutoCAD is unstable
> > > > and can crash when using (entmake).
> > > > Add this to your AcadDoc.lsp:
> > > >
> > > > (defun c:test4 ()
> > > > (command "._undo" "_g")
> > > > (entmake '((0 . "POINT")(10 0 0 0)))
> > > > (command "._undo" "_end")
> > > > )
> > > >
> > > > When calling this as first command in a new drawing AutoCAD crashes
> > > > immediately.
> > > > One way to prevent all this hassle is using my PreventLockError.arx.
> > > > You can find it in your thread "Releasing ActiveX objects
*IMPORTANT*"
> > > > from 01/09/19.
> > > > Load it and run your tests again.
> > >
> > >
> > >
> >
> >
>
>
Message 14 of 24
Anonymous
in reply to: Anonymous

John,

to simplify it - there is no need to use (s::startup) to show the error -,
load this two functions:

(defun c:test()
(setq acaddoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-SetVariable acaddoc "clayer" "0")
)

(defun c:test4 ()
(command "._undo" "_g")
(entmake '((0 . "POINT")(10 0 0 0)))
(command "._undo" "_end")
)

Run first 'test' and immediately after that 'test4'.
Crashes AutoCAD always on my machine (A2Ki SP2, WinNT 4 SP6) -
but only if my arx is not loaded.

Stephan

John Uhden wrote:
>
> I can understand the SETVAR TILEMODE issue in 2000+. But I don't understand
> why Stephan's C:TEST4 crashes on some, but not on mine.
>
> --
> John Uhden, Cadlantic/formerly CADvantage
> --> mailto:juhden@cadlantic.com
> --> http://www.cadlantic.com
> 2 Village Road
> Sea Girt, NJ 08750
> Tel. 732-974-1711
> FAX 732-528-1332
Message 15 of 24
Anonymous
in reply to: Anonymous

With that, I crashed

A2K2
Win2000 / SP2

-Jason

"Stephan Koster" wrote in message
news:3BC35618.77F6775F@web.de...
> John,
>
> to simplify it - there is no need to use (s::startup) to show the error -,
> load this two functions:
>
> (defun c:test()
> (setq acaddoc (vla-get-activedocument (vlax-get-acad-object)))
> (vla-SetVariable acaddoc "clayer" "0")
> )
>
> (defun c:test4 ()
> (command "._undo" "_g")
> (entmake '((0 . "POINT")(10 0 0 0)))
> (command "._undo" "_end")
> )
>
> Run first 'test' and immediately after that 'test4'.
> Crashes AutoCAD always on my machine (A2Ki SP2, WinNT 4 SP6) -
> but only if my arx is not loaded.
>
> Stephan
>
> John Uhden wrote:
> >
> > I can understand the SETVAR TILEMODE issue in 2000+. But I don't
understand
> > why Stephan's C:TEST4 crashes on some, but not on mine.
> >
> > --
> > John Uhden, Cadlantic/formerly CADvantage
> > --> mailto:juhden@cadlantic.com
> > --> http://www.cadlantic.com
> > 2 Village Road
> > Sea Girt, NJ 08750
> > Tel. 732-974-1711
> > FAX 732-528-1332
Message 16 of 24
Anonymous
in reply to: Anonymous

Tried running TEST and immediately TEST4 in a new "scratch" drawing. Didn't
crash. But I noticed that nowhere are you invoking (vl-load-com), whereas
my acaddoc.lsp has already done that. No, I don't have your arx.

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juhden@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"Stephan Koster" wrote in message
news:3BC35618.77F6775F@web.de...
> John,
>
> to simplify it - there is no need to use (s::startup) to show the error -,
> load this two functions:
>
> (defun c:test()
> (setq acaddoc (vla-get-activedocument (vlax-get-acad-object)))
> (vla-SetVariable acaddoc "clayer" "0")
> )
>
> (defun c:test4 ()
> (command "._undo" "_g")
> (entmake '((0 . "POINT")(10 0 0 0)))
> (command "._undo" "_end")
> )
>
> Run first 'test' and immediately after that 'test4'.
> Crashes AutoCAD always on my machine (A2Ki SP2, WinNT 4 SP6) -
> but only if my arx is not loaded.
>
> Stephan
Message 17 of 24
Anonymous
in reply to: Anonymous

Crashes here always, not only in an empty drawing.
I don't know why it doesn't crash on your machine.
Would be interesting what in your configuration
is different, but I have no idea.

I forgot about (vl-load-com), of course you have
to call it once somewhere before you run 'test'.

Stephan

John Uhden schrieb:
>
> Tried running TEST and immediately TEST4 in a new "scratch" drawing. Didn't
> crash. But I noticed that nowhere are you invoking (vl-load-com), whereas
> my acaddoc.lsp has already done that. No, I don't have your arx.
>
> --
> John Uhden, Cadlantic/formerly CADvantage
> --> mailto:juhden@cadlantic.com
> --> http://www.cadlantic.com
> 2 Village Road
> Sea Girt, NJ 08750
> Tel. 732-974-1711
> FAX 732-528-1332
>
> "Stephan Koster" wrote in message
> news:3BC35618.77F6775F@web.de...
> > John,
> >
> > to simplify it - there is no need to use (s::startup) to show the error -,
> > load this two functions:
> >
> > (defun c:test()
> > (setq acaddoc (vla-get-activedocument (vlax-get-acad-object)))
> > (vla-SetVariable acaddoc "clayer" "0")
> > )
> >
> > (defun c:test4 ()
> > (command "._undo" "_g")
> > (entmake '((0 . "POINT")(10 0 0 0)))
> > (command "._undo" "_end")
> > )
> >
> > Run first 'test' and immediately after that 'test4'.
> > Crashes AutoCAD always on my machine (A2Ki SP2, WinNT 4 SP6) -
> > but only if my arx is not loaded.
> >
> > Stephan
Message 18 of 24
Anonymous
in reply to: Anonymous

(defun c:test()
(setq acaddoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-SetVariable acaddoc "clayer" "0")
)

(defun c:test4 ()
(command "._undo" "_g")
;;; (entmake)
(command)
;;; (entmake (list '(0 . "POINT") '(10 0 0 0))) ; or if I use this line
works fine too.
(entmake '((0 . "POINT")(10 0 0 0)))
;;; (entmake)
(command)
(command "._undo" "_end")
)

But if I use (entmake) or (command) after and before the entmaking works
here just fine.

-..- Luis

"Stephan Koster" wrote in message
news:3BC4C7C6.53EE1124@web.de...
> Crashes here always, not only in an empty drawing.
> I don't know why it doesn't crash on your machine.
> Would be interesting what in your configuration
> is different, but I have no idea.
>
> I forgot about (vl-load-com), of course you have
> to call it once somewhere before you run 'test'.
>
> Stephan
>
> John Uhden schrieb:
> >
> > Tried running TEST and immediately TEST4 in a new "scratch" drawing.
Didn't
> > crash. But I noticed that nowhere are you invoking (vl-load-com),
whereas
> > my acaddoc.lsp has already done that. No, I don't have your arx.
> >
> > --
> > John Uhden, Cadlantic/formerly CADvantage
> > --> mailto:juhden@cadlantic.com
> > --> http://www.cadlantic.com
> > 2 Village Road
> > Sea Girt, NJ 08750
> > Tel. 732-974-1711
> > FAX 732-528-1332
> >
> > "Stephan Koster" wrote in message
> > news:3BC35618.77F6775F@web.de...
> > > John,
> > >
> > > to simplify it - there is no need to use (s::startup) to show the
error -,
> > > load this two functions:
> > >
> > > (defun c:test()
> > > (setq acaddoc (vla-get-activedocument (vlax-get-acad-object)))
> > > (vla-SetVariable acaddoc "clayer" "0")
> > > )
> > >
> > > (defun c:test4 ()
> > > (command "._undo" "_g")
> > > (entmake '((0 . "POINT")(10 0 0 0)))
> > > (command "._undo" "_end")
> > > )
> > >
> > > Run first 'test' and immediately after that 'test4'.
> > > Crashes AutoCAD always on my machine (A2Ki SP2, WinNT 4 SP6) -
> > > but only if my arx is not loaded.
> > >
> > > Stephan
Message 19 of 24
Anonymous
in reply to: Anonymous

Luis,

assuming you write and distribute an application
which uses ActiveX. Then it may crash AutoCAD on
your customers machine if he uses as well another
app written by somebody else, - for example Express Tools -,
which uses (entmake).
The function 'test4' IMHO is the normal way to use (entmake),
so the chance that crashes will come is big.
That means, even changing all your own code will not keep
you away from the hassle of this bug.

Stephan

Luis Esquivel wrote:
>
> (defun c:test()
> (setq acaddoc (vla-get-activedocument (vlax-get-acad-object)))
> (vla-SetVariable acaddoc "clayer" "0")
> )
>
> (defun c:test4 ()
> (command "._undo" "_g")
> ;;; (entmake)
> (command)
> ;;; (entmake (list '(0 . "POINT") '(10 0 0 0))) ; or if I use this line
> works fine too.
> (entmake '((0 . "POINT")(10 0 0 0)))
> ;;; (entmake)
> (command)
> (command "._undo" "_end")
> )
>
> But if I use (entmake) or (command) after and before the entmaking works
> here just fine.
>
> -..- Luis
Message 20 of 24
Anonymous
in reply to: Anonymous

Totally agree with you, btw Stephan can you email to me to test your arx
workaround.

Thanks,
Luis Esquivel

"Stephan Koster" wrote in message
news:3BC5A3B8.3F6AF4B1@cadworks.de...
> Luis,
>
> assuming you write and distribute an application
> which uses ActiveX. Then it may crash AutoCAD on
> your customers machine if he uses as well another
> app written by somebody else, - for example Express Tools -,
> which uses (entmake).
> The function 'test4' IMHO is the normal way to use (entmake),
> so the chance that crashes will come is big.
> That means, even changing all your own code will not keep
> you away from the hassle of this bug.
>
> Stephan
>
> Luis Esquivel wrote:
> >
> > (defun c:test()
> > (setq acaddoc (vla-get-activedocument (vlax-get-acad-object)))
> > (vla-SetVariable acaddoc "clayer" "0")
> > )
> >
> > (defun c:test4 ()
> > (command "._undo" "_g")
> > ;;; (entmake)
> > (command)
> > ;;; (entmake (list '(0 . "POINT") '(10 0 0 0))) ; or if I use this line
> > works fine too.
> > (entmake '((0 . "POINT")(10 0 0 0)))
> > ;;; (entmake)
> > (command)
> > (command "._undo" "_end")
> > )
> >
> > But if I use (entmake) or (command) after and before the entmaking works
> > here just fine.
> >
> > -..- Luis

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost