+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Full Member
    Using
    AutoCAD 2009
    Join Date
    Mar 2009
    Posts
    75

    Default distance between points

    Registered forum members do not see this ad.

    I draw point using WCS. No I align WCS to some object and draw another point exactly at the same location where first point is drawn. Now in a lisp program I get the coordinates of the two points apply distance command to them display the disatance using alert command, it is show to be 0, but in an if statement when i check that condition, it does not work. Can anyone explain why the if statement is not working although the distance displayed between the point ( using alert ) is shown to be 0.

    the reference code is

    ( setq dis( distance p1 p2 ) )

    ( if ( = 0 dis )

    ( alert "pts are same" )
    )

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,708

    Default

    When working in different UCS's use TRANS to convert all the points to the WCS, then perform your calculations.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  3. #3
    Senior Member TimSpangler's Avatar
    Using
    Architecture 2009
    Join Date
    Jan 2008
    Location
    Gettyburg, PA
    Posts
    212

    Default

    Registered forum members do not see this ad.

    and when using reals / integers it is best to use (equal instead or (= .

    It allow for some fuzz.....
    Timothy Spangler
    --theswamp--

Similar Threads

  1. Distance value -> text
    By Butch in forum AutoCAD Beginners' Area
    Replies: 26
    Last Post: 15th Nov 2009, 02:16 pm
  2. Replies: 21
    Last Post: 14th May 2009, 06:36 pm
  3. Distance
    By fostertom in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 4
    Last Post: 8th Mar 2009, 08:32 pm
  4. X distance
    By FazBear in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 1st Oct 2008, 08:46 pm
  5. Graphing points, scaling the points
    By live4soccer7 in forum AutoCAD General
    Replies: 0
    Last Post: 25th Jul 2008, 09:44 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts