Results 1 to 2 of 2

Thread: My first try at a lisp file in a long time. The z-axis condition question is not working.

  1. #1
    Member
    Join Date
    2004-11
    Posts
    5
    Login to Give a bone
    0

    Default My first try at a lisp file in a long time. The z-axis condition question is not working.

    So this is my first time in a very long time to actually write a lisp file from start to finish. I did a lot of debugging to see if it worked and it did. however, the debugging process was only with my machine. It worked every time. Now it hangs up a lot at z-axis condition. Prior to this point it checks whether they are lines or plines. it then converts plines to lines. It then checks the z-axis and will notify people if the z-axis is not at zero and exit.

    I have checked several of the files and they z-axis is at 0.00000000. However when i run the program on these files the z-axis will give me something different than what i see on the properties. The last time i checked a file, it gave a z-axis of 2.1something when running the lisp but it was at 0.00000000.

    Here is the Z-axis part of the file.

    Code:
          (setq
    	     ssBetweenPoints	(ssget "c" Point1 Point2)
    	     ;;line1
    	     Line1Data	(entget (ssname ssBetweenPoints 1))
    	     Line1_Point1	(cdr (assoc 10 Line1Data))
    	     Line1_Point2	(cdr (assoc 11 Line1Data))
    	     ;;line 2 
    	     Line2Data	(entget (ssname ssBetweenPoints 0))
    	     Line2_Point1	(cdr (assoc 10 Line2Data))
    	     Line2_Point2	(cdr (assoc 11 Line2Data))
    	     )
    
    
          (if (OR	(/= 0.0 (nth 2 Line1_Point1))
    		(/= 0.0 (nth 2 Line1_Point2))
    		(/= 0.0 (nth 2 Line2_Point1))
    		(/= 0.0 (nth 2 Line2_Point2))
    		)
    	     (progn
    	             (alert "1 or more line have a z-axis not a 0.0")
    		    (exit)
    		    )
    	     )
    Attached Files Attached Files
    Last edited by Opie; 2020-08-04 at 04:15 PM. Reason: [code] tags added

  2. #2
    Active Member
    Join Date
    2015-12
    Location
    Western Europe
    Posts
    57
    Login to Give a bone
    0

    Default Re: My first try at a lisp file in a long time. The z-axis condition question is not working.

    AutoCad works to 16 sig figures and 0.000000000000001 does not equal 0.000000000000000, so something with an insignificant decimal place will negate the = or eq function.

    Substitute (not (equal 0.0 (nth 2 ...) fuzz)) for (/= ....) where fuzz is the acceptable tolerance

    You may also have problems in anything but WCS so coords should be translated to WCS using the (trans) function

Similar Threads

  1. Long Time, First time - shared parameters and families
    By stonewall in forum BIM Management - General
    Replies: 2
    Last Post: 2013-08-23, 06:07 PM
  2. In-place family with opening cut - first fatal error in a LONG time
    By patricks in forum Revit Architecture - General
    Replies: 0
    Last Post: 2010-04-08, 07:09 PM
  3. Lines on X axis are drawn at varying Z axis
    By s.nail in forum AutoCAD 3D (2006 or below)
    Replies: 16
    Last Post: 2006-09-20, 04:23 AM
  4. Try Try Again
    By AutoCAD_Junkie in forum New Forum Users (Non technical)
    Replies: 12
    Last Post: 2006-06-06, 05:39 AM
  5. My First Project (A long time ago)
    By aaronlogan in forum Revit - Gallery
    Replies: 0
    Last Post: 2005-12-01, 06:59 PM

Posting Permissions

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