Jump to content

Recommended Posts

Posted

I need to create a lisp code to copy an item from a Block and place at same location but in difference layer.

Please help to create a code to use NCOPY command with a lisp code.

Posted

Get a pencil and paper and write down every command as you do it manually. Then rewrite as lisp.

Posted
38 minutes ago, BIGAL said:

Get a pencil and paper and write down every command as you do it manually. Then rewrite as lisp.

That is the way I am doing. But difficulty is select the relevant entity of the block. Entsel  or SSget command is selecting the whole

block not the entity. Pl help.

Posted
(defun c:test(/ p1)
(setq p1(cadr(entsel)))
(command "NCOPY"p1"""D""")
(setq ent (entlast))
(command "change" ent "" "P" "LA" "my" "")
  )

Finally I do it myself. But when I select attribute it does not absorb the displayed value . it goes to default

ncopy.PNG

Posted (edited)
14 hours ago, Dayananda said:

(defun c:test(/ p1)
(setq p1(cadr(entsel)))
(command "NCOPY"p1"""D""")
(setq ent (entlast))
(command "change" ent "" "P" "LA" "my" "")
  )

Finally I do it myself. But when I select attribute it does not absorb the displayed value . it goes to default

ncopy.PNG

 

Why are you trying to NCOPY an "ATTRIB" ? As it isn't in a block it will always take on the "TAG" value. Wouldn't it be better to entmake a bit of text instead, or are the two linked?

Edited by dlanorh
Posted

Using nentsel will get what you want

 

(entget (car (nentsel "Pick attribute"))) just look at what is returned.

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