Jump to content

Search the Community

Showing results for tags 'rounding error'.

  • 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 1 result

  1. Hello, I'm using a function to quickly divide a line. The divisions are rounded to a chosen distance. (defun inzetpunten (/ obj num div objg) (while (not obj) (setq obj(entsel)) (if obj (progn (setq objg (entget (car obj))) (setq num (/ (distance (cdr (assoc 10 objg)) (cdr (assoc 11 objg))) 400)) ; target distance = 400 (if (< 0.5 (- num (fix num))) (setq div (1+ (fix num))) (setq div (fix num))) (if (> 2 div) (setq div 2)) (command "divide" obj div) ) (princ "\nNothing was selected, Please select a line!")) ) (princ) ) Now this works great. But I have a drawing with the same length lines, only one divides into 6 and the other divides into 7 parts. I got a vlax dump of the 2 lines: Select object: ; IAcadLine: AutoCAD Line Interface ; Property values: ; Angle (RO) = 3.14159 ; Application (RO) = #<VLA-OBJECT IAcadApplication 000000013fd89110> [color=red]; Delta (RO) = (-3000.0 9.09495e-013 0.0)[/color] ; Document (RO) = #<VLA-OBJECT IAcadDocument 000000002f573368> ; EndPoint = (-14065.0 5567.73 0.0) ; EntityTransparency = "ByLayer" ; Handle (RO) = "DB11" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000037a10f78> ; Layer = "HULPLIJN" ; Length (RO) = 3000.0 ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 44 ; ObjectName (RO) = "AcDbLine" ; OwnerID (RO) = 43 ; PlotStyleName = "ByLayer" ; StartPoint = (-11065.0 5567.73 0.0) ; Thickness = 0.0 ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000000037a13370> ; Visible = -1 T ; Property values: ; Angle (RO) = 3.14159 ; Application (RO) = #<VLA-OBJECT IAcadApplication 000000013fd89110> [color=red]; Delta (RO) = (-3000.0 0.0 0.0)[/color] ; Document (RO) = #<VLA-OBJECT IAcadDocument 000000002f573368> ; EndPoint = (-14065.0 5685.33 0.0) ; EntityTransparency = "ByLayer" ; Handle (RO) = "DB3C" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000000037a13078> ; Layer = "HULPLIJN" ; Length (RO) = 3000.0 ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 42 ; ObjectName (RO) = "AcDbLine" ; OwnerID (RO) = 43 ; PlotStyleName = "ByLayer" ; StartPoint = (-11065.0 5685.33 0.0) ; Thickness = 0.0 ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0000000037f29450> ; Visible = -1 T The only difference seems to be the delta, how can I work around this bug in my lisp? Thanks in advance!
×
×
  • Create New...