-laydel command need to respond with Enter

jmayo-EE
Mentor

-laydel command need to respond with Enter

jmayo-EE
Mentor
Mentor

Hello everyone,

 

I am trying to learn lisp and my first task is to silent run Laydel to remove a layer and it's contents. I have this but the red "" for Enter does not seem to work. Is this the correct way to respond automatically with Enter?

 

(defun c:DeletePVCaseLayer ()
(command "-LAYDEL" "N" "PVcase PV Modules (detailed)" "" "Y")
(princ "\nLayer 'PVcase PV Modules (detailed)' has been deleted.")
(princ)
)

 

This is forcing user input at the command line.

Command: (load"LD")
C:DELETEPVCASELAYER

Command: LD
-LAYDEL
Select object on layer to delete or [Name]: N
Enter layer name or [?]: PVcase PV Modules (detailed)
Selected layers: PVcase PV Modules (detailed).
Select object on layer to delete or [Name/Undo]: Y

*Invalid selection*
Expects a point or Last/Name
; error: Function cancelled

Select object on layer to delete or [Name/Undo]:

******** WARNING ********

There are 4 block definition(s) which reference the layer(s) you are deleting.
The block(s) will be redefined and the entities referencing the layer(s)
will be removed from the block definition(s).

You are about to delete layer "PVcase PV Modules (detailed)" from this drawing.

Do you wish to continue? [Yes/No] <No>: Regenerating model.

Operation aborted.

Thanks for any insight and assistance,

John

John Mayo

EESignature

0 Likes
Reply
Accepted solutions (1)
133 Views
3 Replies
Replies (3)

Kent1Cooper
Consultant
Consultant
Accepted solution

Works for me:

 

Command: (command "-LAYDEL" "N" "2" "" "Y")
-LAYDEL
Select object on layer to delete or [Name]: N
Enter layer name or [?]: 2
Selected layers: 2.
Select object on layer to delete or [Name/Undo]:
******** WARNING ********

You are about to delete layer "2" from this drawing.

Do you wish to continue? [Yes/No] <No>: Y

Deleting layer "2".
1 layer deleted.

 

[It doesn't work if the specified Layer is current, but in that case there is a message to that effect, which I don't see in your command history.]

Kent Cooper, AIA
0 Likes

jmayo-EE
Mentor
Mentor

Sorry please ignore, it is working.

 

John

 

John Mayo

EESignature

0 Likes

jmayo-EE
Mentor
Mentor

Thanks for replying Kent. It does work for me as well. I must have not reloaded it during the failed test.

 

John

John Mayo

EESignature

0 Likes