Jump to content

Recommended Posts

Posted

Hi, 

I have a LISP code to help clean up some incoming files from Civils as we work on projects. 

I wanted to add to this code that I got, and was wondering if there are any lines of code that could make AutoCAD:

1. Change Allow Exploding to "Yes" for all blocks

2. Select all hatches in drawing and change Annotative to "No"

 

I heard the commands can be limited, so just wondering if its possible and what it might look like.

 

Thanks!

 

Posted

Here is a quick find from Google for setting all blocks as explodable:

 

;; Set every block as explodable
;; http://forums.augi.com/showthread.php?33008-Allow-block-exploding&highlight=explodable&pp=10
;; posted by whdjr
(defun c:eb ()
(vl-load-com)
  (vlax-map-collection
	(vla-get-blocks
	  (vla-get-activedocument (vlax-get-acad-object))
	)
	'(lambda (x)
	   (and
	 (vlax-property-available-p x 'explodable)
	 (eq (vlax-get-property x 'explodable) :vlax-false)
	 (not (vlax-put-property x 'explodable :vlax-true))
	   )
	 )
  )
)

 

  • Like 1
Posted

in autocad you could change Annotative to "No" using setpropertyvalue. 
For example:
 

(setpropertyvalue ent "Annotative" 0)

 

  • Like 1
Posted

Just a comment in Bricscad V25 the setpropertyvalue does not work, the get does work. One of those odd bugs

  • Agree 1
  • Thanks 1
Posted

Here is another for allowing explode... Solved: Re: Allow exploding outside the block editor - Autodesk Community

 

Are these drawings from AutoCAD Civil 3D or some other CAD?

 

 

(defun c:AllBlkYHtchN (/ ss i ent)

  (vl-load-com)

  ;;--------------------------------------------------
  ;; Set Allow Exploding = Yes for all block definitions
  ;;--------------------------------------------------
  (vlax-map-collection
    (vla-get-Blocks
      (vla-get-ActiveDocument
        (vlax-get-acad-object)))
    '(lambda (blk)
       (if (vlax-property-available-p blk 'Explodable)
         (vlax-put-property blk 'Explodable :vlax-true)
       )
     )
  )

  ;;--------------------------------------------------
  ;; Set all hatches Annotative = No
  ;;--------------------------------------------------
  (if (setq ss (ssget "_X" '((0 . "HATCH"))))
    (progn
      (setq i 0)
      (repeat (sslength ss)
        (setq ent (ssname ss i))
        (vl-catch-all-apply
          '(lambda ()
             (setpropertyvalue ent "Annotative" 0)
           )
        )
        (setq i (1+ i))
      )
    )
  )

  (princ
    (strcat
      "\nUpdated "
      (itoa (if ss (sslength ss) 0))
      " hatch(es). All explodable block definitions enabled."
    )
  )
  (princ)
)

 

Do you need nested hatches and blocks, dynamic and/or anonymous blocks?

 

 

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...