Anpassung einer Lisp

Anpassung einer Lisp

yannik.tuechler
Advocate Advocate
714 Views
7 Replies
Message 1 of 8

Anpassung einer Lisp

yannik.tuechler
Advocate
Advocate

Hallo,

 

ich habe vor einiger Zeit eine Lisp geschrieben. Alles funktioniert, wie ich möchte.

 

Eine Sache würde ich noch wissen wollen:

Wenn ich meinen Befehl wiederholt benutzen möchte, kann ich nicht einfach "bestätigen", da dieser eine Auswahl braucht (screen1). In anderen Befehlen, merken sie sich die letzte Eingabe (screen2).

Mir fehlt dieser schwarze Punkt, der bei anderen Befehlen die aktuelle Auswahl anzeigt.

0 Likes
Accepted solutions (1)
715 Views
7 Replies
Replies (7)
Message 2 of 8

yannik.tuechler
Advocate
Advocate

anbei die Datei....

0 Likes
Message 3 of 8

Sea-Haven
Mentor
Mentor

This may be useful, you can save the button picked so when ran again it will show last used value. Has example code at top.

 

 

0 Likes
Message 4 of 8

yannik.tuechler
Advocate
Advocate

Hi, danke dir für deine Antwort

Ich verstehe nur nicht ganz, wie ich diesen Befehl aktivieren soll...

 

In meiner Lisp steht: "(defun c:TRL ()...", somit kann ich in Autocad TRL eingeben und dann aktiviert sich der Befehl.

Was muss ich bei deiner Lisp eingeben, oder muss ich noch etwas anpassen?

0 Likes
Message 5 of 8

ВeekeeCZ
Consultant
Consultant

How about not specifying a number of points at all? Just draw a polyline and end it with an RT click when you have as many segments as you need. 

 

(vl-load-com)

(defun c:TRL ( / e) (command "_.-LAYER" "_t" "T__KONS" "_m" "T__KONS" "" "_.CELTYPE" "Verdeckt" "_.CECOLOR" "7" "_.CELTSCALE" "2.5") (setq e (entlast)) (command "_.pline") (while (> (getvar 'cmdactive) 0) (command pause)) (if (not (equal e (setq e (entlast)))) (command "_.Lengthen" "_delta" 0.25 (trans (vlax-curve-getstartpoint e) 0 1) (trans (vlax-curve-getendpoint e) 0 1) "" "_explode" e)) (command "_.-LAYER" "_t" "T__KONS" "_m" "T__KONS" "" "_.CELTYPE" "Verdeckt" "_.CECOLOR" "7" "_.CELTSCALE" "1") (princ) )

 

0 Likes
Message 6 of 8

yannik.tuechler
Advocate
Advocate

Hi, die Punkte (0 - 3) sind Eckpunkte, dieser Linie.

Die sollten drin bleiben.

 

Wenn ich die 1 ausgewählt habe, hat diese Linie einen Eckpunkt.

Wenn ich diesen Befehl direkt nochmal benutzen möchte, soll die 1 schon ausgewählt sein in der Liste.

So wie es in screen2 ist, möchte ich es haben...

0 Likes
Message 7 of 8

ВeekeeCZ
Consultant
Consultant
Accepted solution

Sorry, Yes/No prompts are against my faith. I prefer more efficient solutions.

 

(defun c:TRL ()

  (or *Anzahl_Eckpunkte*
      (setq *Anzahl_Eckpunkte* "2")) ; 
  
	(command "_.-LAYER" "_t" "T__KONS" "_m" "T__KONS" "" "_.CELTYPE" "Continuous" "_.CECOLOR" "7" "_.CELTSCALE" "2.5")
	(initget "0 1 2 3")
		(setq *Anzahl_Eckpunkte* (cond ((getkword (strcat "\nWie viele Eckpunkte? [0/1/2/3] <" *Anzahl_Eckpunkte* ">: ")))
					       (*Anzahl_Eckpunkte*)))
			(cond
				((= *Anzahl_Eckpunkte* "0")
					(setq pt1 (getpoint "\nAnfangspunkt"))
					(setq pt2 (getpoint "\nEndpunkt"))

					(command "_.Line" pt1 pt2 "")
					(command "_.Lengthen" "_delta" 0.25 pt1 "")
					(command "_.Lengthen" "_delta" 0.25 pt2 "")
				)

				((= *Anzahl_Eckpunkte* "1")
					(setq pt1 (getpoint "\nAnfangspunkt"))
					(setq ptk (getpoint "\nEckpunkt"))
					(setq pt2 (getpoint "\nEndpunkt"))

					(command "_.Line" pt1 ptk "")
					(command "_.Line" ptk pt2 "")
					(command "_.Lengthen" "_delta" 0.25 pt1 "")
					(command "_.Lengthen" "_delta" 0.25 pt2 "")
				)

				((= *Anzahl_Eckpunkte* "2")
					(setq pt1 (getpoint "\nAnfangspunkt"))
					(setq ptk1 (getpoint "\n1. Eckpunkt"))
					(setq ptk2 (getpoint "\n2. Eckpunkt"))
					(setq pt2 (getpoint "\nEndpunkt"))

					(command "_.Line" pt1 ptk1 "")
					(command "_.Line" ptk1 ptk2 "")
					(command "_.Line" ptk2 pt2 "")
					(command "_.Lengthen" "_delta" 0.25 pt1 "")
					(command "_.Lengthen" "_delta" 0.25 pt2 "")
				)

				((= *Anzahl_Eckpunkte* "3")
					(setq pt1 (getpoint "\nAnfangspunkt"))
					(setq ptk1 (getpoint "\n1. Eckpunkt"))
					(setq ptk2 (getpoint "\n2. Eckpunkt"))
					(setq ptk3 (getpoint "\n3. Eckpunkt"))
					(setq pt2 (getpoint "\nEndpunkt"))

					(command "_.Line" pt1 ptk1 "")
					(command "_.Line" ptk1 ptk2 "")
					(command "_.Line" ptk2 ptk3 "")
					(command "_.Line" ptk3 pt2 "")
					(command "_.Lengthen" "_delta" 0.25 pt1 "")
					(command "_.Lengthen" "_delta" 0.25 pt2 "")
				)
			)
(command "_.-LAYER" "_t" "T__KONS" "_m" "T__KONS" "" "_.CELTYPE" "Continuous" "_.CECOLOR" "7" "_.CELTSCALE" "1")
(princ)
)

 

0 Likes
Message 8 of 8

yannik.tuechler
Advocate
Advocate

Perfekt danke dir, genau das wollte ich!

Das mit der Ja/Nein Abfrage, galt nur als Beispiel. Mir ging es um den schwarzen Punkt, der dort kommt. 😄

0 Likes