; -*-Lisp-*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; Beschreibung: ; ; Autor: Thomas Hollerweger ; erstellt: ; geändert: ; ; (C) Copyright 2009 STIWA Automation GmbH ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package :stiwa) (use-package :oli) (sd-defdialog 'ST_Meas_Pt_Ref :dialog-title "Messen Punkt mit Referenz" :mutual-exclusion '() :after-initialization '(sd-disable-must-variable-check) :trace nil :variables '( (RefPunkt :value-type :point-3d :built-in-feedback nil :next-variable (seq-input) ) (Z-Achse :value-type :measure-direction :built-in-feedback nil :initial-value (list 0,0,1 RefPunkt nil) :next-variable (seq-input) :check-function #'(lambda (dir) (if X-Achse (if (equal (/ pi 2) (sd-vec-angle-between (first dir) (first X-Achse))) :ok (values :error "Z- und X-Achse müssen normal zueinander sein!") ) :ok ) ) :after-input (start-fback) ) (X-Achse :value-type :measure-direction :built-in-feedback nil :initial-value (list 1,0,0 RefPunkt nil) :next-variable (seq-input) :check-function #'(lambda (dir) (if Z-Achse (if (equal (/ pi 2) (sd-vec-angle-between (first dir) (first Z-Achse))) :ok (values :error "Z- und X-Achse müssen normal zueinander sein!") ) :ok ) ) :after-input (start-fback) ) ("-") (Punkt :value-type :point-3d :built-in-feedback nil :next-variable (seq-input) :after-input (start-fback) ) ; ("-") ; (Messen ; :push-action (measure-action) ; :toggle-type :wide-toggle ; ) ("3D-Punktausgabe") (X-coord :title "X:" :value-type :display-only :size :third ; :initial-enable nil ; :initial-optional t ) (Y-coord :title "Y:" :value-type :display-only :size :third ; :initial-enable nil ; :initial-optional t ) (Z-coord :title "Z:" :value-type :display-only :size :third ; :initial-enable nil ; :initial-optional t ) (pnt-fback :initial-value nil) (refpnt-fback :initial-value nil) (z-fback :initial-value nil) (y-fback :initial-value nil) (x-fback :initial-value nil) ) :prompt-text "" :cancel-action '(progn (cleanup) (sd-enable-must-variable-check) );progn :ok-action '(progn (cleanup) (sd-enable-must-variable-check) );progn :local-functions '( (seq-input () (if (not RefPunkt) 'RefPunkt (if (not Z-Achse) 'Z-Achse (if (not X-Achse) 'X-Achse (if (not Punkt) 'Punkt (measure-action))))) );;seq-input (start-fback () (cleanup) (start-pnt-fback) (start-refpnt-fback) (start-x-fback) (start-y-fback) (start-z-fback) ) (start-pnt-fback () (let () (when Punkt (setq pnt-fback (sd-start-point-feedback Punkt :color 1,0,0)) );;when );;let ) (start-refpnt-fback () (let () (when RefPunkt (setq refpnt-fback (sd-start-point-feedback RefPunkt :color 1,0,1)) );;when );;let ) (start-x-fback () (let () (when (and RefPunkt X-Achse) (setq x-fback (sd-start-direction-feedback :point RefPunkt :direction (first X-Achse) :disc nil :color 0,0.5,0) ) );;when );;let ) (start-y-fback () (let () (when (and RefPunkt X-Achse Z-Achse) (setq y-fback (sd-start-direction-feedback :point RefPunkt :direction (sd-vec-cross-product (first Z-Achse) (first X-Achse)) :disc nil :color 0,0.25,0) ) );;when );;let ) (start-z-fback () (let () (when (and RefPunkt Z-Achse) (setq z-fback (sd-start-direction-feedback :point RefPunkt :direction (first Z-Achse) :disc t :color 0,1,0) ) );;when );;let ) (measure-action () (let (precision erg kosys_item curr_part) (setq precision (sd-get-persistent-data "SolidDesigner" "MEASURE-DISTANCE-DISPLAY-PRECISION" :default 6)) (sd-call-cmds (progn (setq curr_part (sd-inq-curr-part)) (create_part) (pos_create_coordinate_system :action :create :owner (sd-inq-curr-part) :name "Kosys1" :pt_dir :point RefPunkt :w_axis Z-Achse :u_axis X-Achse ) (setq kosys_item (sd-pathname-to-obj (format nil "~a/~a" (sd-inq-obj-pathname (sd-inq-curr-part)) "Kosys1"))) (setq erg (sd-vec-xform Punkt :source-space :global :dest-space kosys_item)) (delete_3d (sd-inq-curr-part)) (current_part curr_part) )) (setq X-coord (format nil "~a" (sd-num-to-string (gpnt3d_x erg) precision))) (setq Y-coord (format nil "~a" (sd-num-to-string (gpnt3d_y erg) precision))) (setq Z-coord (format nil "~a" (sd-num-to-string (gpnt3d_z erg) precision))) (setq Punkt nil) ) ) (cleanup () (sd-end-feedback pnt-fback) (sd-end-feedback refpnt-fback) (sd-end-feedback z-fback) (sd-end-feedback y-fback) (sd-end-feedback x-fback) );;cleanup );local-functions );dialog