Search the Community
Showing results for tags 'decimal'.
-
Need help. how to maintain 3 decimal places even with zeros like in the picture? (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 ;; Start the polyline command (command "_.PLINE") (while t (setq pt (getpoint "\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 (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 ) ) ) (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.")
-
Hello all. I have a routine that enters data labels in a drawing where the user would like them. It finds data in a file and inserts it based on the label number the user inputs. However, for the data labels that we enter that have no information, but the user still wants that label called out, it simply enters "#50.00-0.00". I was able to remove the "0.00" suffix because it was obvious in the code. But I would also like to remove ".00" immediately after the data label, and this isnt working out in my favor. The only thing that I would like displayed is "#50-". No decimals and no zeros. I have included the routine. and snap shot of the data labels. With the original on bottom. The current in the middle. And the goal data label I am looking for on top. Hope this helps and plenty thanks in advance. (defun c:DTEST (/ *ERROR* oldlayr p1 p2 DPNUM) (defun *error* (msg) (if oldlayr (setvar "clayer" oldlayr)) (if oldos (setvar "osmode" oldos)) (if msg (prompt msg)) (princ) ) (defun getdpnum () (if (= dpnum nil) (setq dpnum (getreal "\nEnter STARTING datapoint number (1.00-999.99): ")) (setq dpnum (+ dpnum 1))) ) (WHILE (setq oldos (getvar "osmode")) (setq oldlayr (getvar "clayer")) (command "._-layer" "s" DATAPOINT "") (initget 1) (setq p1 (getpoint "\nSelect datapoint location on pipe: ")) (setvar "osmode" 0) (initget 33) (setq p2 (getpoint p1 "\nSelect datapoint label location: ")) (getdpnum) (get_info "DATAPOINTS" "END DATAPOINTS" DPINFO "#" "-") (command "._-layer" "s" oldlayr "") (setvar "OSMODE" OLDOS) ) (*error* nil) (prin1))
-
This lisp routine is to set decimal digits after a comma in any integer to 2 digit for any set of entries even in term of text ,, how to avoid the appearance of 0 .. ( ex : 25.456 ~25.460 , 25.322~25.320 ) last 0 isn't preferable ..
-
I am trying to calculate multiple arcs (to similate part of an ellipse) to determine the individual distances from certain parts of the ellipse, but when I double click on the arcs, the properties manager shows the arc lengths as fractions, and not very accurate ones. I want it to show decimal inches. I already have my dimension settings on decimal inches, but that doesn't help. How do I get the properties manager to show me arc lengths in decimal inches? Thanks!