Jump to content

Search the Community

Showing results for tags 'rounding'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 2 results

  1. Hello CADians , I couldn't find a solution to this problem anywhere online. I am also essentially a newbie when it comes to AutoLISP as I have only learned the language ad-hoc to meet certain needs of my business. I have a lisp routine that reads a text file, each line has coordinates depths and descriptions. I use the substr function to get each item of info out of every line. Everything works fine up to this point. However when I use ATOF (after some testing) it rounds the value to 6 significant figure. For example, if I use ATOF on the string "543334.243" it returns 543334.0, "9543334.243" returns 9.54333e+06 and "43334.243" returns 43334.2. So when I use this routine to create points with more than 6 significant figures I get issues with the rounding. Is there an alternative function I can use? I have tried DISTOF but it gives me the same result. Is it a setting or something I can change? I am currently using AutoCAD 2017 and I use the VLIDE to write and edit the code I use. This particular code was written a while ago originally for AutoCAD R14 it worked for that and still does actually. Here is the Code ;READ_MRG.LSP ;reads ASCII M-file <name.ext> created by MERGE_WS.BAS ;and inserts PT blocks 950 on each layer of the type _PTS# ;format of file must be: ;Name/1-7, East/9-19, North/21-31, Depth/33-41, Rmks/43-55, ;Seabed GPS El 57-65, Acc 67-68, Exact 70-71 ;Exact shows whether interpolation was needed ;Read Hydro in ACAD File|ASC In/Out calls this program ;---------- (defun setcol() (setq na1 1 na2 7 ea1 9 ea2 11 no1 21 no2 11 dp1 33 dp2 9 rm1 43 rm2 13 el1 57 el2 9 acc1 67 acc2 2 xa1 70 xa2 2) ) ;---------- (defun C:READ_MRG ( / fname s f tx name east north depth elev rmks pt1) (setvar "ATTDIA" 0) (setvar "ATTREQ" 1) ;get existing file (setq fname (getfiled "Select M... file: " "" "" 0)) (if f (close f)) (if (setq f (open fname "r")) (progn ; (command "LAYER" "M" "_weak" "") ; (command "LAYER" "M" "_bad" "") (princ "\nReading and inserting ...\n") (setcol) (setq tx (read-line f)) (setq lyrnum 0) (setq ptnum 0) (while tx (if (= 0 ptnum) (progn (setq lyrnum (+ 1 lyrnum)) (command "LAYER" "M" (strcat "_PTS" (rtos lyrnum 2 0)) "") (setq ptnum 0) ) ) (if (/= (substr tx 1 1) ";") ;ignore remark and header lines (progn (putpt) (if (= ptnum 949) (setq ptnum 0) (setq ptnum (+ 1 ptnum)) ) ) ) (setq tx (read-line f)) ) ;while tx (close f) ) ) ;if f (princ) ) ;---------- (defun putpt () (setq name (substr tx na1 na2) east (substr tx ea1 ea2) north (substr tx no1 no2) depth (substr tx dp1 dp2) rmks (substr tx rm1 rm2) elev (substr tx el1 el2) acc (atoi (substr tx acc1 acc2)) xact (substr tx xa1 xa2) name (rtos (atof name) 2 0) [color="red"]east (atof east) north (atof north) depth (atof depth)[/color] pt1 (list east2 north2) ) (if (= depth2 -32767.0) (setq depth2 "") (setq depth2 (rtos depth 2 3)) ) (command "INSERT" "PT" pt1 1 1 0 depth2 name rmks) ; (if ; (> acc 3) ; (command "CHPROP" "L" "" "LA" "_weak" "") ; ) ; (if ; (> acc 6) ; (command "CHPROP" "L" "" "LA" "_bad" "") ; ) ) Any help would be greatly appreciated. Thanks in Advance. Robin
  2. Hi all, First post, was hoping to get some help. I need a lisp that will round a number in autocad to the nearest 0.05, I have a numerous drawings with bench levels for lots (civil), I would like to be able to swipe multiple pieces of text and round them all to nearest 0.05. Any help with this would be much appreciated Cheers
×
×
  • Create New...