+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14
  1. #1
    Forum Newbie
    Using
    AutoCAD LT 2007
    Join Date
    Aug 2011
    Posts
    2

    Default Not AutoCAD related, but LISP related...

    Registered forum members do not see this ad.

    This was something I worked on last year, but shelved it until now. With college football quickly approaching I'd decided to give it another try. Because LISP works well with lists, it seems natural to apply it to football pools. It represents one person's predicted scores and compares it with the actual scores, then prints the person's name and point differential compared to actual scores for two games. (eg. Bill91 34pts).

    I'm getting a bad argument error for some reason.

    [EDIT: I have AutoCAD LT2007, but am using AutoCAD clone for this.]

    Code:
    (defun ptdiff ()
     
       (setq actscr '(24 21 24 27))
       (setq urscr '(("Bill91" 10 31 20 21)
                          ("dante" 21 30 24 20)
                          ("91dwg" 10 31 21 28)   
                        )
       )
     
    (while
       (setq urscr (car urscr))
       (princ (car urscr))
     
       (setq gm1 (+ (abs (- (nth 1 urscr)(nth 0 actscr)))(abs (- (nth 2 urscr)(nth 1 actscr))))
             gm2 (+ (abs (- (nth 3 urscr)(nth 2 actscr)))(abs (- (nth 4 urscr)(nth 3 actscr))))
       )
       (setq sum (+ gm1 gm2))
       (princ " ")
       (princ sum) 
       (princ "pts")
     
       (setq urscr (cdr urscr))
    ) 
       (princ)
    )
    Last edited by serick83; 29th Aug 2011 at 04:35 pm. Reason: Explain I'm not using AutoCAD LT for this.

  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
    16,866

    Default

    Perhaps:

    Code:
    (defun ptdiff ( / actscr item urscr )
    
        (setq actscr '(24 21 24 27))
    
        (setq urscr
           '(
                ("Bill91" 10 31 20 21)
                ("dante" 21 30 24 20)
                ("91dwg" 10 31 21 28)   
            )
        )
    
        (while (setq item (car urscr))
            (princ
                (strcat "\n" (car item) " "
                    (itoa (apply '+ (mapcar 'abs (mapcar '- (cdr item) actscr)))) "pts"
                )
            )
            (setq urscr (cdr urscr))
        )
        (princ)
    )
    Your error was caused by:

    Code:
    (while (setq urscr (car urscr))  ==>  urscr = ("Bill91" 10 31 20 21)
    
      (setq urscr (cdr urscr))  ==>  urscr = (10 31 20 21)
    )
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

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

  3. #3
    Junior Member
    Using
    AutoCAD LT 2007
    Join Date
    Jan 2010
    Posts
    23

    Default

    Thanks for the quick reply, Lee. I'll check it out when I get back in a few hours.

  4. #4
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electrical.
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Great Syria , Lives in Abu Dhabi
    Posts
    3,948

    Default

    Quote Originally Posted by Steven Erickson View Post
    Thanks for the quick reply, Lee. I'll check it out when I get back in a few hours.
    Are you the the same OP ?
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  5. #5
    Forum Deity BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    256GB SSD
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Using
    Civil 3D 2015
    Join Date
    Nov 2009
    Posts
    4,746

    Default

    Quote Originally Posted by serick83 View Post
    [EDIT: I have AutoCAD LT2007, but am using AutoCAD clone for this.]
    Quote Originally Posted by Steven Erickson View Post
    Thanks for the quick reply, Lee. I'll check it out when I get back in a few hours.
    Please clarify... Am I correct in understanding that you have two CADTutor accounts (serick83, and Steven Erickson), and that you are using 'clone' (i.e., non-authorized) software to make AutoCAD 2007 LT *think*, or *act* like a full version of AutoCAD?
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD® 2014, and Civil 3D® 2014 Certified Professional | Autodesk® Authorized Developer
    Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

  6. #6
    Senior Member Jeff H's Avatar
    Using
    MEP 2011
    Join Date
    Oct 2010
    Posts
    179

    Default

    Ohhhhhhh woooooooooo woooooooooo.

    Just use Common Lisp or something else.
    You can also find your answers @ theswamp.org

  7. #7
    Forum Deity BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    256GB SSD
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Using
    Civil 3D 2015
    Join Date
    Nov 2009
    Posts
    4,746

    Default



    BTW - Jeff, I thought your last avatar pic was awesome, but this new one is hilarious.
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD® 2014, and Civil 3D® 2014 Certified Professional | Autodesk® Authorized Developer
    Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security

  8. #8
    Senior Member Jeff H's Avatar
    Using
    MEP 2011
    Join Date
    Oct 2010
    Posts
    179

    Default

    Off Topic

    It reminds everyday to strive to be the best pimp I can be
    You can also find your answers @ theswamp.org

  9. #9
    Junior Member
    Using
    AutoCAD LT 2007
    Join Date
    Jan 2010
    Posts
    23

    Default

    Tharwat:

    Yes. I don't know what happened. I was signed in with the first username, but when I went to quickly send out a response to Lee Mac it somehow changed to my previous username. Sorry for the confusion.

  10. #10
    Junior Member
    Using
    AutoCAD LT 2007
    Join Date
    Jan 2010
    Posts
    23

    Default

    Registered forum members do not see this ad.

    Renderman:

    As I mentioned to Tharwat I was signed in with the first username, but when I responded to Lee Mac it somehow converted to my previous username.

    No, I'm not using something non-authorized. Because my LT doesn't have the ability to use AutoLISP I'm using a AutoCAD competitor on a 30-day trial. Sorry about not making myself clear.

Similar Threads

  1. Adding AutoCAD Related Blog or Twitter Feeds in AutoCAD InfoCenter
    By Between the Lines in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 22nd Jul 2010, 05:05 pm
  2. related DIM
    By alijahed in forum AutoCAD General
    Replies: 6
    Last Post: 23rd Jun 2009, 01:59 am
  3. New AutoCAD related Blog: Daily AutoCAD
    By Between the Lines in forum AutoCAD RSS Feeds
    Replies: 0
    Last Post: 20th Nov 2006, 04:21 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