Hi All,
I have been looking around the web to find a quick lsp routine that will take all the xrefs in a drawings and move them back onto layer "xref" or "0" depending on what the design team wants.
The ones I have found don't work or move all the xrefs to seperate layers.
Does anyone know of any that I can use or know where to look for them?
Thanks again for you help.
Sorry my last reply was not that complete so please consider the following instead:
(vl-load-com) (defun c:Test (/ ss i vla) ;; Tharwat 31. Oct. 2011 ;; (if (and (or (tblsearch "LAYER" "x-ref") (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") (cons 2 "x-ref") '(70 . 0) ) ) ) (setq ss (ssget "_X" '((0 . "INSERT")))) ) (repeat (setq i (sslength ss)) (setq vla (vlax-ename->vla-object (ssname ss (setq i (1- i))))) (if (vlax-property-available-p vla 'Path) (vla-put-layer vla "x-ref") ) ) (princ) ) (princ) )
Im looking for a small edit on this.
If i would like to select the xref first and when i clicked i want to move it to layer "xref" and change its colour.
User input:
Start command
Select xref
xref moves to layer "xref"
changes color to 9
Anyone have an idea for edit on this?
thanks in advance
A single selection, and change the color of every layer in the xref is what i had in mind.
Try this. A quick amalgam of @_Tharwat 's and @ronjonp 's code from above link in my post
(vl-load-com) (defun c:Test (/ doc ss i vla) ;; Tharwat 31. Oct. 2011 ;; (setq doc (vla-get-activedocument (vlax-get-acad-object))) (cond ( (or (tblsearch "LAYER" "x-ref") (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") (cons 2 "x-ref") '(70 . 0) ) ) ) (prompt "\nSelect XRef : ") (setq ss (ssget "_+.:E:S:L" '((0 . "INSERT")))) (setq vla (vlax-ename->vla-object (ssname ss 0))) (cond ( (vlax-property-available-p vla 'Path) (setq blk (vlax-get vla (if (vlax-property-available-p vla 'effectivename) 'effectivename 'name))) (vlax-for lyr (vla-get-layers doc) (and (wcmatch (vla-get-name lyr) (strcat blk "|*")) (vla-put-color lyr 9)) ) (vla-put-layer vla "x-ref") ) ) (vla-regen doc acactiveviewport) (princ) ) ) (princ) )
This won't change the color of xref object that aren't bylayer or byblock
I am not one of the robots you're looking for