Author Topic: Copy Xref  (Read 2703 times)

0 Members and 1 Guest are viewing this topic.

One Shot

  • Guest
Copy Xref
« on: February 10, 2005, 10:39:38 AM »
What would cause this Lisp to not work in AutoCAD 2005? Can someone look at this?  Can someone change this to have an option for an xref and overlay?

Thank you







(defun c:copyxref (/ *error* CMD FD OBJ EN XREF ADD INS SCLX SCLY ROT)
(defun *error* (msg)
(if (or (= msg "Function cancelled")
(= msg "quit / exit abort")
)
(progn
(setvar "cmdecho" CMD)
(setvar "filedia" FD)
(princ)
)
(princ (strcat "\nError: " msg))
)
)
(setq CMD (getvar "cmdecho"))
(setq FD (getvar "filedia"))
(setvar "cmdecho" 0)
(setvar "filedia" 0)
(while (/= OBJ 1)
(setq EN (entsel "\nSelect Xref to insert: "))
(cond
((not EN)
(progn
(cond
((= (getvar "errno") 7) (princ "\nNo Xref selected"))
((= (getvar "errno") 52) (exit))
)
)
)
((/= (cdr (assoc 0 (entget (car EN)))) "INSERT")
(princ "\nNot an Xref")
)
((= 4
(logand
(cdr
(assoc
70
(entget
(tblobjname "block" (cdr (assoc 2 (entget (car EN)))))
)
)
)
4
)
)
(setq OBJ 1)
)
(T (princ "\nNot an Xref"))
)
)
(setq XREF (cdr (assoc 2 (entget (car EN)))))
(setq ADD
(cdr
(assoc 1
(entget
(tblobjname "block" (cdr (assoc 2 (entget (car EN)))))
)
)
)
)
(setq NEWNAME (getstring "\nName of XREF: "))
(setq INS (getpoint "\nSpecify insertion point: "))
(setq SCLX (getreal "\nEnter X scale factor: "))
(setq SCLY (getreal "\nEnter Y scale factor: "))
(setq ROT (getreal "\nSpecify rotation angle: "))
(command "XREF"
"Overlay"
(strcat NEWNAME "=" ADD)
INS
(rtos SCLX)
(rtos SCLY)
(rtos ROT)
)
(exit)
)

whdjr

  • Guest
Copy Xref
« Reply #1 on: February 10, 2005, 12:08:21 PM »
I ran it in 2005 and it worked for me, although I did notice the variable "NEWNAME" is not localized so that may be a factor.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Copy Xref
« Reply #2 on: February 10, 2005, 12:31:12 PM »
Quote from: whdjr
...... although I did notice the variable "NEWNAME" is not localized ......


good eye!!
TheSwamp.org  (serving the CAD community since 2003)

One Shot

  • Guest
Copy Xref
« Reply #3 on: February 10, 2005, 01:05:56 PM »
Quote from: whdjr
I ran it in 2005 and it worked for me, although I did notice the variable "NEWNAME" is not localized so that may be a factor.


How does it get localized?

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Copy Xref
« Reply #4 on: February 10, 2005, 01:39:31 PM »
You need to add it to this line;
Code: [Select]

(defun c:copyxref (/ *error* CMD FD OBJ EN XREF ADD INS SCLX SCLY ROT NEWNAME)
 
TheSwamp.org  (serving the CAD community since 2003)