Jump to content

Recommended Posts

Posted

This has probably already been dealt with in the past but I can't find a post that helps me in this particular situation.

I have a DXF file from an external source where all the blocks come into my drawing named "diag_cross".

I would like to redefine the blocks but on a layer-dependant basis.

For example, If the layer was named "757_TAP" then the redefine would need to be "diag_cross=tap" where ACAD would call file "tap".

However, as redefine is a global statement, I need to be able to select as layer-name dependant.

Ideally this would be an automated process if possible, rather than by selection.

 

Posted

Is the original dwg made from field survey ? If so way better to go back a few steps, CIV3D and for me Civil Site Design support read a field survey code and insert correct block on the point as well as stringing.

 

Posted

Well, you can't call a block "diag_cross=tap".  No special characters (except a few).

 

You can redefine the blockname of inserted blocks; that's no problem.

Here's a test example:

(defun rename_blockname (blockname newblockname  / blklst)
	(vl-load-com)  
	(setq blklst (vla-get-Blocks (vla-get-activedocument (vlax-get-acad-object))))
	(vla-put-Name (vla-item blklst blockname) newblockname)
)


(defun c:rdb ( / ss i blockname newblockname)
	(if (or (setq ss (ssget '((0 . "INSERT")))) (setq ss (ssget "_X" '((0 . "INSERT")))))
		(progn
			(setq i 0)
			(repeat (sslength ss)
				(rename_blockname 
					(setq blockname (cdr (assoc 2 (entget (ssname ss i)))))
					(setq newblockname (getstring (strcat "Block: " blockname ", set new name: ")))
				)
				(setq i (+ i 1))
			)
		)	
	)
	(princ)
)

 

But I'm not sure what exactly you want.  

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