NanGlase Posted January 6 Posted January 6 (edited) Please help me with this; While picking points, the data/text in the command line gets wrapped even though there is more space. (defun c:nanpt () (vl-load-com) (princ "\nStakeout Point by: Nan Glase (2024-12-24)") (princ "\nEnter \"NANPT\" to run.") (setq points '()) (setq polyline nil) ; Variable to hold the polyline object ;; Save the current DIMZIN value and set it to 0 to prevent suppressing zeros (setq old-dimzin (getvar "DIMZIN")) (setvar "DIMZIN" 0) ; Set DIMZIN to 0 to prevent suppressing trailing zeros ;; Start the polyline command (command "_.PLINE") (while t (setq pt (getpoint (if (and (not (null points))) (strcat "\nSelect a point (or press Enter to finish): " "Northing: " (rtos (cadr (last points)) 2 3) " Easting: " (rtos (car (last points)) 2 3)) "\nSelect a point (or press Enter to finish): "))) (if (null pt) (progn ;; Finish the polyline if at least one point was selected (if (> (length points) 0) (progn (command "") ; End the polyline command (setq polyline (entlast)) ; Get the last entity created (the polyline) ;; Save points to a file (setq data '()) (setq i 1) (foreach p points (setq line (strcat "S" (itoa i) ", " (rtos (cadr p) 2 3) ", " (rtos (car p) 2 3) ", 0")) (setq data (append data (list line))) (setq i (1+ i)) ) (setq formattedData (apply 'strcat (mapcar (function (lambda (x) (strcat x "\n"))) data))) (setq tmpfile (vl-file-syst-write (strcat (getenv "TEMP") "\\Nan_stakeoutpoint.txt") formattedData)) (startapp "notepad.exe" tmpfile) ) (princ "\nPlease select at least one point before finishing.") ) ;; If polyline exists, erase it (if polyline (progn (command "_.ERASE" polyline "") ; Erase the polyline (setq polyline nil) ; Clear polyline reference ) ) (setq points nil) ; Clear points list ) (progn ;; Append the point to the list (setq points (append points (list pt))) ; Store the point directly (command pt) ; Add the point to the polyline ) ) ) ;; Restore the original DIMZIN value (setvar "DIMZIN" old-dimzin) (princ) ) (defun vl-file-syst-write (filename content) (setq file (open filename "w")) (if file (progn (write-line content file) (close file) (princ (strcat "\nData has been written to Notepad. " filename)) ) (princ "\nError opening file for writing.") ) filename ) (princ "\nStakeout Point by: Nan Glase (2024-12-31)") (princ "\nEnter \"NANPT\" to run.") Edited January 6 by SLW210 Added Code Tags! Quote
pkenewell Posted January 6 Posted January 6 (edited) @NanGlase I'm afraid you don't have much control over how the command line wraps. I suggest you just make your prompts a bit shorter: (strcat "\nSelect a point (or Enter to finish): " "North: " (rtos (cadr (last points)) 2 3) "East: " (rtos (car (last points)) 2 3)) P.S. Please edit your original post and put your code in code tags. i.e. select the code and cut it to the clipboard, then use the formatting button "<>" and paste the code into the popup code window. In the lower right, select "no syntax highlighting" from the dropdown box. Edited January 6 by pkenewell 1 Quote
SLW210 Posted January 6 Posted January 6 I did the code tags for you, please use them in the future. (just select the <> in the editor toolbar) 1 Quote
NanGlase Posted Tuesday at 10:49 PM Author Posted Tuesday at 10:49 PM On 1/6/2025 at 11:34 PM, pkenewell said: @NanGlase I'm afraid you don't have much control over how the command line wraps. I suggest you just make your prompts a bit shorter: (strcat "\nSelect a point (or Enter to finish): " "North: " (rtos (cadr (last points)) 2 3) "East: " (rtos (car (last points)) 2 3)) P.S. Please edit your original post and put your code in code tags. i.e. select the code and cut it to the clipboard, then use the formatting button "<>" and paste the code into the popup code window. In the lower right, select "no syntax highlighting" from the dropdown box. revised code worked! Can you give me some links so that I can practice better code tagging? im just using notepad++? thanks a lot! Quote
NanGlase Posted Tuesday at 10:50 PM Author Posted Tuesday at 10:50 PM On 1/7/2025 at 5:15 AM, SLW210 said: I did the code tags for you, please use them in the future. (just select the <> in the editor toolbar) sorry no idea at all, im just using notepad++. Can you give me some links so that I can practice better code tagging? thanks a lot! Quote
Nikon Posted Wednesday at 07:18 AM Posted Wednesday at 07:18 AM (edited) 8 hours ago, NanGlase said: sorry no idea at all, im just using notepad++. Can you give me some links so that I can practice better code tagging? thanks a lot! Step 1 Step 2 It will look like this: Paste your text from notepad++ Edited Wednesday at 07:26 AM by Nikon 1 Quote
pkenewell Posted Wednesday at 01:55 PM Posted Wednesday at 01:55 PM 15 hours ago, NanGlase said: revised code worked! Can you give me some links so that I can practice better code tagging? im just using notepad++? thanks a lot! @NanGlase Not talking about your code, but how you post code into this forum. See Nikon's example above. 1 Quote
NanGlase Posted Wednesday at 02:44 PM Author Posted Wednesday at 02:44 PM yeah, got it already. anyways, you had suggested a revised code a bit shorter and it worked for me. thanks! 1 Quote
BIGAL Posted Thursday at 12:27 AM Posted Thursday at 12:27 AM (edited) You can run lisp from Notepad++ google "ActiveX plug in lisp notepad++". Its really good can highlite text and run or run all text. or https://sourceforge.net/projects/nppactivexplugin/ Edited Thursday at 12:28 AM by BIGAL 1 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.