Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

;;I want learn Lisp command "COPY" "MOVE" "ROTATE" with my Copy.

2 REPLIES 2
Reply
Message 1 of 3
jinkinglee
1018 Views, 2 Replies

;;I want learn Lisp command "COPY" "MOVE" "ROTATE" with my Copy.

;;How can Copy Block Layer and move 10" and Front Layer Rotate
;;I want learn command "COPY" "MOVE" "ROTATE"

(defun dtr (deg /)
  (* (/ deg 180.0) pi)
)
(defun cm_inch (cm /)
  (/ cm 2.54)
)
(defun dtr (deg /) (* (/ deg 180.0) pi));;0.0,pi=180 degrees
(setq piu (/ pi 2.0))
(setq pid (* pi 1.5))
(DEFUN C:LEARN ()
  (setvar "cmdecho" 1)
  (SETQ HEIGHT (CM_INCH 172.0))
  (SETQ CHEST (CM_INCH 116.0))
  (SETQ WAIST (CM_INCH 109.0))
  (SETQ SEAT (CM_INCH 115.0))
  (SETQ SLEEVE (CM_INCH 62.0))
  (SETQ COAT_LENGTH (CM_INCH 74.50))
 
  (SETQ O (GETPOINT "ENTER ORIGIN POINT")) ;Starting Point
  (if (= O nil)
    (setq O '(0 0))
  )
 
  (SETQ P1 (Polar O PIU 10.0))
  (SETQ P2 (POLAR P1 PI 5.0))
  (SETQ P3 (POLAR P2 PID 10.0))
  (SETQ P4 (Polar P3 pid 5.0))
  (SETQ P4 (Polar P4 0.0 2.5))
  (command "text" p4 1.0 0 "P5")
  (command "layer" "make" "FRONT" "c" "3" "" "")
  (setq ent (entlast)   ; mark last object
 BF  (ssadd)   ; initially empty
  )     ; end setq

  (Command "line" O P1 P2 P3 P4 O "")

  (while (setq ent (entnext ent)) ; find newer objects -- will stop with last Line drawn
    (setq BF (ssadd ent BF))  ; put into selection
  )     ; while
  (command "_.block" "Front" "0,0" BF "")
  (command "_.Insert" "Front" "0,0" "" "" "")

  (SETQ P5 (Polar P1 0.0 3.0))
  (SETQ P5 (Polar P5 piu 3.0))
  (SETQ P6 (Polar P5 pi 11.0))
  (SETQ P7 (Polar P6 pid 16.0))
  (SETQ P8 (Polar P7 0.0 11.0))
  (SETQ P9 (Polar P7 0.0 5.5))
  (SETQ P9 (Polar P9 pid 5.5))
  (command "layer" "make" "Back" "c" "5" "" "")
  (setq ent (entlast)   ; mark last object
 BB  (ssadd)   ; initially empty
  )     ; end setq
  (command "line" P5 P6 P7 P9 P8 P5 "")

  (while (setq ent (entnext ent)) ; find newer objects -- will stop with last Line drawn
    (setq BB (ssadd ent BB))  ; put into selection
  )     ; while
  (command "_.block" "Back" "0,0" BB "")
  (command "_.Insert" "Back" "0,0" "" "" "")

  (COMMAND
    "TEXT" "J"   "_ML"  O 1.0    0      "O"    "TEXT" "J"
    "_ML"  P1   1.0  0 "P1"   "TEXT" "J"    "_ML"  p2
    1.0    0   "p2"  "TEXT" "J"    "_ML"  p3     1.0    0
    "p3"   "TEXT" "J"  "_ML" p4     1.0    0      "p4"
   )
  (command "text" p5 1.0 0 "P5")
  (command "text" p6 1.0 0 "P6")
  (command "text" p7 1.0 0 "P7")
  (command "text" p8 1.0 0 "P8")
  (command "text" p9 1.0 0 "P9")
)

2 REPLIES 2
Message 2 of 3
Kent1Cooper
in reply to: jinkinglee


@jinkinglee wrote:

;;How can Copy Block Layer and move 10" and Front Layer Rotate
;;I want learn command "COPY" "MOVE" "ROTATE"

....


I'm not sure exactly what you want to do from the wording above.  It looks from your image as though you want to Copy both of the Blocks called "Front" [green] and "Back" [blue], then Move and Rotate by 180 degrees the new copy of the Block called "Front".  Is the 10" to Move it straight to the right?  What is the base point for the Rotation?

 

In general, if you know how to use those commands manually, you can put the answers to their prompts in a (command) function just as you already have with the Layer, Block, Insert and Text commands, and if you want the User to specify something while it is running [such as the Rotation base point?], the word pause for User input

Kent Cooper, AIA
Message 3 of 3
jinkinglee
in reply to: Kent1Cooper

Copy both of the Blocks called "Front" [green] and "Back" [blue], then Move and Rotate by 180 degrees the new copy of the Block called "Front". Is the 10" to Move it straight to the right? What is the base point for the Rotation?
Q. I need Just like what you did. Please . Yhanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost