(in-package :gb-custom) (use-package :OLI) (sd-defdialog 'gb_inq_dist_axis :dialog-title (sd-multi-lang-string "Dist./Angle" :german "Abst./Winkel") :dialog-type :interrupt ;;:toolbox-button nil :variables '( (zyl1 :selection (*sd-cylinder-seltype* *sd-cone-seltype* *sd-torus-seltype* *sd-c-circle-2d-seltype* *sd-c-arc-2d-seltype* *sd-circle-2d-seltype* *sd-arc-2d-seltype* *sd-circle-3d-seltype* *sd-arc-3d-seltype*) :title (sd-multi-lang-string "Axis 1" :german "Achse 1") :prompt-text (sd-multi-lang-string "Specify cylinder, conus, torus or circular element" :german "Zylinder, Kegel, Torus oder Kreiskante angeben") :after-input (l-show-distance) ) (zyl2 :selection (*sd-cylinder-seltype* *sd-cone-seltype* *sd-torus-seltype* *sd-c-circle-2d-seltype* *sd-c-arc-2d-seltype* *sd-circle-2d-seltype* *sd-arc-2d-seltype* *sd-circle-3d-seltype* *sd-arc-3d-seltype*) :title (sd-multi-lang-string "Axis 2" :german "Achse 2") :prompt-text (sd-multi-lang-string "Specify cylinder, conus, torus or circular element" :german "Zylinder, Kegel, Torus oder Kreiskante angeben") :after-input (l-show-distance) ) (winkel :value-type :display-only :title (sd-multi-lang-string "Angle" :german "Winkel") :size :third :initial-value 0.0 ) (abstand :value-type :display-only :title (sd-multi-lang-string "Distance" :german "Abstand") :size :third :initial-value 0.0 ) (ueb-win :push-action (ueb-win-action) :toggle-type :wide-toggle :title (sd-multi-lang-string "Apply angle" :german "Winkel Ïbernehmen") ) (ueb-abs :push-action (ueb-abs-action) :toggle-type :wide-toggle :title (sd-multi-lang-string "Apply distance" :german "Abstand Ïbernehmen") ) );variables :ok-action '(); ok-action :help-action '(sd-display-url (concatenate 'string (system:getenv "GBDOCDIR") "/doc/sd-messen.html#axis")) :local-functions '( (l-show-distance () (let (p1_struct p2_struct p1_origin p1_axis p2_origin p2_axis p_kreuz) (when (AND zyl1 zyl2) (setf p1_struct (sd-inq-geo-props zyl1 :dest-space :global)) (setf p2_struct (sd-inq-geo-props zyl2 :dest-space :global)) (when (sd-cylinder-p p1_struct) (setf p1_origin (sd-cylinder-center p1_struct)) (setf p1_axis (sd-cylinder-axis-dir p1_struct)) ) (when (sd-cone-p p1_struct) (setf p1_origin (sd-cone-apex p1_struct)) (setf p1_axis (sd-cone-axis-dir p1_struct)) ) (when (sd-torus-p p1_struct) (setf p1_origin (sd-torus-center p1_struct)) (setf p1_axis (sd-torus-axis-dir p1_struct)) ) (when (sd-circle-p p1_struct) (setf p1_origin (sd-circle-center p1_struct)) (setf p1_axis (sd-circle-normal p1_struct)) ) (when (sd-cylinder-p p2_struct) (setf p2_origin (sd-cylinder-center p2_struct)) (setf p2_axis (sd-cylinder-axis-dir p2_struct)) ) (when (sd-cone-p p2_struct) (setf p2_origin (sd-cone-apex p2_struct)) (setf p2_axis (sd-cone-axis-dir p2_struct)) ) (when (sd-torus-p p2_struct) (setf p2_origin (sd-torus-center p2_struct)) (setf p2_axis (sd-torus-axis-dir p2_struct)) ) (when (sd-circle-p p2_struct) (setf p2_origin (sd-circle-center p2_struct)) (setf p2_axis (sd-circle-normal p2_struct)) ) (setf p_kreuz (sd-vec-cross-product p1_axis p2_axis)) (if (sd-vec-null-p p_kreuz) ;; wenn Kreuzprodukt der Achsrichtungen = Nullvektor, dann sind Achsen parallel ;; parallele Achsen, komplizierte Berechnung (setf abstand (/ (sd-vec-length (sd-vec-cross-product p1_axis (sd-vec-subtract p2_origin p1_origin))) (sd-vec-length p1_axis))) ;; nicht parallele Achsen, auch komplizierte Berechnung (setf abstand (abs (sd-vec-scalar-product (sd-vec-subtract p2_origin p1_origin) (sd-vec-normalize p_kreuz)))) ) (setf winkel (sd-rad-to-deg (acos (/ (sd-vec-scalar-product p1_axis p2_axis) (* (sd-vec-length p1_axis) (sd-vec-length p2_axis)))))) ;; nur Winkel bis 90 Grad anzeigen (when (> winkel 90) (setf winkel (- 180 winkel)) ) );; when zyl1 und zyl2 );;let ) (ueb-abs-action () (sd-put-buffer (format nil "~F" abstand)) cancel ) (ueb-win-action () (sd-put-buffer (format nil "~F" winkel)) cancel ) );local-functions );sd-defdialog