Results 1 to 3 of 3

Thread: Dynamic Block Modifying stopped Working - Please Help

  1. #1
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Default Dynamic Block Modifying stopped Working - Please Help

    A lisp I wrote (with some help) a few years ago is no longer working properly.

    It used to modify the block immediately after insertion to display the desired visibility state.

    It will still insert the block appropriately, just will not modify now and I don't know why.

    Note: I believe I was using Acad 09 when I made and used this lisp. I am at different company now and using Acad 2011.

    I have removed some features to shorten the posted lisp and isolate the problem.
    (Layer scale and resetting some variables)

    Any help is appreciated.

    Thanks,
    Andre

    Code:
    (vl-load-com)
    
    (defun c:rcp (/ bname props a blkobj rlay ortype visval)
    
      (setq bname "receptacles_anno.dwg")
    
      (if (not rtype) (setq rtype "Duplex"))
      (setq ortype rtype)  
    
      (setq rtype (getstring (strcat "\n1.Duplex / 2.Double Duplex / 3.Above Counter Duplex / 4.Above Counter Double Duplex <" ortype ">: ")))
      (if (= rtype "")
        (setq rtype ortype))  
      
      (cond
        ((= rtype "1")
         (setq rtype "Duplex"))
        ((= rtype "2")
         (setq rtype "Double Duplex"))
        ((= rtype "3")
         (setq rtype "Above Counter Duplex"))
        ((= rtype "4")
         (setq rtype "Above Counter Double Duplex"))    
        )  
      
      (command "-insert" bname "s" 1 pause "")
    
      (setq props (vlax-safearray->list
                    (variant-value
                      (vla-getdynamicblockproperties
                        (setq blkobj (vlax-ename->vla-object (entlast)))))))
      
      (if (vl-catch-all-error-p
            (setq res (vl-catch-all-apply
                        (function
                          (lambda ()
                            (foreach a  props
                              (if (eq "Visibility" (vla-get-propertyname a))
                                (vlax-put-property a 'Value rtype))))))))
        (vl-catch-all-error-message res))
      
      
      (princ))
    Attached Files Attached Files

  2. #2
    100 Club
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    116
    Login to Give a bone
    0

    Default Re: Dynamic Block Modifying stopped Working - Please Help

    The name of the applicable property actually comes out as "Visibility1", rather than "Visibility". The following change works for me:

    Code:
    (vl-load-com)
    
    (defun c:rcp (/ bname props a blkobj rlay ortype visval)
    
      (setq bname "receptacles_anno.dwg")
    
      (if (not rtype) (setq rtype "Duplex"))
      (setq ortype rtype)  
    
      (setq rtype (getstring (strcat "\n1.Duplex / 2.Double Duplex / 3.Above Counter Duplex / 4.Above Counter Double Duplex <" ortype ">: ")))
      (if (= rtype "")
        (setq rtype ortype))  
      
      (cond
        ((= rtype "1")
         (setq rtype "Duplex"))
        ((= rtype "2")
         (setq rtype "Double Duplex"))
        ((= rtype "3")
         (setq rtype "Above Counter Duplex"))
        ((= rtype "4")
         (setq rtype "Above Counter Double Duplex"))    
        )  
      
      (command "-insert" bname "s" 1 pause "")
    
      (setq props (vlax-safearray->list
                    (variant-value
                      (vla-getdynamicblockproperties
                        (setq blkobj (vlax-ename->vla-object (entlast)))))))
      
      (if (vl-catch-all-error-p
            (setq res (vl-catch-all-apply
                        (function
                          (lambda ()
                            (foreach a  props
                              (if (eq "Visibility1" (vla-get-propertyname a))
                                (vlax-put-property a 'Value rtype))))))))
        (vl-catch-all-error-message res))
      
      
      (princ))

  3. #3
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Default Re: Dynamic Block Modifying stopped Working - Please Help

    Thanks GHarvey =)

Similar Threads

  1. Replies: 4
    Last Post: 2012-11-01, 12:10 AM
  2. Replies: 1
    Last Post: 2012-06-18, 10:56 PM
  3. Dynamic Blocks stopped working
    By mjw.254916 in forum Dynamic Blocks - Technical
    Replies: 1
    Last Post: 2011-10-12, 12:04 PM
  4. Dynamic block - partially working
    By htlmv in forum Dynamic Blocks - Technical
    Replies: 2
    Last Post: 2010-08-25, 05:49 PM
  5. Dynamic block partially working
    By htlmv in forum Dynamic Blocks - Technical
    Replies: 2
    Last Post: 2010-08-25, 05:48 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
  •