Jump to content

Recommended Posts

Posted

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

Posted (edited)

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

(if

(= "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 )

(while

(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
Clearity
Posted

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

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