Jump to content

Help tweaking lsp


Ste1978

Recommended Posts

I was kindly given this code which extracts all blocks from a drawing into individual drawing files. However, the only problem is that the individual blocks are exploded when I open the drawing file whereas when they were in the original file they were not exploded. I need to tweak this code somehow so that the block remains unexploded, this way I can browse to them through Design Centre. Can anyone help?

 

 

;;Make individual dwgs from all the blocks in a drawing
;; By Mark S. Thomas

(defun c:bwblock (/ ss cntr bn)
 (setq ss (ssget "x" '((0 . "INSERT")))
       cntr 0
        )

 (mapcar 'setvar '(filedia cmddia) '(0 0))

 (if (not (zerop (sslength ss)))
   (while (setq ent (ssname ss cntr))
      (setq bn (cdr (assoc 2 (entget ent)))
            cntr (1+ cntr)
            )
     ;; wblock each block in the current dwg prefixed with "BLOCK_"
     ;; and sent to c:\temp which must exist
     ;(command "_wblock" (strcat "c:\\temp\\BLOCK_" bn) bn "NO"); for Map
     (command "_wblock" (strcat "c:\\temp\\BLOCK_" bn) bn)
     )
   )
 (mapcar 'setvar '(filedia cmddia) '(1 1))
 )

blocks.lsp

Link to comment
Share on other sites

Umm it is doing a write block, which means it saves the the items in a new dwg, because a block is simple a dwg inserted in to a block.

 

hope it makes sence

Link to comment
Share on other sites

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...