autolisp Copy command reference guide -(command "_.copy" obj --- thanks

autolisp Copy command reference guide -(command "_.copy" obj --- thanks

Anonymous
Not applicable
3,922 Views
2 Replies
Message 1 of 3

autolisp Copy command reference guide -(command "_.copy" obj --- thanks

Anonymous
Not applicable

Hi,guys!

I want to use (command "_.copy"

in my code,

but I can't find a reference on what parameters this command use.

 

Does soemone have a link for that?

 

Thanks

0 Likes
Accepted solutions (1)
3,923 Views
2 Replies
Replies (2)
Message 2 of 3

ВeekeeCZ
Consultant
Consultant
Accepted solution

That's the way how to use regular autocad's commands. So try the COPY command from command line and you'll see. 

 

In this case... COPY command runs like this: run copy, asks user for a selection, then for a base point, then for a destination point. 

 

COPY command does accept multiple entities or selection set, so you have multiple choices:

 

Spoiler
; PAUSE allows user make just one input
(command
  "_.COPY"
  PAUSE ; one input
  "" ; terminate selection
  PAUSE ; select base point
  PAUSE ; select destination point
  )
;same in a line
(command "_.COPY" PAUSE "" PAUSE PAUSE)

; if you need to copy 2 entities
(command "_.COPY" PAUSE PAUSE "" PAUSE PAUSE)

; this specification gives you the same
(command "_.COPY")
(command PAUSE)
(command PAUSE)
(command "")
(command PAUSE PAUSE)

; if you need multiple user's input and don't know how many, you need to use PASUE loop since command is active
(command "_.COPY")
(while (> (getvar 'CMDACTIVE) 0)
  (command PAUSE))

; or you can use autocad's SELECT command as well which allows user multiple selection even that PAUSE usually allows just single input
(command
  "_.SELECT"
  PAUSE 
  "_.COPY"
  "_P" ; previous selection
  "" ; terminate selection
  PAUSE
  PAUSE
  )

; or using lisp
(setq ss (ssget)
      pt1 (getpoint "\nSpecify base point: ")
      pt2 (getpoint "\nSpecify destination point: ")
      )
(command "_.COPY" ss "" pt1 pt2)

; command accepts entity name as well (this is clean way). This way is good if you want to specify a different prompt than is the original prompt. With PAUSE you can't do that.
(setq ensel1 (entsel "\nSelect entity one: ")
      en1 (car ensel1)
      ensel2 (entsel "\nSelect entity two: ")
      en2 (car ensel2)
      pt1 (getpoint "\nSpecify base point: ")
      pt2 (getpoint "\nSpecify destination point: ")
      )
(command "_.COPY" en1 en2 "" pt1 pt2)

; usually commands accept list (<entity> selpoint) given by entsel as well.
(setq ensel1 (entsel "\nSelect entity one: ")
      ensel2 (entsel "\nSelect entity two: ")
      pt1 (getpoint "\nSpecify base point: ")
      pt2 (getpoint "\nSpecify destination point: ")
      )
(command "_.COPY" ensel1 ensel2 "" pt1 pt2)

; if you don't need variable you can use it directly.
(command "_.COPY" (entsel "\nSelect entity one: ") (entsel "\nSelect entity two: ") "" (getpoint "\nSpecify base point: ") (getpoint "\nSpecify destination point: "))

; some commands NEEDS a list (<entity> selpoint) given by entsel or PAUSE or made (list en pt)
(setq en1 (car (entsel "\nSelect entity one: ")))

;then one of these:
(command "_.TRIM" en1 "" PAUSE "")
(command "_.TRIM" en1 "" (entsel) "")
(command "_.TRIM" en1 "" (list en2 pt) "") ; where en2 is entname and pt is point

 

Message 3 of 3

Anonymous
Not applicable

WOWWWWWWWWW!!!!!!!!

 

Triple WOOWWWWWWWW!

 

Thank you so much!

0 Likes