PDA

View Full Version : Mirror Objects Along 2 Axis....HELP..!



CADdancer
2004-09-30, 07:09 PM
Hello AUGI Members:

I was trying to create a simple lisp program to allow me to mirror selected objects twice about 2 mirror planes. I have the routine working if I only select one object however, if I select more than one object all of the objects do not mirror properly. Below is a sample of the code, can anyone help me correct the problem.

;;;;START CODE

(defun c:MIXY (/ SS1 SS2)
(SETVAR "CMDECHO" 0)

(Prompt "n...Select Objects to Mirror...")
(setq SS1 (ssget))

(PROMPT "n...FIRST MIRROR......Select First Mirror Point....Then....Select the Second Mirror Point...")
(COMMAND "MIRROR" SS1 "" Pause Pause "N" )
(SETQ SS2 (SSGET "l"))

(Prompt "n")
(PROMPT "n...SECOND MIRROR......Select First Mirror Point....Then....Select the Second Mirror Point...")
(COMMAND "MIRROR" SS1 SS2 "" Pause Pause "N" )

(SETVAR "CMDECHO" 1)
(princ)
)

;;;;;END CODE

Any assistance would be appreciated.

Regards,
Vince

Jeff_M
2004-09-30, 09:10 PM
Give this a whirl......


;;;START CODE

(defun c:MIXY (/ SS1 SS2)
(SETVAR "CMDECHO" 0)
(command "undo" "end")
(command "undo" "be")
(Prompt "n...Select Objects to Mirror...")
(setq SS1 (ssget)
lastent (entlast))

(PROMPT "n...FIRST MIRROR......Select First Mirror Point....Then....Select the Second Mirror Point...")
(COMMAND "MIRROR" SS1 "" Pause Pause "N" )
(SETQ SS2 (SSadd))
(while (setq lastent (entnext lastent))
(ssadd lastent ss2)
)

(Prompt "n")
(PROMPT "n...SECOND MIRROR......Select First Mirror Point....Then....Select the Second Mirror Point...")
(COMMAND "MIRROR" SS2 "" Pause Pause "N" );removed ss1
(command "erase" ss2 "")
(command "undo" "end")
(SETVAR "CMDECHO" 1)
(princ)
)

;;;;;END CODE


Good luck,
Jeff

CADdancer
2004-10-01, 11:42 AM
Jeff:

I tried your updated code and made one minor change by adding SS1 to SS2 for the second mirror action and it worked fine.

Thank you for your assistance in this matter.

Regards,
Vince