Need Help With Existing Lisp Code

Need Help With Existing Lisp Code

lucasa8LZ6Q
Explorer Explorer
384 Views
4 Replies
Message 1 of 5

Need Help With Existing Lisp Code

lucasa8LZ6Q
Explorer
Explorer

Hi All,

I have this lsp code for Copy-Rotate & Move-Rotate.

The commands work as intended, except i cant see the objects as they are moved or copied.

Regular commands (ie. move, copy etc) do show the objects as they are being translated.

I checked that:

dragmode is set to auto (tried "on" as well)

dragp1 & dragp2 (tried multiple values) but stayed with default

highlight is set to 1.

 

So im guessing its a code issue.

ive attached a picture because when i pasted the code in here it got rid of the spaces.Copy Rotate & Move Rotate.JPG

0 Likes
385 Views
4 Replies
Replies (4)
Message 2 of 5

pendean
Community Legend
Community Legend

@lucasa8LZ6Q wrote:

...ive attached a picture because when i pasted the code in here it got rid of the spaces.


You can paste the code in the codepage section

pendean_0-1701185576395.png

 


Dumb question... does MOCORO command not work for your needs?

0 Likes
Message 3 of 5

lucasa8LZ6Q
Explorer
Explorer

Hey Pendean,

haha thank you, i didnt realize that was there lol

;----------------------------------------------------------------
;COPY-ROTATE & MOVE ROTATE
;----------------------------------------------------------------

(defun c:mr  () (b-cmr "M")(princ))
(defun c:cr  () (b-cmr "C")(princ))

(defun b-cmr (typ / ss1 temp p0 p1)
   (setq ss1 (ssget "I"))

   (command ".undo" "begin")
   (setq temp (getvar "CMDECHO"))(setvar "CMDECHO" 0)

   (if (not ss1)(setq ss1 (ssget)))
   (if ss1
      (progn
         (initget 1)
         (setq p0 (getpoint "\nBasepoint : "))
         
         (if (= typ "C")
            (progn
               (setq p1 (getpoint "\nTranslation or <ENTER>: " p0))
               (if (not p1)(setq p1 p0))
               (command ".copy" ss1 "" "0,0" "0,0")
            )
            (while (not p1)(setq p1 (getpoint "\nTranslation : " p0)))
         )

         (command ".move" ss1 "" p0 p1)
         (command ".rotate" ss1 "" p1 pause)
      )
      (princ "\nMsg> Nothing selected! ")
   )

   (command ".undo" "end")
   (setvar "CMDECHO" temp)
   (princ)
) 

 

I dont like macros because i cant assign them to a keyboard command unless i use ctrl+shift.

and i like Move Rotate being "mr" for example

0 Likes
Message 4 of 5

Kent1Cooper
Consultant
Consultant

@lucasa8LZ6Q wrote:

.... The commands work as intended, except i cant see the objects as they are moved or copied.

Regular commands (ie. move, copy etc) do show the objects as they are being translated.

....



I agree, MOCORO could be all you need, but if you really want defined commands....

 

You're not seeing them drag because you're not in the regular command when you are asked for the destination.  It's just asking for a point, unconnected with any command, so of course it doesn't drag the object(s).  Try not turning off command echoing, leaving the base and destination point prompts to the commands themselves instead of asking for them separately, and:

 

....
  (if ss1
    (progn ; then
      (if (= typ "C") (command "_.copy" ss1 "" "0,0" "0,0"))
      (command
        "_.move" ss1 "" pause pause
        "_.rotate" ss1 "" "@" pause
      ); command
    ); progn [then]
    ....

 

 

Kent Cooper, AIA
0 Likes
Message 5 of 5

ВeekeeCZ
Consultant
Consultant
0 Likes