Community
AutoCAD Produktfamilie - Deutsch
Das Forum für alle Fragen zu AutoCAD, LT, Architecture, Electrical, Map 3D, Mechanical, MEP, Plant 3D, Raster Design, Web App, sowie Autodesk Civil 3D und Advance Steel.
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 

Layerwechsel im LISP

4 ANTWORTEN 4
GELÖST
Antworten
Nachricht 1 von 5
Doodiejack
257 Aufrufe, 4 Antworten

Layerwechsel im LISP

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.

4 ANTWORTEN 4
Nachricht 2 von 5
ВeekeeCZ
als Antwort auf: Doodiejack

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

 

eekeeCZ_0-1731678569795.png

 

Nachricht 3 von 5
Kent1Cooper
als Antwort auf: Doodiejack

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
als Antwort auf: Doodiejack

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
als Antwort auf: Doodiejack

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.

In Foren veröffentlichen  

Autodesk Design & Make Report