Search the Community
Showing results for tags 'decimal'.
Found 3 results
Removing Decimals in an existing routine.
tmelancon posted a topic in AutoLISP, Visual LISP & DCLHello 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!