Here an old lisp that once worked.
I haven't done lisps for a few years now.
I added the XBG back in 1996 I use to be very active in writing code.
Maybe someone can go from here: Hey it's a start... )
Code:
; NAME: CIV-XGO ( CCXREF )
;
; Open an Master file by picking
;
; Master file name is derived from the attachment name,
; with the X chopped off
;
;
; Written by : M. Kiker 73423,1707
; Date: 11/95
; Revised: 4/96 - I. Cruz, J. Wheat - Added zoom window definition - xbg
;
; USE AT YOUR OWN RISK...
;
;
; Copyright (C) 1995 by Mark Kiker
;
; Permission to use, copy, modify, and distribute this software
; for any purpose and without fee is hereby granted, provided
; that the above copyright notice appears in all copies and that
; both that copyright notice and this permission notice appear in
; all supporting documentation.
;
; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
; ****************************************************************
(defun catcherr (s)
(if (/= s "Function cancelled") ; If an error (such as CTRL-C) occurs
(princ (strcat "\nError: " s)) ; while this command is active...
)
(setq p nil) ; Free selection set
(setq *error* olderr) ; Restore old *error* handler
(princ)
)
(defun c:CCXREF()
(setq olderr *error*
*error* catcherr)
(setq xrefpic (entsel "Pick XREF to OPEN: "))
(setq xrefinfo (entget (car xrefpic)))
(setq xrefgoname (cdr (assoc 2 xrefinfo)))
(setq xlen (strlen xrefgoname))
(setq xrefgoname1 (substr xrefgoname 2 xlen))
(setq xrefgoname (strcat (getvar "dwgprefix") xrefgoname1))
(Setq goyes (getstring (strcat "\nDo you want to call up " xrefgoname "? <Yes>: ")))
(if (or (= goyes "") (= goyes "Y") (= goyes "y"))
(progn
(prompt (strcat "Saving " (getvar "dwgname") " and calling up " xrefgoname "\n"))
(if (findfile (strcat xrefgoname ".dwg"))
(progn
;(command "tilemode" "0" "Pspace" "qsave")
;(command "tilemode" "1")
(xbg)
;(command "open" xrefgoname)
)
)
)
(progn
(prompt (strcat "File " xrefgoname " not found"))
(princ)
)
)
)
;---------- Check to make sure its an XREF file
(defun CHKREF (/ blk_name blk_list)
(setq check_val nil)
(setq XREF_LIST nil)
(setq BLK_NAME (cdr (assoc 2 (tblnext "BLOCK" T)))
BLK_LIST (list BLK_NAME))
(while (/= BLK_NAME nil)
(setq XREF_NAME (cdr (assoc 1 (tblsearch "BLOCK" blk_name))))
(setq BLK_NAME (cdr (assoc 2 (tblnext "BLOCK"))))
(if (/= XREF_NAME nil)
(setq XREF_LIST (cons XREF_NAME XREF_LIST))
)
)
(while (/= XREF_LIST nil)
(setq XREF (car XREF_LIST)
XREF_LIST (cdr XREF_LIST)
)
(setq len_of_xname (strlen XNAME))
(setq len_of_xref (strlen XREF))
(setq start_num 1)
; (CHECKPATH)
(setq detach_name (substr XREF start_num len_of_xname))
(if (= (strcase detach_name)(strcase xname)) ;======== A MATCH
(progn
(setq check_val 1)
(setq xref_list nil)
)
(setq check_val 0)
)
)
(princ)
)
(defun xbg ()
(setq $vartile (getvar "tilemode"))
(setq $vardwg (getvar "dwgname"))
(setq $prevdwg (open "$prevdwg.txt" "w"))
(write-line $vardwg $prevdwg)
(close $prevdwg)
;
(prompt (strcat "\nPick Window / (ENTER for Current Display):"))
(setq $choice (grread nil 4 0))
(setq grtype (car $choice))
(setq grb (car (cdr $choice)))
(setq $viewdp1 grb)
;
(if (= GRB 13)(currdisp));IF EQUALS CR-return
(if (= GRB 32)(currdisp));IF EQUALS (SP) Spacebar
(if (= grtype 3)(pickdisp))
;
;(setq $choice (getstring "\n(P)ick Window / (ENTER for Current Display):"))
;(setq $choice (strcase $choice))
;(if (= $choice "")(currdisp))
;(if (= $choice "P")(pickdisp))
)
(defun currdisp ()
(setq $vctr (getvar "VIEWCTR"))
This lisp as you can see is from 1996.
What needs to happen is simple but like I said before, it has been a long this since I have written a lisp from scratch.
I see you can call "XOPEN" after you store the pick point x and y. Once the file opens call the same x and y point and zoom to it.
These are my thoughts but I hope someone else can create this lisp.
I wish I could be more help.
Jesse