Results 1 to 6 of 6

Thread: Sizing CFM to determine Property Table Value

  1. #1
    Member
    Join Date
    2017-05
    Posts
    4


    Question Sizing CFM to determine Property Table Value

    Hi guys,
    this Is probably the First time Asking a question in the Forums (Hopefully I wont be asking too much) Im creating a Lisp that determines the size of a given cfm value tied to a block attribute. However I'm getting a "malformed list on input" error, and I'm not sure where it's coming from. any advice would be much appreciated. I attached a .dwg of the block I'm using to manipulate.


    Code:
    (defun c:Auto_size()
    (setq ss (ssget "x" '((0 . "insert")(2 . "10 x 8 Register Sets"))))
    
    (if ss
    
    	(Progn
    		(setq ss (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
    		
    		(mapcar '(lambda (ent)
    		(setq cfm (atoi (CFM_val_lst ent "cfm")))
    				(if
    	    				(and
    						(>= cfm 51)
    						(<= cfm 0)
    	   				 );and
    					(Reprop "sort" "01")
    				);if
    				(if
    	    				(and
    						(>= cfm 76)
    						(<= cfm 52)
    	   				 );and
    					(Reprop "sort" "02")
    				);if
    				(if
    	    				(and
    						(>= cfm 121)
    						(<= cfm 77)
    	   				 );and
    					(Reprop "sort" "03")
    				);if
    				(if
    	    				(and
    						(>= cfm 176)
    						(<= cfm 122)
    	   				 );and
    					(Reprop "sort" "04")
    				);if
    				(if
    	    				(and
    						(>= cfm 177)
    						
    	   				 );and
    					(Reprop "sort" "05")
    				);if
    	
    		)ss)
    	)
    )
    Attached Files Attached Files

  2. #2
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    748


    Default Re: Sizing CFM to determine Property Table Value

    Quote Originally Posted by pabloz10750282 View Post
    I'm getting a "malformed list on input" error, and I'm not sure where it's coming from.
    Hi,
    Such an error indicates that you have one or more brackets ( parenthesis ) are missing.

  3. #3
    Member
    Join Date
    2017-05
    Posts
    4


    Default Re: Sizing CFM to determine Property Table Value

    Hey!
    I've seen your previous forums, and learned so much from you and Leemac! Thank you for responding to my first post.

    Anyways, I've been Having a hard time figuring out which set of parenthesis is missing. could it be my IF statements?

  4. #4
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    748


    Default Re: Sizing CFM to determine Property Table Value

    Quote Originally Posted by pabloz10750282 View Post
    Hey!
    I've seen your previous forums, and learned so much from you and Leemac! Thank you for responding to my first post.

    Anyways, I've been Having a hard time figuring out which set of parenthesis is missing. could it be my IF statements?
    Thank you so much. Its my pleasure.

    Try to use the Vlide that is available within AutoCAD and that should help you a lot.
    AutoCAD -> Tools -> AutoLISP -> Visual LISP Editor.

    Just ask if you need more help with your codes.

  5. #5
    Member
    Join Date
    2017-05
    Posts
    4


    Arrow Re: Sizing CFM to determine Property Table Value

    That is a Very Powerful tool! Oh wow! That definitely makes my coding a little easier!
    Now That The code is working without errors, It seems to not pick up on my attributes. However, It has no trouble going through my "Reprop" Module:


    Code:
    (defun c:Auto_size ()
      (setq ss (ssget "x" '((0 . "insert") (2 . "10 x 8 Register Sets"))))
    
      (if ss
    
        (Progn
          (setq ss (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))))
    
          (mapcar '(lambda (ent)
    		 (setq cfm (atoi (CFM_val_lst ent "cfm")))
    		 (if
    		   (and
    		     (>= cfm 51)
    		     (<= cfm 0)
    		   )			;and
    		    (Reprop "sort" "01")
    		 )			;if
    		 (if
    		   (and
    		     (>= cfm 76)
    		     (<= cfm 52)
    		   )			;and
    		    (Reprop "sort" "02")
    		 )			;if
    		 (if
    		   (and
    		     (>= cfm 121)
    		     (<= cfm 77)
    		   )			;and
    		    (Reprop "sort" "03")
    		 )			;if
    		 (if
    		   (and
    		     (>= cfm 176)
    		     (<= cfm 122)
    		   )			;and
    		    (Reprop "sort" "04")
    		 )			;if
    		 (if
    		   (and
    		     (>= cfm 177)
    
    		   )			;and
    		    (Reprop "sort" "05")
    		 )			;if
    
    	       )
    	      ss
          )
        )
      )
    
    
    
      (defun CFM_val_lst (blk tag)
        (setq tag (strcase tag))
        (vl-some '(lambda (att)
    		(if (= tag (strcase (vla-get-tagstring att)))
    		  (vla-get-textstring att)
    		)
    	      )
    	     (vlax-invoke blk 'getattributes)
        )
      )
    
      (defun 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))
    	  )
    	)
          )
        )
      )
    )

  6. #6
    Member
    Join Date
    2017-05
    Posts
    4


    Default Re: Sizing CFM to determine Property Table Value

    after debugging my program, I finally got rid of the "too few arguments statment" foreach was messing me up so i reformatted my loop statement.
    Now that it runs, I noticed the program only returns "-1" Is there anything I missed in my loop statement?any advice would be most helpful.


    Code:
    (defun c:AS3 (/ ent val cfm)
      ;; Define function, declare local variables
      (if ;; If the following expression returns a non-nil value
          (setq ent	;; Assign the value returned by the following expression to the symbol 'sel'
    		(ssget ;; Prompt the user to make a selection and return the selection set if successful
    		       '
    			((0 . "INSERT"))
    		       ;; Filter the selection to block references only (INSERTs)
    		)
    		;; end ssget
          )
        ;; end setq
    
        (Setq I -1)
    
        (While (setq ent (ssname val (setq I (1+ I))))
    
    					
    
          (setq val (LM:Tag_Val (vlax-ename->vla-object ent) "CFM"))
    
    
          (Cond
    					;If
    	((>= val 51)
    	 (<= val 0)
    	 (LM:reprop "sort" "01" ent)
    	)
    					;Else
    	((>= val 76)
    	 (<= val 52)
    	 (LM:reprop "sort" "02" ent)
    	)
    					;Else
    	((>= val 121)
    	 (<= val 77)
    	 (LM:reprop "sort" "03" ent)
    	)
    	((>= val 176)
    	 (<= val 122)
    	 (LM:reprop "sort" "04" ent)
    	)
    	((>= val 177)
    	 (LM:reprop "sort" "05" ent)
    	)
          )					;End cond
    
    
          (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)
    	)
          )
        )
      )
    )

Similar Threads

  1. Help Setting Table Column Style Property
    By svajk394200 in forum Bridging the Gap: LISP -> .NET -> LISP
    Replies: 2
    Last Post: 2017-04-23, 06:55 AM
  2. PROPERTY SETS into a Table
    By rodrigo.239853 in forum ACA General
    Replies: 1
    Last Post: 2010-03-29, 01:35 PM
  3. Create Property Line By Table - Revise Arc Entry
    By kspear in forum Revit Architecture - Wish List
    Replies: 0
    Last Post: 2007-09-06, 06:01 PM
  4. Formula property in schedule table.
    By arcadia_x27 in forum ACA General
    Replies: 8
    Last Post: 2007-08-20, 03:25 AM
  5. Property Lines by table won't rotate
    By k.armstrong in forum Revit Architecture - General
    Replies: 1
    Last Post: 2005-10-14, 04:05 AM

Posting Permissions

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