Kreisel Block enthält jetzt alle Attribute die wir auch in die csv Datei schreiben wollen. Änderung des Blocks führt zum auslesen der Attribute und zum Neuerzeugung mit den bereits gesetzten Attributen nur mit neuer Länge.
This commit is contained in:
@@ -277,6 +277,76 @@
|
||||
)
|
||||
)
|
||||
|
||||
;; Alle Attribute eines INSERT-Entity als Assoziationsliste lesen.
|
||||
;; ent = Entity-Name eines INSERT mit Attributen.
|
||||
;; Rueckgabe: (("TAG1" . "Wert1") ("TAG2" . "Wert2") ...) oder nil
|
||||
(defun ssg-attrib-read (ent / e ed result)
|
||||
(setq e (entnext ent))
|
||||
(while e
|
||||
(setq ed (entget e))
|
||||
(if (equal (cdr (assoc 0 ed)) "SEQEND")
|
||||
(setq e nil)
|
||||
(progn
|
||||
(if (equal (cdr (assoc 0 ed)) "ATTRIB")
|
||||
(setq result (cons (cons (cdr (assoc 2 ed)) (cdr (assoc 1 ed))) result))
|
||||
)
|
||||
(setq e (entnext e))
|
||||
)
|
||||
)
|
||||
)
|
||||
(reverse result)
|
||||
)
|
||||
|
||||
;; Default-Attribute aus einer Definitionsliste erzeugen.
|
||||
;; attrib-defs = Liste von (TAG DEFAULT) Paaren, z.B. '(("TYP" "A") ("NR" "0"))
|
||||
;; Rueckgabe: Assoziationsliste (("TYP" . "A") ("NR" . "0") ...)
|
||||
(defun ssg-attrib-defaults (attrib-defs / result)
|
||||
(foreach def attrib-defs
|
||||
(setq result (cons (cons (car def) (cadr def)) result))
|
||||
)
|
||||
(reverse result)
|
||||
)
|
||||
|
||||
;; Gegebene Attribute mit Defaults zusammenfuehren.
|
||||
;; given = alist mit Ueberschreibungen (darf nil sein)
|
||||
;; attrib-defs = Definitionsliste ((TAG DEFAULT) ...)
|
||||
;; Rueckgabe: vollstaendige alist mit allen Tags
|
||||
(defun ssg-attrib-merge (given attrib-defs / defaults pair existing)
|
||||
(setq defaults (ssg-attrib-defaults attrib-defs))
|
||||
(if given
|
||||
(foreach pair given
|
||||
(setq existing (assoc (car pair) defaults))
|
||||
(if existing
|
||||
(setq defaults (subst pair existing defaults))
|
||||
(setq defaults (append defaults (list pair)))
|
||||
)
|
||||
)
|
||||
)
|
||||
defaults
|
||||
)
|
||||
|
||||
;; Unsichtbare ATTDEF-Entities bei (0,0) erzeugen.
|
||||
;; Muss VOR dem _BLOCK-Befehl aufgerufen werden, damit die ATTDEFs
|
||||
;; Teil der Blockdefinition werden.
|
||||
;; attrib-defs = Definitionsliste ((TAG DEFAULT) ...)
|
||||
;; text-height = Texthoehe der ATTDEFs (z.B. 50.0)
|
||||
(defun ssg-attrib-make-defs (attrib-defs text-height / ypos)
|
||||
(setq ypos 0.0)
|
||||
(foreach def attrib-defs
|
||||
(entmake (list
|
||||
'(0 . "ATTDEF")
|
||||
'(8 . "0")
|
||||
(cons 10 (list 0.0 ypos 0.0))
|
||||
(cons 40 text-height)
|
||||
(cons 1 (cadr def))
|
||||
(cons 3 (car def))
|
||||
(cons 2 (car def))
|
||||
'(70 . 1)
|
||||
))
|
||||
(setq ypos (- ypos (* text-height 2.0)))
|
||||
)
|
||||
)
|
||||
|
||||
;; Attribut eines Blocks anhand seines Handle suchen und aendern
|
||||
;; handle = Entity-Handle (String) des INSERT
|
||||
;; tag = Attributbezeichner
|
||||
|
||||
Reference in New Issue
Block a user