Script stops running after lisp

Script stops running after lisp

djurk_haas
Advocate Advocate
1,802 Views
6 Replies
Message 1 of 7

Script stops running after lisp

djurk_haas
Advocate
Advocate

Hello,

 

I have a script (see below) that stops running after the "_Situatie" (Insert_Situatie.lsp).

The lisp "_Situatie" works fine, it's even executed by the script, but is causes to stop running the last part of the script.

I have run the script without the "_Situatie" (Insert_Situatie.lsp) and than it runs fine untill the end so the problm is caused by the lisp  "Insert_Situatie" but I can't figer out why.

 

Thanks in advance

 

----Script code-----

_open
"H:\BV3-TRANSMIT\Onderhoek\A\RV CZE A E0000\RV CZE A E0000.dwg"
_Situatie
_Stempel

-----lisp code-----

(defun C:Situatie ()

(command "_insert" "Situatie=E:\\data_tek\\AutoCAD-Custom_JHD\\Algemeen\\Situatie\\Situatie.dwg" nil)

(princ)
)

 

 

0 Likes
Accepted solutions (1)
1,803 Views
6 Replies
Replies (6)
Message 2 of 7

cadffm
Consultant
Consultant

Do not CANCEL the insert command - Your NIL canceled the command and breaks the script.

Insert the block-reference and delete them.

Sebastian

0 Likes
Message 3 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

@cadffm wrote:

Do not CANCEL the insert command - Your NIL canceled the command and breaks the script.

Insert the block-reference and delete them.


 

[Without setting up the situation and experimenting....]

 

The (command) function always returns nil.  If a nil return "breaks the script," wouldn't any (command) function do so, whether or not it ends with nil internally?

Kent Cooper, AIA
0 Likes
Message 4 of 7

Kent1Cooper
Consultant
Consultant

Maybe you can instead use (vl-cmdf), which always returns T.

Kent Cooper, AIA
0 Likes
Message 5 of 7

cadffm
Consultant
Consultant

the returning is not the problem

(vl-cmdf) or (command) at the right place will evaluate(? wrong wording) to [ESC]

 

 

(defun C:Situatie ()
(command "_insert" "Situatie=E:\\data_tek\\AutoCAD-Custom_JHD\\Algemeen\\Situatie\\Situatie.dwg")
(command) ; or (vl-cmdf)
(princ)
)

 

works,

but in 2020 is a bug and iam not sure that it is a problem in this case (an invisible problem which users not seeing in time)

Sebastian

0 Likes
Message 6 of 7

Sea-Haven
Mentor
Mentor

A -insert requires name pt X Y rot so where are they ? This will stop a script. You can erase "last" block definition is still in dwg.

0 Likes
Message 7 of 7

cadffm
Consultant
Consultant

@Sea-Haven 

as i wrote too, but:

 

What you and me wrotes is just the normal way to ends the command sequence fully.

 

But if ONLY like to redefining a block in AutoCAD (by hand) you

starts the (classic) INSERT command, choose your DWG,

acknowledge the re-define question and.... 

 

Exactly: You don't set the insertion point, scale and rotation and deletes the new blockreference,

you skip the command by pressing [ESC] and you can do this in  Lisp too,  by using the (command) or (vl-cmdf) statement.

____

 


cadffm schrieb:

..but in 2020 is a bug and iam not sure that it is a problem in this case (an invisible problem which users not seeing in time)


I checked this: It was just a Problem when you want to create a blockreference, but here in this thread we don't want to create a block reference, so it is´also in 2020 not a problem to go this way.

Sebastian

0 Likes