Results 1 to 2 of 2

Thread: Match dynamic block properties.

  1. #1
    I could stop if I wanted to
    Join Date
    2001-01
    Posts
    257
    Login to Give a bone
    0

    Default Match dynamic block properties.

    Hi All
    I have the following routine that I am trying to get work. It is the match properties command for dynamic blocks. It is suppose to match the property of the first selected dynamic block. It works fine on all blocks except those that have flip states (my current observation). I get the following message when it fails: "INTERNAL error in FAIL\nmessage lost, reset to top" Error: Automation Error. Invalid input." Any help is greatly appreciated. Thank you.
    Manuel

    Code:
    (defun cm:PutDBProps (objent lst / blkprops len propname propvalue n)
      (if (= 'ENAME (type objent))
        (setq objent (vlax-ename->vla-object objent))
      )
      (setq blkprops
    	 (vlax-safearray->list
    	   (vlax-variant-value
    	     (vla-getdynamicblockproperties objent)
    	   )
    	 )
      )
      (setq len (length blkprops))
      (foreach prop	lst
        (setq n 0)
        (setq propname (car prop))
        (setq propvalue (cdr prop))
        (while (< n len)
          (cond
            ((= propname "Flip state")
              (vlax-make-variant propvalue vlax-vbinteger)
              (setq n len)
            )
            ((= propname (vlax-get-property (nth n blkprops) "PropertyName"))
              (vl-catch-all-apply 'vlax-put-property (list (nth n blkprops) "Value" propvalue))
              (setq n len)	
            )
          )
          (setq n (1+ n))
        )
      )
    )
    
    (defun cm:GetDBProps (objent / x y)
       (if (= 'ENAME (type objent))
         (setq objent (vlax-ename->vla-object objent))
       )
       (vl-remove-if
         '(lambda (y) (= (car y) "Origin"))
         (mapcar '(lambda (x)
    	       (cons (vlax-get-property x "PropertyName")
    		     (vlax-variant-value (vlax-get-property x "Value"))
    		     
    	       )
    	     )
    	    (vlax-safearray->list
    	      (vlax-variant-value (vla-getdynamicblockproperties objent))
    	    )
         )
       )
    )
    
    (defun c:matchdb (/ ent bname db-proplst sset ssent cntr ssobj db-flip flipval)
       (prompt "\nMatch dynamic block properties: ") 
       (if (setq ent (car (entsel "\nSelect source block: ")))
         (progn
           (setq bname (vla-get-EffectiveName (vlax-ename->vla-object ent)))
           (setq db-proplst (cm:GetDBProps ent))
    ;       (foreach item db-proplst
    ;         (if (= (car item) "Flip state")(setq db-flip T flipval (cdr item)))
    ;       )
           (prompt "\nSelect destination object (s): ")
           (if (setq sset (ssget '((0 . "INSERT"))))
             (progn
               (setq cntr 0)
               (while (< cntr (sslength sset))
                 (setq ssent (ssname sset cntr)
                       ssobj (vlax-ename->vla-object ssent)
                 )	
                 (if (= bname (vla-get-EffectiveName ssobj))
                   (progn 
                     (cm:PutDBProps ssobj db-proplst)
    ;                 (if db-flip (cm:setdbval ssobj "Flip state" flipval))
                   )
                   (princ "\nSelected block is not identical to source!")
                 )
                 (setq cntr (1+ cntr))
               )
             )
           )
         )
       )
    (princ)
    )

  2. #2
    Member
    Join Date
    2016-10
    Posts
    7
    Login to Give a bone
    0

    Default Re: Match dynamic block properties.

    Seems like you are missing the cm:setdbval function or the error is happening inside of that function. Because that is only called in a flipped state.

Similar Threads

  1. 2016: Timeliner - Match Start/Match End not working with Animations
    By apitcher799568 in forum NavisWorks - General
    Replies: 1
    Last Post: 2016-06-20, 06:21 AM
  2. Match Properties of Dynamic Blocks
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-12-14, 09:13 PM
  3. Dynamic Block Match Object Layer on insertion from Tool Palette
    By sfanello in forum Dynamic Blocks - Technical
    Replies: 5
    Last Post: 2007-08-02, 08:20 PM
  4. Match changes to a dynamic block
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2006-11-08, 12:56 PM
  5. Dynamic Block within a dynamic block?
    By pbrumberg in forum Dynamic Blocks - Technical
    Replies: 13
    Last Post: 2006-02-16, 07:05 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
  •