;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; for CoCreate SolidDesigner ;; Description: ;; QR-Code to Workplane / to Model Face ;; ;; Reference : https://ww3.cad.de/foren/ubb/Forum92/HTML/001038.shtml ;; : https://qrplanet.com/qr-code-generator-svg ;; Docu : https://support.ptc.com/help/creo_elements_direct/... ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Filename : cadde-92-001038.lsp ;; Version : 1.0 initial-version by der_Wolfgang ;; Created : Fri Dec 13 17:25:00 CET 2024 ;; Modified : Fri Dec 13 18:27:03 CET 2024 ;; Author : der_Wolfgang@forum@cad.de ;; Download : cad.de ;; SD-Version : developed with PE80 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package :cadde-wt) (use-package :oli) (defun qrc-get-svg-from-zip (zipfile) (let* ((tmpdir (sd-gen-unique-filename (sd-inq-temp-dir))) (zipexe "unzip.exe") (unzip (format nil "~A/binx64/~A" (sd-inq-install-dir) zipexe)) svg-file ) (if (probe-file unzip) (progn (unless (sd-directory-p tmpdir) (sd-make-directory tmpdir)) (sd-with-current-working-directory tmpdir ;(sd-sys-exec (format nil "\"~A\" \"~A\" *.svg" ; (sd-convert-filename-to-platform unzip) ;; Der Befehl "C:/Program" ist entweder falsch geschrieben oder konnte nicht gefunden werden. GRRR ; (sd-convert-filename-to-platform zipfile) ; )) (sd-copy-file unzip tmpdir) ;; Würgarround (sd-sys-exec (format nil "~A ~S *.svg" zipexe ;(sd-convert-filename-to-platform unzip) ;(sd-convert-filename-to-platform "C:/Programs/cygwin/home/user/bin/unzip.exe") (sd-convert-filename-to-platform zipfile) )) (frame2::rm zipexe) ;; Würgarround ;; es kann in der dir nur EINE svg geben! (setq svg-file (namestring (car (directory "*.svg")))) ) ) ;; else (sd-display-alert (format nil "ZIP not found: ~S" unzip) :icon :error) ) (if (probe-file svg-file) (values svg-file (sd-inq-file-size svg-file)) (values nil :file-not-found) ) ) ) (trace qrc-get-svg-from-zip sd-sys-exec) #| (cadde-wt::qrc-get-svg-from-zip "C:/work/osd/cadde/cadde-92-001038.qrplanet.com-static-qrcode.zip") |# (defun qrc-svg-to-workplane (svgfile) ; create workplane :name "svg-base-filename" ; xml read svgfile ; draw svg rectangles to Workplane ) (trace qrc-svg-to-workplane) (sd-defdialog 'QR_CODE_to_Workplane :toolbox-button :force ; :variables ; push-button (sd-display-url "https://qrplanet.com/qr-code-generator-svg") ; zip-file filename .. ; :after-input copy full pathname to clipboard + display-alert :info about the copied name ; owner-of-workplane .. ; wpname ; :ok-action-precond (if prob-file zip-file :ok :error) ;; evtl file date auch checken ; :ok-action ; (let ((svg-file (qrc-get-svg-from-zip zip-file))) ; (when svg-file (qrc-svg-to-workplane svg-file wpname)) ; ) )