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.
Gelöst! Gehe zur Lösung
Gelöst von ВeekeeCZ. Gehe zur Lösung
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
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))
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
Sie finden nicht, was Sie suchen? Fragen Sie die Community oder teilen Sie Ihr Wissen mit anderen.