mhy3sx Posted July 25 Posted July 25 Hi, I want to export hash code SHA-512 from dxf file . The code works but I want to do two updates. I know that will ask what are you hiding and why you do this etc... so I will explain that some drawings saved as dxf with the hashcode then convert to zip file and upload to gov webpage. So I am trying to do this fast. 1) the fist change I want to do is that I want low letters not caps in the hashcode. I don't know how to do it !! the code export hash code like this D00EB86B0E2E4A3ED990A98B0D0A75E4CD33A947D3E2C916CECA9329D477E71D9C0C77B8A0117C81DE271B5B4120F5A882369ABDA8105B8583ED5269416C533F And I want o export like d00eb86b0e2e4a3ed990a98b0d0a75e4cd33a947d3e2c916ceca9329d477e71d9c0c77b8a0117c81de271b5b4120f5a882369abda8105b8583ed5269416c533f 2) The second is that print the hashcode to command line. Is it possible to export a pdf file with the hash code with name hashcode.pdf in the same path with the open dxf file? here is the code (defun c:sha512HASH ( / file-path hash-value ) ;; Prompt user to select a file (setq file-path (getfiled "Select a file to hash" "" "dxf" 0)) ;; Check if a file was selected (if file-path (progn ;; Generate SHA-512 hash using PowerShell (setq hash-value (run-powershell-command file-path)) ;; Display the hash value (princ (strcat "\nSHA-512 Hash: " hash-value)) ) (princ "\nNo file selected.") ) (princ) ) (defun run-powershell-command (file-path / ws str output result exec stdOut) (setq ws (vlax-get-or-create-object "WScript.Shell")) (setq str (strcat "Powershell.exe -WindowStyle Hidden Get-FileHash -Algorithm SHA512 -Path '" file-path "' | Select-Object -ExpandProperty Hash")) (setq output "") (setq result (vl-catch-all-apply '(lambda () (setq exec (vlax-invoke ws 'exec str)) (setq stdOut (vlax-get exec 'StdOut)) (setq output (vlax-invoke stdOut 'ReadAll)) ) )) (vlax-release-object ws) (if (vl-catch-all-error-p result) (progn (princ "\nError generating hash.") nil ) (substr output 1 (- (strlen output) 2)) ) ) Quote
exceed Posted July 25 Posted July 25 1. https://help.autodesk.com/view/ACDLT/2025/KOR/?guid=GUID-108DCD2C-6597-4548-856D-937787AFE5E0 (strcase "Sample" T) "sample" 2. i think, It is difficult to make a PDF directly from CAD, so we will have to create text in the model space and plot it. maybe Quote
mhy3sx Posted July 25 Author Posted July 25 Hi exceed I try (princ (strcat "\nSHA-512 Hash: " hash-value T)) ;Error: invalid argument type: stringp: T Quote
exceed Posted July 25 Posted July 25 (princ (strcat "\nSHA-512 Hash: " (strcase hash-value T))) strcat and strcase is different 1 Quote
mhy3sx Posted July 25 Author Posted July 25 (setq hash512 (strcase hash-value T)) ;; Display the hash value (princ (strcat "\nSHA-512 Hash: " hash512)) ok I find it Quote
BIGAL Posted July 25 Posted July 25 (edited) You can zip and unzip using lisp. Unzip (getfiled "Select the File \"Cad tools 5-03-2024\"" "" "ZIP" 16)) (startapp (strcat "powershell -command Expand-Archive -Path '" filename "' -DestinationPath 'C:/CAD-TOOLS' -FORCE")) Zip I know I have it somewhere it uses -command Compress-Archive # Create a zip file with the contents of C:\Stuff\ Compress-Archive -Path C:\Stuff -DestinationPath archive.zip # Add more files to the zip file # (Existing files in the zip file with the same name are replaced) Compress-Archive -Path C:\OtherStuff\*.txt -Update -DestinationPath archive.zip # Extract the zip file to C:\Destination\ Expand-Archive -Path archive.zip -DestinationPath C:\Destination Edited July 25 by BIGAL Quote
mhy3sx Posted July 30 Author Posted July 30 (edited) Hi BIGAL is possible to export the hashcode to pdf file with name Hashcode and save it to the same place with the dxf file? Thanks Edited July 30 by mhy3sx Quote
BIGAL Posted July 30 Posted July 30 As suggested by Exceed you will need to use plot via a lisp. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.