+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 15 of 15
  1. #11
    Forum Newbie
    Discipline
    HVAC
    Using
    MEP 2018
    Join Date
    Oct 2017
    Posts
    9

    Default

    Registered forum members do not see this ad.

    The code is responding to the if and else statement which is a good sign. Unfortunately, Im getting out of bounds for every number of blocks in the selection.
    However, If I delete
    Code:
    (t (setq val "Out of bounds"))
    It prints out the Cfm values. That Is a completely good Sign that it does create the list of values, but I think it ignores the condition statement.


    Thank you so much for helping me out, I really do appreciate your Input! Id give you kudos if I had any

  2. #12
    Full Member
    Using
    AutoCAD 2012
    Join Date
    Apr 2015
    Posts
    48

    Default

    It's good to go through and work out what everything does. The cond statement is very common in lisp code you may also want to check out the vl-catch-all-apply command for error trapping

    Sent from my Pixel XL using Tapatalk

  3. #13
    Forum Newbie
    Discipline
    HVAC
    Using
    MEP 2018
    Join Date
    Oct 2017
    Posts
    9

    Default

    you have definitely Enlightened me thus far my dude

  4. #14
    Forum Newbie
    Discipline
    HVAC
    Using
    MEP 2018
    Join Date
    Oct 2017
    Posts
    9

    Default

    update on the lisp,

    as it turns out, the sort value was updating, but could not populate the attributes assigned to the block table. and then I came across a forum on this situation:

    https://forums.autodesk.com/t5/dynam...t/td-p/3295893

    Once I messed with the cell value settings and checkboxed to match each row, then I was able to make the lisp work. Woot!
    here's the final code:

    Code:
    (defun C:cfm ( / LM:reprop LM:Tag_Val findrange SS i o val )
     
      (defun LM:reprop ( blk lst / itm )
        (setq lst (mapcar '(lambda ( x ) (cons (strcase (car x)) (cdr x))) lst))
        (foreach x (vlax-invoke blk 'getdynamicblockproperties)
          (if (setq itm (assoc (strcase (vla-get-propertyname x)) lst))
            (vla-put-value x (vlax-make-variant (cdr itm) (vlax-variant-type (vla-get-value x))))
          )
        )
      )
     
      (defun LM:Tag_Val ( blk tag )
        (setq tag (strcase tag))
        (vl-some '(lambda (att) (if (= tag (strcase (vla-get-tagstring att))) (atoi (vla-get-TextString att)))) (vlax-invoke blk 'getattributes))
      )
     
      (setq findrange
        (lambda (v L)
          (if (and (numberp v) (listp L))
            (vl-some 
              '(lambda (x / mn mx) 
                (setq mn (caar x)) 
                (setq mx (cadar x)) 
                (if (apply '<= (append (if mn (list mn)) (list v) (if mx (list mx)) )) 
                  (cadr x)
                ); if
              ); lambda
              L
            ); vl-some
          ); if 
        ); lambda (v L)
      ); setq findrange
     
      (if (setq SS (ssget '((0 . "INSERT"))))
        (repeat (setq i (sslength SS))
          (and (setq o (vlax-ename->vla-object (ssname SS (setq i (1- i)))))
            (setq val (LM:Tag_Val o "CFM"))
            (setq val 
              (findrange val
                '(
                  ( (0 51) "01")
                  ( (52 76) "02")
                  ( (77 121) "03")
                  ( (122 176) "04")
                  ( (177 nil) "05")
                )
              )
            )
            (LM:reprop o (list (cons "sort" val)))
          ); and
        ); repeat
      ); if SS
      (princ)
    ); defun C:cfm

  5. #15
    Super Member asos2000's Avatar
    Computer Details
    asos2000's Computer Details
    Operating System:
    WinXP
    Using
    AutoCAD 2007
    Join Date
    Sep 2007
    Location
    Cairo Egypt
    Posts
    659

    Default

    Registered forum members do not see this ad.

    Taka a look at this
    http://lee-mac.com/errormessages.html

    Hassan
    Sorry for my English.

Similar Threads

  1. Too many arguments error
    By LosGirk in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 16th Oct 2014, 09:57 pm
  2. Error: Too few arguments ?
    By Xelathrone in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 3rd Apr 2014, 05:13 am
  3. Error: too few arguments
    By arunr_18 in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 20th Jul 2013, 09:49 pm
  4. ; error: too few arguments
    By satishrajdev in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 7th Feb 2013, 12:22 pm
  5. too many arguments error on lsp anyone know why
    By chelsea1307 in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 17th Jun 2009, 09:34 pm

Tags for this Thread

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