;********************************************************************************************* ; Dateiname : SD_Teile_nach_Benennung_loeschen.lsp ; Autor : Stephan Wörz nach Vorlage von Claus Brod ; Erstellt : 2005 ; geändert : ;********************************************************************************************* ; Beschreibung: - Teile anhand der Browserbenennung selektieren und löschen ; - ;********************************************************************************************* ; Änderungen ; ; ---------------------------------------------------------------------------------------- ; ä Ì Ä Ø ö Î Ö Ú ü Ï Ü Û ß Þ ° ³ ; ---------------------------------------------------------------------------------------- (in-package :Teo) (use-package :oli) (sd-defdialog 'SD_Teile_nach_Benennung_loeschen :dialog-title "LÚSCHE AUSWAHL" :toolbox-button t ;; ================================================================================================================================================= :variables '( ;; ------------------------------------------------------------------------------------------------------------------------------------------------- (Baugruppe :value-type :assembly :modifies nil :modifies :contents :prompt-text "Baugruppe angeben" :title "Baugruppe" :initial-value nil :after-input (progn (after-bgr-action) (CountItems) (ButtonAktiv) );end progn );end Baugruppe ;; ================================================================================================================================================= ("NUR AUF TEILEEBENE") ;; Kategorie im UI ;; ------------------------------------------------------------------------------------------------------------------------------------------------- (SuchString :value-type :string :title "SCHLÛSSEL" :initial-value "N_*" :proposals ("N_*" "*Nutenstein*" "A_Handlag*" "Z_Zusa*") :prompt-text "SuchschlÏssel eingeben" );;Suchstring (DelPattern :title "SCHLÛSSEL LÚSCHEN" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (mapcar #'DELETEFN Teile) (CountItems) ;;aktualisieren der Statistik );end progn );end DelPattern (DispPattern :title "SCHLÛSSEL ANZEIGEN" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (CreateSearch) (ActivateSearch) (sd-call-cmds (clear_vp (sd-inq-current-vp))) (mapcar #'DisplayFN Teile) );end progn );end DispPattern (DispAll :title "ALLE ANZEIGEN" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (DisplayAll) (DeactivateSearch) );end progn );;DispAll ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; ================================================================================================================================================= ("TEILEUMFANG") ;; Kategorie im UI (AnzTeile :value-type :display-only :title "Teile gesamt" ); end AnzTeile ;; --------------------------------------------------------- ;; (STATISTIK :expand-shrink (AnzUnterbaugruppe AnzVolumenteile AnzFaceparts AnzWireparts AnzBehaelter AnzA-Saetze)) (AnzUnterbaugruppe :value-type :display-only :title "Unterbaugr." ); end AnzUnterbaugruppe ;; --------------------------------------------------------- (AnzVolumenteile :value-type :display-only :title "Volumenteile" ); end AnzVolumenteile ;; --------------------------------------------------------- (AnzFaceparts :value-type :display-only :title "Flaechenteile" ); end AnzFaceparts ;; --------------------------------------------------------- (AnzWireparts :value-type :display-only :title "Drahtteile" ); end AnzWireparts ;; --------------------------------------------------------- (AnzBehaelter :value-type :display-only :title "Behaelter" ); end AnzBehaelter ;; --------------------------------------------------------- (AnzEmptyParts :value-type :display-only :title "Leere Teile" ); end AnzBehaelter ;; --------------------------------------------------------- (AnzA-Saetze :value-type :display-only :title "AnsSaetze" ); end AnzA-Saetze ;; --------------------------------------------------------- (AnzAktoren :value-type :display-only :title "AKTOREN" ); end AnzA-Saetze ;; --------------------------------------------------------- (AnzSensoren :value-type :display-only :title "SENSOREN" ); end AnzA-Saetze ;; ================================================================================================================================================= ("ANZEIGEN") ;; Kategorie im UI ;; ------------------------------------------------------------------------------------------------------------------------------------------------- (DispHandlager :title "HANDLAGER BGR." :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "A_Handlager*") (setf Teile (sd-call-cmds (get_selection :focus_type *SD-ASSEMBLY-SELTYPE* :select :recursive :in_assembly Baugruppe))) (sd-call-cmds (clear_vp (sd-inq-current-vp))) (mapcar #'DisplayFN Teile) (CreateSearch) (ActivateSearch) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) (CountItems) ;;aktualisieren der Statistik );end progn );end DispHandlager ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- (DispFaceParts :title "FLAECHENTEILE" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf FaceParts (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_face_part :check_function #'(lambda (pa) (if (sd-inq-face-part-p pa) :ok :filter)) :select :recursive :in_assembly Baugruppe))) (sd-call-cmds (clear_vp (sd-inq-current-vp))) (mapcar #'DisplayFN FaceParts) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) (CountItems) ;;aktualisieren der Statistik );end progn );end DispFaceParts ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- (DispWireParts :title "DRAHTTEILE" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf WireParts (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :check_function #'(lambda (pa) (if (sd-inq-wire-part-p pa) :ok :filter)) :select :recursive :in_assembly Baugruppe))) (sd-call-cmds (clear_vp (sd-inq-current-vp))) (mapcar #'DisplayFN WireParts) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) );end progn );end DispFaceParts ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- ("Aktoren & Sensoren") ;; Kategorie im UI ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- (DispAktoren :title "AKTOREN" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf Aktoren (sd-call-cmds (get_selection :focus_type (list *sd-part-seltype* *sd-assembly-seltype*) :check_function #'(lambda (pa) (if (string= (sd-inq-item-attribute pa "LESATECH_BOM_ATTR" :Aktor :attachment :contents ) "1") :ok :filter)) :select :recursive :in_assembly Baugruppe))) (sd-call-cmds (clear_vp (sd-inq-current-vp))) (mapcar #'DisplayFN Aktoren) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) );end progn );;DispAktoren ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- (DispSensoren :title "SENSOREN" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf Sensoren (sd-call-cmds (get_selection :focus_type (list *sd-part-seltype* *sd-assembly-seltype*) :check_function #'(lambda (pa) (if (string= (sd-inq-item-attribute pa "LESATECH_BOM_ATTR" :Sensor :attachment :contents ) "1") :ok :filter)) :select :recursive :in_assembly Baugruppe))) (sd-call-cmds (clear_vp (sd-inq-current-vp))) (mapcar #'DisplayFN Sensoren) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) );end progn );;DispSensoren ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- (DispAktorenSensoren :title "AKTOREN & SENSOREN" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf AktorenSensoren (sd-call-cmds (get_selection :focus_type (list *sd-part-seltype* *sd-assembly-seltype*) :check_function #'(lambda (pa) (if (or (string= (sd-inq-item-attribute pa "LESATECH_BOM_ATTR" :Aktor :attachment :contents ) "1") (string= (sd-inq-item-attribute pa "LESATECH_BOM_ATTR" :Sensor :attachment :contents ) "1") ) :ok :filter)) :select :recursive :in_assembly Baugruppe))) (sd-call-cmds (clear_vp (sd-inq-current-vp))) (mapcar #'DisplayFN AktorenSensoren) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) );end progn );;DispSensoren ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- (DispAS_Map :title "AS MAP" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf AktorenSensoren (sd-call-cmds (get_selection :focus_type (list *sd-part-seltype* *sd-assembly-seltype*) :check_function #'(lambda (pa) (if (or (string= (sd-inq-item-attribute pa "LESATECH_BOM_ATTR" :Aktor :attachment :contents ) "1") (string= (sd-inq-item-attribute pa "LESATECH_BOM_ATTR" :Sensor :attachment :contents ) "1") ) :ok :filter)) :select :recursive :in_assembly Baugruppe))) ; (sd-call-cmds (clear_vp (sd-inq-current-vp))) (set_part_base_transparency :parts Teile :transp 0.9 ) (mapcar #'TransFN AktorenSensoren) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) );end progn );;DispAS_Map ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- (DispNoAS :title "KEINE A&S" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf NoAS (sd-call-cmds (get_selection :focus_type (list *sd-part-seltype* *sd-assembly-seltype*) :check_function #'(lambda (pa) (if (or (string= (sd-inq-item-attribute pa "LESATECH_BOM_ATTR" :Aktor :attachment :contents ) "1") (string= (sd-inq-item-attribute pa "LESATECH_BOM_ATTR" :Sensor :attachment :contents ) "1") );;or :ok :filter)) :select :recursive :in_assembly Baugruppe))) (DisplayAll) (mapcar #'HideFN NoAS ) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) );end progn );;DispNoAS ;;;; ------------------------------------------------------------------------------------------------------------------------------------------------- ("LOESCHEN") ;; Kategorie im UI ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Löschen aller Baugruppen (*SD-ASSEMBLY-SELTYPE*) deren Browserbenennung mit "A_Handlager*" beginnt (DelHandlager :title "HANDLAGER BGR." :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "A_Handlager*") (setf Teile (sd-call-cmds (get_selection :focus_type *SD-ASSEMBLY-SELTYPE* :select :recursive :in_assembly Baugruppe))) (mapcar #'DELETEFN Teile) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) (CountItems) ;;aktualisieren der Statistik );end progn );end DelHandlager ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Löschen aller Ansichtensätze (*sd-layout-seltype*) (DelA-Satz :title "ANSICHTENSAETZE" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf Teile (sd-call-cmds (get_selection :focus_type *sd-layout-seltype* :select :recursive :in_assembly Baugruppe))) (mapcar #'DELETEFN Teile) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) (CountItems) ;;aktualisieren der Statistik );end progn );end DelA-Satz ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Löschen aller Flächenteile (*sd-part-seltype* :allow_face_part) (DelFaceParts :title "FLAECHENTEILE" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf FaceParts (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_face_part :check_function #'(lambda (pa) (if (sd-inq-face-part-p pa) :ok :filter)) :select :recursive :in_assembly Baugruppe))) (mapcar #'DELETEFN FaceParts) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) (CountItems) ;;aktualisieren der Statistik );end progn );end DelFaceParts ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Löschen aller Drahtteile (*sd-part-seltype* :allow_wire_part) (DelWireParts :title "DRAHTTEILE" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf WireParts (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :check_function #'(lambda (pa) (if (sd-inq-wire-part-p pa) :ok :filter)) :select :recursive :in_assembly Baugruppe))) (mapcar #'DELETEFN WireParts) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) (CountItems) ;;aktualisieren der Statistik );end progn );end DelWireParts ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Löschen aller leeren Teile (*sd-part-seltype* :allow_wire_part) (DelEmpties :title "LEERE TEILE" :toggle-type :wide-toggle :initial-enable nil :push-action (progn (setf Suchstring "*") (setf EmptyParts (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :check_function #'(lambda (pa) (if (sd-inq-empty-part-p pa) :ok :filter );;if );;lambda :select :recursive :in_assembly Baugruppe );;get_selection );;sd-call-cmds );;setf (mapcar #'DELETEFN EmptyParts) (setf Suchstring "") ;;Vorgabe für Variable Suchstring setzen (after-bgr-action) ;;zurücksetzen auf Teile (*sd-part-seltype*) (CountItems) ;;aktualisieren der Statistik );end progn );;DelEmpties ;; ------------------------------------------------------------------------------------------------------------------------------------------------- );end variables ;; ================================================================================================================================================= :local-functions '( ;; ---------------------------------------------------------------------------------------------------------------------------------------------------- (CreateSearch () (progn (sd-create-browser-search "parcel-gbrowser" :name "DUMMY" :title "DUMMY" :criteria `( (:column :instance-name :Operation :equals :value ,Suchstring)) :match :all :case-sensitive nil :enable t );;sd-create-browser-search );;progn );;CreateSearch ;; ---------------------------------------------------------------------------------------------------------------------------------------------------- (ActivateSearch () (sd-set-current-browser-search "parcel-gbrowser" "DUMMY" :activate t :persistent nil );;sd-set-current-browser-search );;ActivateSearch ;; ------------------------------------------------------------------------------------------------------------------------------------------------- (DeactivateSearch () (sd-set-current-browser-search "parcel-gbrowser" "TOOL" :activate nil :persistent nil );;sd-set-current-browser-search );;DeactivateSearch ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Function zum löschen der selektierten Teile (DELETEFN (item) (when (sd-string-match-pattern-p SuchString (sd-inq-obj-basename item)) (sd-call-cmds (delete_3d (sd-inq-obj-pathname item)))) );end DELETEFN ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum wählen aller Teile rekursiv in Baugruppe (after-bgr-action () (setf Teile (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_face_part :allow_wire_part :select :recursive :in_assembly Baugruppe))) );end after-bgr-action ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Function zum anzeigen der selektierten Teile (DisplayFN (item) (when (sd-string-match-pattern-p SuchString (sd-inq-obj-basename item)) (sd-call-cmds (add_to_vp_drawlist (sd-inq-current-vp)(sd-inq-obj-pathname item)))) (fit_vp (sd-inq-current-vp)) ); end DisplayFN ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Function zum ausblenden der selektierten Teile (HideFN (item) (when (sd-string-match-pattern-p SuchString (sd-inq-obj-basename item)) (sd-call-cmds (remove_from_vp_drawlist (sd-inq-current-vp)(sd-inq-obj-pathname item)))) (fit_vp (sd-inq-current-vp)) ); end DisplayFN ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Function zum Transparent machen der selektierten Teile (TransFN (item) (if (sd-string-match-pattern-p SuchString (sd-inq-obj-basename item)) (progn (set_part_base_transparency :parts (sd-inq-obj-pathname item) :transp 0 ) (fit_vp (sd-inq-current-vp)) );;progn );;if ); end DisplayFN ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Function zum zeigen Teile (DisplayAll() (progn (sd-call-cmds (clear_vp (sd-inq-current-vp))) (sd-call-cmds (add_to_vp_drawlist (sd-inq-current-vp) :without-wp (sd-inq-obj-pathname Baugruppe))) (fit_vp (sd-inq-current-vp)) );;progn ); end DisplayFN ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum aktivieren der Buttons nach Auswahl einer Baugruppe (ButtonAktiv () (sd-set-variable-status 'DelHandlager :enable t ) (sd-set-variable-status 'DelFaceParts :enable t ) (sd-set-variable-status 'DelWireParts :enable t ) (sd-set-variable-status 'DelA-Satz :enable t ) (sd-set-variable-status 'DelPattern :enable t ) (sd-set-variable-status 'DispHandlager :enable t ) (sd-set-variable-status 'DispFaceParts :enable t ) (sd-set-variable-status 'DispWireParts :enable t ) (sd-set-variable-status 'DispPattern :enable t ) (sd-set-variable-status 'DispAll :enable t ) (sd-set-variable-status 'DelEmpties :enable t ) (sd-set-variable-status 'DispAktoren :enable t ) (sd-set-variable-status 'DispSensoren :enable t ) (sd-set-variable-status 'DispAktorenSensoren :enable t ) (sd-set-variable-status 'DispAS_Map :enable t ) (sd-set-variable-status 'DispNoAS :enable t ) ); end ButtonAktiv ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Zählen der Baugruppen und Teile (CountItems () (let (vdteil vfteil) (setf AnzUnterbaugruppe (length (sd-call-cmds (get_selection :focus_type *sd-assembly-seltype* :select :recursive :in_assembly Baugruppe)))) (setf AnzTeile (length (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :allow_face_part :select :recursive :in_assembly Baugruppe)))) (setf AnzVolumenteile (length (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :allow_face_part :check_function #'(lambda (si) (let () (if (or (sd-inq-face-part-p si) (sd-inq-wire-part-p si)) :filter :ok );;if );;let );;lambda :select :recursive :in_assembly Baugruppe)))) (setf AnzEmpties (length (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :allow_face_part :check_function #'(lambda (si) (let () (if (sd-inq-empty-part-p si) :filter :ok );;if );;let );;lambda :select :recursive :in_assembly Baugruppe)))) (setf AnzAktoren (length (sd-call-cmds (get_selection :focus_type (list *sd-part-seltype* *sd-assembly-seltype*) :check_function #'(lambda (si) (let () (if (not (string= (sd-inq-item-attribute si "LESATECH_BOM_ATTR" :Aktor :attachment :contents ) "1")) :filter :ok );;if );;let );;lambda :select :recursive :in_assembly Baugruppe))) );;setf AnzAktoren (setf AnzSensoren (length (sd-call-cmds (get_selection :focus_type (list *sd-part-seltype* *sd-assembly-seltype*) :check_function #'(lambda (si) (let () (if (not (string= (sd-inq-item-attribute si "LESATECH_BOM_ATTR" :Sensor :attachment :contents ) "1")) :filter :ok );;if );;let );;lambda :select :recursive :in_assembly Baugruppe))) );;setf AnzAktoren (setf vdteil (length (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :allow_face_part :check_function #'(lambda (si) (let () (if (sd-inq-face-part-p si) :filter :ok );;if );;let );;lambda :select :recursive :in_assembly Baugruppe)))) (setf vfteil (length (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :allow_face_part :check_function #'(lambda (si) (let () (if (sd-inq-wire-part-p si) :filter :ok );;if );;let );;lambda :select :recursive :in_assembly Baugruppe)))) (setf vcntteil (length (sd-call-cmds (get_selection :focus_type *sd-assembly-seltype* :allow_wire_part :allow_face_part :check_function #'(lambda (si) (let () (if (sd-inq-container-p si) :filter :ok );;if );;let );;lambda :select :recursive :in_assembly Baugruppe)))) (setf AnzA-Saetze (length (sd-call-cmds (get_selection :focus_type *sd-layout-seltype* :select :recursive :in_assembly Baugruppe)))) (setf AnzWireparts (- vdteil AnzVolumenteile )) (setf AnzFaceparts (- vfteil AnzVolumenteile )) (setf AnzBehaelter (- AnzUnterbaugruppe vcntteil)) (setf AnzEmptyParts (- vdteil AnzEmpties )) );;let ); end CountItems ); end local functions ;; ------------------------------------------------------------------------------------------------------------------------------------------------- :ok-action ' (sd-delete-browser-search "parcel-gbrowser" "DUMMY") :help-action ' (progn (sd-display-url ( Format NIL "~A/SD_Teile_nach_Benennung_loeschen.htm" (oli::sd-convert-filename-from-platform (oli::sd-sys-getenv "SCHILLERHELPDIR")))) ); end progn )