TheSwamp
CAD Forums => CAD General => Topic started by: diarmuid 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
-
Shouldn't be a problem, give me a few minutes.
-
(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)
)
-
thanks a million.
Rgds
Diarmuid
-
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?
-
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.
-
I've been using this one:
(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)
-
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?