;********************************************************************************************* ; Dateiname : SD_LayoutTool.lsp ; Autor : Stephan Wörz ; Erstellt : 12.03.2007 ; geändert : ;********************************************************************************************* ; Beschreibung : Funktionen zum erstellen von Layouts ; - ;********************************************************************************************* ; Änderungen ; ;********************************************************************************************* ; ---------------------------------------------------------------------------------------- ; ä Ì Ä Ø ö Î Ö Ú ü Ï Ü Û ß Þ ° ³ ; ---------------------------------------------------------------------------------------- (in-package :Teo) (use-package :oli) (setf si::*enter-break-handler* t) (sd-defdialog 'SD_LayoutTool :dialog-title "LAYOUTTOOL" :toolbox-button t :mutual-exclusion '(V_DelOrgAssy V_HideOrgAssy) ;; ================================================================================================================================================= :variables '( ;; ------------------------------------------------------------------------------------------------------------------------------------------------- (V_Baugruppe :value-type :assembly :prompt-text "Baugruppe angeben" :title "Baugruppe" :initial-value nil :after-input (progn (CountItems) (select_parts) (mapcar #'FindMinGeoRes Teile) (setf minRES_UI minRes) );;progn :modifies nil );end V_Baugruppe ("OPTIONEN") ;; (V_DelImportAssy :value-type :boolean ;; :toggle-type :wide-toggle ;; :initial-value nil ;; :title "Importbaugruppe loeschen" ;; );;V_DelImportAssy (V_DelOrgAssy :value-type :boolean :toggle-type :wide-toggle :initial-value nil :title "Orginalbaugruppe loeschen" );;V_DelOrgAssy (V_HideOrgAssy :value-type :boolean :toggle-type :wide-toggle :initial-value nil :title "Orginalaugruppe ausblenden" );;V_HideOrgAssy (V_Delete_N :value-type :boolean :toggle-type :wide-toggle :initial-value nil :title "Normteile loeschen" );;V_Delete_N (V_PartsToRoot :value-type :boolean :toggle-type :wide-toggle :initial-value nil :title "Importteile ins Root" );;V_PartsToRoot (V_UniteParts :value-type :boolean :toggle-type :wide-toggle :initial-value nil :title "Teile vereinen" );;V_UniteParts (V_AlterImportParts :value-type :boolean :toggle-type :wide-toggle :initial-value nil :title "Teile auf Layoutstatus" );;V_AlterImportParts (V_DelFaceColor :value-type :boolean :toggle-type :wide-toggle :initial-value nil :title "FlÌchenfarbe entfernen" );;V_DelFaceColor ;; ================================================================================================================================================= ("TEILEUMFANG - Orginal") ;; Kategorie im UI (AnzTeile :value-type :display-only :title "Teile gesamt" ); end AnzTeile ;; --------------------------------------------------------- (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 ;; --------------------------------------------------------- (AnzA-Saetze :value-type :display-only :title "AnsSaetze" ); end AnzA-Saetze ;; --------------------------------------------------------- (minRES_UI :value-type :display-only :title "min. Aufloesung:" ); end minRES_UI ;; --------------------------------------------------------- ("") ;; Kategorie im UI (save_file :value-type :String ;;:value-type :display-only :initial-visible nil :title "Dateiname" :initial-value "D:/PhoenixTemp/StepExport.stp" );;save_file (minRes ;;:value-type :number :initial-visible nil :initial-value 0.000001 );;minRes ;; ************************************************************ (next :title "L A Y O U T" :initial-visible NIL :toggle-type :wide-toggle :push-action (progn );;progn );;next ;; ************************************************************ (ACTION :title "STEP-EX-/IMPORT" :initial-visible t :toggle-type :wide-toggle :push-action (progn (export-step) ;; 1. Exportiert gewählte Baugruppe als STEP (import-step) ;; 2. Importiert STEP-Export (if V_HideOrgAssy (Hide_Baugruppe)) ;; 3. Orginalbaugruppe ausblenden (if V_DelOrgAssy (F_DelOrgAssy)) ;; 3. Orginalbaugruppe löschen (RenameImport) ;; 4. Importfile umbenennen (select_LayoutTeile) ;; 5. Alle neuen (importierten) Teile wählen (if V_Delete_N (mapcar #'DELETE_N LayoutTeile)) ;; 6. Normteile löschen (select_LayoutTeile) ;; 7. Alle neuen (importierten) Teile wählen ;; (break) (mapcar #'FindMinGeoRes LayoutTeile) (L_CountItems) ;; 8. Anzahl der Layoutteile zählen (mapcar #'FindMinGeoRes LayoutTeile) ;; 9. gröbste Auflösung unter den Layoutteilen (setf L_minRES_UI minRes) ;; 9. UI aktualisieren (F_RenameBlank) ;; 10. Rohling (1. Teil) umbenennen (if V_AlterImportParts (mapcar #'AlterParts LayoutTeile)) ;; Optional - Teile ändern (if V_DelFaceColor (mapcar #'DelFaceColor LayoutTeile)) ;; Optional - Flächenfarben löschen (if V_UniteParts (Unite3D)) ;; Optional - Teile vereinen (select_LayoutTeile) ;; 8. Anzahl der Layoutteile zählen ;; (UPDATE_SCREEN) ;; Bildschrim neu aufbauen (L_CountItems) ;; 8. Anzahl der Layoutteile zählen (If V_PartsToRoot (GoRoot)) ;; Optional - Teile ins Root verschieben );;progn );;ACTION ;; ************************************************************ (ToRoot :title "ROOT" :initial-visible t :toggle-type :wide-toggle :push-action (progn (GoRoot) );;progn );;ToRoot ;; ************************************************************ (TESTKNOPF_2 :title "SET-RESOLUTION" :initial-visible t :toggle-type :wide-toggle :push-action (progn ;(select_LayoutTeile) ;(display Importdaten) ;(display LayoutTeile) (mapcar #'SetGeoRes LayoutTeile) );;progn );;TESTKNOPF_2 ;; ************************************************************ (TESTKNOPF_3 :title "FIND_MIN_RESOLUTION" :initial-visible nil :toggle-type :wide-toggle :push-action (progn (mapcar #'FindMinGeoRes Teile) ;;(display (format nil "Kleinste AuflÎsung = ~Amm" minRes)) );;progn );;TESTKNOPF_3 ;; ************************************************************ ("TEILEUMFANG - LAYOUT") ;; Kategorie im UI ;; ************************************************************ (L_AnzTeile :value-type :display-only :title "Teile gesamt" ); end AnzTeile ;; --------------------------------------------------------- (L_minRES_UI :value-type :display-only :title "min. Aufloesung:" ); end minRES_UI ;; ************************************************************ );end variables ;; ================================================================================================================================================= :local-functions '( ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Function zum exportieren der selektierten Baugruppe (export-step () (sd-call-cmds(step_export :SELECT (sd-inq-obj-pathname V_Baugruppe) :FILENAME Save_File :OVERWRITE :SYS-SETTINGS :assem-struct :off );;step_export );;sd-call-cmds );;export-step (import-step () (sd-call-cmds(step_import :FILENAME Save_File :DISPLAY-OPTIONS :check-part :no );;step_import );;sd-call-cmds );;import-step ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Function zum löschen aller Normteile (DELETE_N (item) (when (sd-string-match-pattern-p "N_*" (sd-inq-obj-basename item)) (sd-call-cmds (delete_3d (sd-inq-obj-pathname item))) );;when );end DELETEFN ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Function zum vereinen aller Teile (Unite3D () (sd-call-cmds (unite_3d :blank (first LayoutTeile ) :tools (rest LayoutTeile ) :keep_tools :no :glue :no );;unite_3d ;; :success (display "Alles OK!!!!") ;; :failure (sd-display-error (format nil "~a" (sd-inq-error-obj :message))) );;sd-call-cmds );end Unite3D ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum verschieben der Teile ins ROOT (GoRoot () (progn (sd-call-cmds (change_pa_owner :new_owner "/" :parts_assemblies LayoutTeile );;change_pa_owner );;sd-call-cmds (sd-call-cmds (delete_3d (format nil "/~a" Importdaten))) );;progn );GoRoot ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum löschen der Orginalbaugruppe (F_DelOrgAssy () (sd-call-cmds (delete_3d (sd-inq-obj-pathname V_Baugruppe)))) ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum herausfinden des am schlechtesten aufgelösten Parts (FindMinGeoRes (item) (setf itemResolution (sd-inq-part-geo-resolution item)) (if (< minRes itemResolution ) (setf minRes itemResolution)) );;FindMinGeoRes ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum herabsetzen der geom. Auflösung aller Teile (SetGeoRes (item) (sd-call-cmds (part_prop :PART item :display_ui :the_part :geo_res_value :ACC-E-2)) (sd-call-cmds (display :clear-hide)) ; schließt Ausgabefenster );;SetGeoRes ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum Ändern der Teile (AlterParts (item) (sd-call-cmds (set_part_inst_color :parts item :clr )) (sd-call-cmds (set_part_base_color :parts item :color (sd-rgb-to-color (read-from-string "0.6,0.6,0.6")))) (sd-call-cmds (set_part_base_density :parts item :dens 1 )) (sd-call-cmds (set_part_base_transparency :parts item :transp 0 )) );;AlterParts ;; ------------------------------------------------------------------------------------------------------------------------------------------------ ;; Funktion zum Ändern von Flächen (DelFaceColor (item) (face_prop :the_face (sd-call-cmds (get_selection :focus_type *sd-face-seltype* :select :selected_part item :all_3d)):color :OFF) );;DelFaceColor ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum ausblenden und einpassen der Quellbaugruppe (Hide_Baugruppe () (sd-call-cmds (progn (remove_from_vp_drawlist (sd-inq-current-vp) V_Baugruppe) (fit_vp (sd-inq-current-vp)) );;progn );;sd-call-cmds );;Hide_Baugruppe ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum wählen aller Teile rekursiv in Baugruppe (select_parts () (setf Teile (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_face_part :allow_wire_part :select :recursive :in_assembly V_Baugruppe))) );end select_parts ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum wählen aller Teile im STEPIMPORT (select_LayoutTeile () (setf LayoutTeile (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :select :in_assembly (format nil "/~a" Importdaten)))) );end select_LayoutTeile ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum umbenennen des Importfiles (RenameImport () (progn (setf Importdaten (Format NIL "L_~A"(subseq (sd-inq-obj-basename V_Baugruppe) 2) )) (sd-call-cmds (change_name_pa :part_asmb "/StepExport.stp" :name Importdaten );;change_name_pa );;sd-call-cmds );;progn );;RenameImport ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; Funktion zum umbenennen des Rohlings (F_RenameBlank () (progn (sd-call-cmds (change_name_pa :part_asmb (sd-inq-obj-pathname (first LayoutTeile )) :name (format nil "NEW-~A" Importdaten) );;change_name_pa );;sd-call-cmds );;progn );;F_RenameBlank ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ;; 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 V_Baugruppe)))) (setf AnzTeile (length (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :allow_face_part :select :recursive :in_assembly V_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 V_Baugruppe)))) (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 V_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 V_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 V_Baugruppe)))) (setf AnzA-Saetze (length (sd-call-cmds (get_selection :focus_type *sd-layout-seltype* :select :recursive :in_assembly V_Baugruppe)))) (setf AnzWireparts (- vdteil AnzVolumenteile )) (setf AnzFaceparts (- vfteil AnzVolumenteile )) (setf AnzBehaelter (- AnzUnterbaugruppe vcntteil)) );;let ); end CountItems ;; Layoutstatistik (L_CountItems () (setf L_AnzTeile (length (sd-call-cmds (get_selection :focus_type *sd-part-seltype* :allow_wire_part :allow_face_part :select :in_assembly (format nil "/~a" Importdaten))))) );;L_CountItems ); end local functions ;; ------------------------------------------------------------------------------------------------------------------------------------------------- ; :ok-action ' (mapcar #'DELETEFN Teile) :help-action ' (progn (sd-display-url ( Format NIL "~A/SD_Layouttool.htm" (oli::sd-convert-filename-from-platform (oli::sd-sys-getenv "SCHILLERHELPDIR")))) ); end progn );;defdialog