Layerwechsel im LISP

Layerwechsel im LISP

Doodiejack
Contributor Contributor
781Aufrufe
4Antworten
Nachricht 1 von 5

Layerwechsel im LISP

Doodiejack
Contributor
Contributor

Hallo

 

Ich habe folgendes Programm geschrieben:

 

(defun c:Hilfslinie2 ()
(setq aktiverLayer (getvar "CLAYER")) ; Speichert den aktuellen Layer
(setvar "CLAYER" "H1_HILFSLINIE") ; Setzt den Layer auf "H1_HILFSLINIE"
(command "strahl") ; Startet den STRAHL-Befehl
(setvar "CLAYER" aktiverLayer) ; Setzt den ursprünglichen Layer zurück
(princ) ; Beendet das Skript sauber
)

 

Die Idee ist, das der aktuelle Layer gespeichert wir. 

Anschliessend auf den Layer H1_HILFSLINIE gewechselt wird.

Dann wird der STRAHL Befehl ausgeführt und wenn ich fertig bin,

wird wieder auf den ursprünglichen Layer zurück gewechselt.

 

In der oberen Version wechselt es den Layer nicht auf den H1_HILFSLINIE sondern macht den Strahl im aktuellen Layer.

 

Kann mir jemnd weiterhelfen, wie ich das problem Löse.

Bin auch offen für Lösungen die nicht über ein LISP gehen.

 

Vielen Dank dür eure Hilfe.

0 „Gefällt mir“-Angaben
Akzeptierte Lösungen (1)
782Aufrufe
4Antworten
Antworten (4)
Nachricht 2 von 5

ВeekeeCZ
Consultant
Consultant
Akzeptierte Lösung

Option number one - use Tool Palettes. No lisp is needed.

 

eekeeCZ_0-1731678569795.png

 

0 „Gefällt mir“-Angaben
Nachricht 3 von 5

Kent1Cooper
Consultant
Consultant

The [going into English here] RAY command is left active after the conclusion of the (command) function, then while it's waiting for User input, the Layer gets set back, then the command continues to wait for input.  You need to allow for completion of the command before resetting the Layer.  Here are two ways to do that:

(command-s "strahl") ; Startet den STRAHL-Befehl [and allow you to finish it before moving on]

or

(command "strahl") ; Startet den STRAHL-Befehl

(while (> (getvar 'cmdactive) 0) (command pause)); wait for User inputs until command is complete

Kent Cooper, AIA
Nachricht 4 von 5

ВeekeeCZ
Consultant
Consultant

Or this enhanced lisp of yours.

It creates, thaws a layer if needed, makes it current, and always gets the original layer back.

 

(defun c:H1 ( / o) (setq o (getvar 'clayer)) (command "_.layer" "_t" "H1_HILFSLINIE" "_m" "H1_HILFSLINIE" "_c" 15 "" "") (command-s "_.ray") (setvar 'clayer o) (princ))

Nachricht 5 von 5

cadffm
Consultant
Consultant

Hi,

"(command "strahl") ; Startet den STRAHL-Befehl

Du startest nur den Befehl, danach setzt du den alten Layer aktuell und das Lisp ist fertig.

Den Strahl zeichnest du dann wenn das Lisp schon zuende ist.

Problem: Die Command-Anweisung möchte /braucht ALLE Eingaben!

 

Dafür kannst du auch Platzhalter für Benutzereingaben angeben, aber das müssen genau soviele wie nötig sein!

 

EINE Eingabe ist PAUSE

also (command "Strahl" PAUSE)

 

aber ich denke du machst mehr wie nur eine Eingabe.. aber nun kannst du das Ganze fertigstellen,?

 

 

Offtopic

(setvar "CLAYER" "H1_HILFSLINIE") ; Setzt den Layer auf "H1_HILFSLI

Tip: Mache das mit Befehl LAYER (oder -LAYER und option MACHEN

so funktioniert es auch wenn es den Layer noch nicht gab!

 

 

 

Sebastian

0 „Gefällt mir“-Angaben