Results 1 to 2 of 2

Thread: Redefining your Dynamic Blocks

  1. #1
    I could stop if I wanted to
    Join Date
    Login to Give a bone

    Default RE: Dynamic Block file sharing anyone?

    This is a jewel I wrote a while back that I use all the time when creating and testing Dynamic Blocks. You still need to 'ATTSYNC' the block after you make changes to update any attribute mods you might have made.

    Let me know if you got any questions.

    Save this as rib.lsp somewhere in your acad support path.
    Load it by typing: (load "rib")
    Run it by typing: rib

    All you do is make a block just like you always have and save it. Then reopen it and add your dynamic properties to it and then save the block. Then open a file that has that block in it already(not with the new changes), and load and run RIB and then select the block and it will update with the new changes to your old block.
    ;;;This tool allows the user to select a block or dynamic block and redefines 
    ;;;the block.  It searches in the current directory first, then the AutoCAD   
    ;;;support paths, then it looks for a global variable of the last place it	
    ;;;found the block, and lastly lets you select the block to redefine it with. 
    ;;;Copyright 2005 Will DeLoach
    ;;; $db_path$ - global variable same value as local variable file.
    ;;;			 Is very helpful when designing and tesing Dynamic Blocks.
    ;;;RIB = ReInsert Block
    (defun c:rib (/
    		  ss   ; selection set of block to redefine
    		  ent  ; entity name of block
    		  obj  ; object of the entity
    		  name ; name of block
    		  path ; short path of block location
    		  file ; full path of block location
     (while	(not ss)
      (setvar "ErrNo" 0)
      (prompt "\nSelect a Block to redefine:  ")
       ((setq ss (ssget ":S:E" '((0 . "INSERT"))))
    	(if	(> (sslength ss) 1)
    	   "\nMore than one Block was selected.  Please select only one Block. "
    	  (setq ss nil)
    	 (setq ent (ssname ss 0))
       ((= (getvar "ErrNo") 52)
    	(princ "\nRight-Click detected.  Program Terminated.")
       ((null ss)
    	(princ "\nSelection missed.  Please try again.")
     (setq obj (vlax-ename->vla-object ent))
     (if (and (vlax-property-available-p obj 'isdynamicblock)
    	  (eq (vla-get-isdynamicblock obj) :vlax-true)
      (setq name (vlax-get-property obj "effectivename"))
      (setq name (vla-get-name obj))
     (setq path (vla-get-path (vla-get-document obj)))
     (cond ((setq file (findfile (strcat path "\\" name ".dwg"))))
    	   ((setq file (findfile (strcat name ".dwg"))))
    	   ((if (and $db_path$ (eq (vl-filename-base $db_path$) name))
    	 (setq file $db_path$)
    	(setq file	(getfiled "Select a Block"
    				  (strcat path "\\")
    				  (+ 64 128)
    		  $db_path$	file
     (if file
       (command "-insert" (strcat name "=" file) nil)
       (princ (strcat "\nBlock " name " was loaded from " file))

  2. #2
    Wish List Manager BrenBren's Avatar
    Join Date
    Login to Give a bone

    Default Re: Redefining your Dynamic Blocks


    Just wanted to let you know that I moved this over here, as I feel it is a good tip and should probably be placed here; I know we have gotten requests on the wish list for AutoCAD to do this, so I felt this should probably have it's own thread.

    Let me know if you've got any questions.

Similar Threads

  1. Redefining Dynamic blocks
    By ccowgill in forum Dynamic Blocks - Technical
    Replies: 11
    Last Post: 2008-09-25, 04:54 PM
  2. Redefining old Blocks to new Dynamic Blocks
    By dgriessmann.86073 in forum AutoCAD General
    Replies: 2
    Last Post: 2006-10-31, 09:41 PM
  3. Dynamic Blocks Not Redefining
    By Rico in forum Dynamic Blocks - Technical
    Replies: 9
    Last Post: 2006-02-07, 07:50 PM
  4. Redefining Dynamic Blocks - Layer Colors not updating
    By sumulong in forum Dynamic Blocks - Technical
    Replies: 1
    Last Post: 2006-01-24, 09:46 PM
  5. redefining blocks
    By rwbaker in forum AutoCAD General
    Replies: 4
    Last Post: 2005-09-27, 09:31 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