Author Topic: xref short cut help required  (Read 2490 times)

0 Members and 1 Guest are viewing this topic.

diarmuid

  • Bull Frog
  • Posts: 417
xref short cut help required
« on: July 27, 2004, 09:48:57 AM »
anyone, have a little lisp that will allow me to reload an xref just by picking it?

thanks in advance.

p.s.  i cant download files (company policy) but i can cut and paste, so if its not to much trouble could somebody just post it here? :)

thanks again
If you want to win something run the 100m, if you want to experience something run a marathon

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
xref short cut help required
« Reply #1 on: July 27, 2004, 11:12:21 AM »
Shouldn't be a problem, give me a few minutes.
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
xref short cut help required
« Reply #2 on: July 27, 2004, 11:35:44 AM »
Code: [Select]

(defun get-utilobj ()
  (vla-get-utility
    (vla-get-activedocument (vlax-get-acad-object))
    )
  )

(defun obj-select (/ obj pt)
  (if (not (vl-catch-all-error-p
             (vl-catch-all-apply
               'vlax-invoke-method
               (list (get-utilobj) 'GetEntity 'obj 'pt)
               )
             )
           )
    obj
    )
  )

(defun get-block-object ()
  (vlax-get-property
    (vla-get-activedocument
      (vlax-get-acad-object)
      )
    'Blocks
    )
  )

(defun x-reload (obj / blks_obj xref_name)
  (setq blks_obj (get-block-object)
        xref_name (vlax-get-property obj 'Name)
        )

  (vlax-invoke-method (vla-item blks_obj xref_name) 'reload)
  )

(defun c:xre (/ obj)
  (if (setq obj (obj-select))
    (if (= (vlax-get-property obj 'ObjectName) "AcDbBlockReference")
      (x-reload obj)
      ; else
      (alert "That was not an XREF")
      )
    )
  (princ)
  )
TheSwamp.org  (serving the CAD community since 2003)

diarmuid

  • Bull Frog
  • Posts: 417
xref short cut help required
« Reply #3 on: July 27, 2004, 11:42:12 AM »
thanks a million.

Rgds

Diarmuid
If you want to win something run the 100m, if you want to experience something run a marathon

yyou

  • Guest
xref short cut help required
« Reply #4 on: July 27, 2004, 12:26:23 PM »
Mark, you are something.  I still don't get what diarmuid wants; let alone giving him the answer.  How can we pick a xref if it is not loaded? Can we even see it?

diarmuid

  • Bull Frog
  • Posts: 417
xref short cut help required
« Reply #5 on: July 27, 2004, 12:34:01 PM »
o.k.  the xref is loaded in drawing sheet no. 1

i also have the xref open, i move stuff/add stuff etc. and i want to see how it looks in the sheet. so i dont have to list the xref (some of my drawings have 30 xrefs (all numbered, not named in a way that is easily recognisable)  so i dont have to remeber the number of the xref etc. i dont have to open the xref dialogue box a select the xref and and select reload (not to mention the times i select unlaod by accident etc..etc.  etc.) i just type xre and pick.

let...your...lisp...file...do...the...working...la, la, la

if there is any pro argument for lisp, vba etc. the written above is a perfect example.

Thanks again.  Also for the jedi mind reading powers.
If you want to win something run the 100m, if you want to experience something run a marathon

ronjonp

  • Needs a day job
  • Posts: 7529
xref short cut help required
« Reply #6 on: July 27, 2004, 01:31:36 PM »
I've been using this one:
Code: [Select]

(defun C:RX (/ OBJ);goto the xref
 (vl-load-com)
 (setq OBJ (vlax-ename->vla-object (car (entsel "\nSelect Xref: "))))
 (if (vlax-property-available-p OBJ 'Path)
  (progn
   (setq PATH (vlax-get-property OBJ 'Path))
   (startapp (strcat (findfile "ACAD.EXE") " \"" PATH "\""))
  )
  (prompt "\nSelected object was not an XREF...")
 )
 (prin1)
)
(defun C:RX (/ en blkname);update xref with a touch
 (setq en (entsel "\nSelect xref: ") blkname (cdr (assoc 2 (entget (car en)))))
 (command "._xref" "R" blkname)
 (prin1)
)
(c:rx)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

t-bear

  • Guest
xref short cut help required
« Reply #7 on: July 27, 2004, 04:23:14 PM »
NICE! Not to complain about a great routine but..... I have nested xrefs....I don't suppose it could be made to pick, say, the filter that is xref'd into the top assembly?