Jump to content

Get Block data without picking the block...?

Recommended Posts


Good morning,



I have a piece of LISP that allows me to pick a block then pass the data into a new block's attributes, the problem is that when I run it in a script file it does not seem to pick the blocks using the coordinates given even though it does if it is manually typed in to test the function....



Is there someone that can show me what I need to change in the attached LISP to automatically fix the block data and not require the user to pick anything, just use the block names...?



Thank you all very mush for helping.

Copy Attributes to new blocks.lsp

Share this post

Link to post
Share on other sites

Thanks, but I don't understand LISP well enough to figure out what is different...



The example routine starts with:

(defun c:COPATT ( / e x)

(setq e (car (entsel "\nSelect your block : "))

x (entget e) )


(= "MFTB" (cdr (assoc 2 x)) );Original Block Name SPTLB or MFTB


Your example starts with:

(defun c:test ( / myentsel des src val )

(setq myentsel

(lambda ( msg / ent enx )


(progn (setvar 'errno 0) (setq ent (car (entsel msg)))



Please remember, I barely have any LISP experience and don't understand much of what is going on here, that is why I added notes at each step of the attached LISP. Does the picking ability have something to do with the ( / myentsel des src val ) part at the beginning?



Thanks for looking at this for me...

Edited by BShick5088

Share this post

Link to post
Share on other sites

You can not entsel via a pt (entsel pt) manually it will work maybe not in a script. Anyway if you use ssget you can do a pt (ssget "C" '(-1 -1) '(1 1)) for the point 0,0 then just get the 1st entry (ssname ss 0) a little bit of recoding

Share this post

Link to post
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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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