Author Topic: What would you want in a set of Xref tools?  (Read 24565 times)

0 Members and 1 Guest are viewing this topic.

barc

  • Guest
Re: What would you want in a set of Xref tools?
« Reply #60 on: April 25, 2011, 01:19:49 PM »
I'm in no big hurry for it, and if I get time to wade through the code posted here I just might learn something.  Thanks for the fishin' lesson.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: What would you want in a set of Xref tools?
« Reply #61 on: April 25, 2011, 06:41:19 PM »
Try this.
Code: [Select]
(defun c:PrintXrefInfo ( / GetXrefs XrList Opened Data Path )
   
    (defun GetXrefs (/ tempData tempEnt XrefList)
       
        (while (setq tempData (tblnext "block" (not tempData)))
            (if (equal (logand (cdr (assoc 70 tempData)) 4) 4)
                (progn
                    (setq tempEnt (tblobjname "block" (cdr (assoc 2 tempData))))
                    (setq tempData (entget (cdr (assoc 330 (entget tempEnt)))))
                    (setq XrefList
                        (cons
                            (cons
                                tempEnt
                                (
                                    (lambda ( x / InsList NestList )
                                        (foreach i x
                                            (cond
                                                ((equal (car i) 331)
                                                    (setq InsList (cons (cdr i) InsList))
                                                )
                                                ((equal (car i) 332)
                                                    (setq NestList (cons (cdr i) NestList))
                                                )
                                            )
                                        )
                                        (list InsList NestList)
                                    )
                                    (member '(102 . "{BLKREFS") tempData)
                                )
                            )
                            XrefList
                        )
                    )
                )
            )
        )
        XrefList
    )
    ;-----------------------------------------------------
    (if (setq XrList (GetXrefs))
        (progn
            (setq Opened (open (setq Path (strcat (getvar 'DwgPrefix) (vl-filename-base (getvar 'DwgName)) "_Xref.log")) "w"))
            (foreach i XrList
                (setq Data (entget (car i)))
                (write-line (strcat "Xref name: " (cdr (assoc 2 Data))) Opened)
                (write-line (strcat "\tSaved path: " (cdr (assoc 1 Data))) Opened)
                (write-line (strcat "\tFound at path: " (findfile (cdr (assoc 1 Data)))) Opened)
                (write-line "\tInserted at:" Opened)
                (foreach j (cadr i)
                    (setq Data (entget j))
                    (write-line (strcat "\t\tLayout: " (cdr (assoc 410 Data))) Opened)
                    (write-line (strcat "\t\tInsertion point: " (vl-princ-to-string (cdr (assoc 10 Data)))) Opened)
                    (write-line (strcat "\t\tScale[X Y Z]: " (rtos (cdr (assoc 41 Data))) " " (rtos (cdr (assoc 42 Data))) " " (rtos (cdr (assoc 43 Data)))) Opened)
                    (write-line (strcat "\t\tRotation: " (rtos (cdr (assoc 50 Data)))) Opened)
                    (write-line (strcat "\t\tLayer: " (cdr (assoc 8 Data))) Opened)
                )
                (write-line "\tNested xrefs:" Opened)
                (foreach j (caddr i)
                    (write-line (strcat "\t\t" (cdr (assoc 2 (entget j)))) Opened)
                )
            )
            (close Opened)
            (prompt (strcat "\n Log at: " Path))
        )
        (prompt "\n No xrefs within drawing.")
    )
    (princ)
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: What would you want in a set of Xref tools?
« Reply #62 on: April 25, 2011, 06:53:24 PM »
Try this.
Code: [Select]
  Snipped 
Very interesting tool.  I have no need for it but a very interesting tool none the less. 
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

barc

  • Guest
Re: What would you want in a set of Xref tools?
« Reply #63 on: April 27, 2011, 12:33:04 PM »
Thanks Tim, cool tool.  That's very close to what I need.  I'm going to look at it tonight to see if I can "tweak" the output a bit.

Really appreciate the help, this will make the next lunacy from the front office a lot easier to accomplish.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: What would you want in a set of Xref tools?
« Reply #64 on: April 27, 2011, 01:09:07 PM »
I completely forgot to post this, but I put together a quick cursor list prompt (using DosLib) the other day...

Code: [Select]
(defun c:XRT (/ choice lst)
  (if (setq choice (dos_popupmenu
                     (setq lst
                            '("testxs - for xref states"
                              "testcoxl - for copy original xref layers properties ( color and linetype )"
                              "testcn - for copy nested entity, or nested layer"
                              "testxopen - for open xref, zoomed to same location"
                              "testexrs - for erase xref annotation scales not referenced"
                              "testrlo - for remove layer overrides ( color, linetype and lineweight )"
                              "testxrlc - for change all selected xref layer colors"
                              "EditLayerFromSelection - change properties of layers based on entity selected"
                             )
                     )
                   )
      )
    (command (strcat "_." (substr (setq choice (nth choice lst)) 1 (vl-string-search " - " choice)))
    )
  )
  (princ)
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

T.Willey

  • Needs a day job
  • Posts: 5251
Re: What would you want in a set of Xref tools?
« Reply #65 on: April 27, 2011, 03:03:47 PM »
Thanks Tim, cool tool.  That's very close to what I need.  I'm going to look at it tonight to see if I can "tweak" the output a bit.

Really appreciate the help, this will make the next lunacy from the front office a lot easier to accomplish.

Good to hear.

Alan - Does that execute the command for you?  It seems like it, but I don't think I have doslib installed, and don't know if I should if the company didn't.  If so, nice tool.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: What would you want in a set of Xref tools?
« Reply #66 on: April 27, 2011, 03:08:13 PM »
Thanks Tim, cool tool.  That's very close to what I need.  I'm going to look at it tonight to see if I can "tweak" the output a bit.

Really appreciate the help, this will make the next lunacy from the front office a lot easier to accomplish.

Good to hear.

Alan - Does that execute the command for you?  It seems like it, but I don't think I have doslib installed, and don't know if I should if the company didn't.  If so, nice tool.
Yeah, it's a simple loading list. DosLib has some really useful tools, especially some for quick coding and since it's just an arx that can be easily loaded from the acaddoc.lsp, I don't see a problem using it and/or putting it on the network and having everyone load it.

It's a simple thing, but I found it useful with running your commands in a beta state.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

T.Willey

  • Needs a day job
  • Posts: 5251
Re: What would you want in a set of Xref tools?
« Reply #67 on: April 27, 2011, 03:15:31 PM »
Cool idea.  Maybe I'll see about it then.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: What would you want in a set of Xref tools?
« Reply #68 on: April 27, 2011, 03:18:30 PM »
Cool idea.  Maybe I'll see about it then.
:-)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

hudster

  • Gator
  • Posts: 2848
Re: What would you want in a set of Xref tools?
« Reply #69 on: May 04, 2011, 12:18:57 PM »
I'd like the ability to change all lines so that I can change their layer, but they retain their original layer linetype.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

T.Willey

  • Needs a day job
  • Posts: 5251
Re: What would you want in a set of Xref tools?
« Reply #70 on: May 04, 2011, 01:04:36 PM »
I'd like the ability to change all lines so that I can change their layer, but they retain their original layer linetype.

To have this done, one would have to setup a reactor base application, as the items would need to be changed after each time the xref is reloaded.  What purpose would this serve?  Is this something so you wouldn't have to change the original xref file?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

hudster

  • Gator
  • Posts: 2848
Re: What would you want in a set of Xref tools?
« Reply #71 on: May 05, 2011, 04:12:29 AM »
I work for a building services consultancy, we typically clean xrefs removing the crud we don't need, then we move the remaining info to our standard xref layers, so for exapmle we are producing a ceiling layout, we can freeze the furniture and sanitary ware off, to make the drawing cleaner.

But mostly when we clean up the drawings, things with hidden or centre linetypes become solid and can be misinterpreted as walls.
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

Rabbit

  • Guest
Re: What would you want in a set of Xref tools?
« Reply #72 on: May 05, 2011, 10:57:09 AM »
I completely forgot to post this, but I put together a quick cursor list prompt (using DosLib) the other day...

Here's my version of this.  It doesn't require DosLib:
Code: [Select]
;;;Written by Jamie Myers
;;;Loose extrapilation from Tony Tanzillo's XGETSTRING sub-routine
(defun xgetkword (msg StringInput / s)
   (setq s
  (getkword
    (strcat "\n" msg
    (cond (StringInput (strcat " <" StringInput ">: "))
  (t ": ")))))
   (cond ((eq s nil) StringInput) (t s))
)

;;;------------------------------------------------------------------------------------------------
(setq choice "testxs")
(initget "testxs testcoxl testcn testxopen testexrs testrlo testxrlc EditLayerFromSelection")
(setq choice (xgetkword "[testxs/testcoxl/testcn/testxopen/testexrs/testrlo/testxrlc/EditLayerFromSelection] " choice))

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: What would you want in a set of Xref tools?
« Reply #73 on: May 05, 2011, 10:10:22 PM »
I completely forgot to post this, but I put together a quick cursor list prompt (using DosLib) the other day...

Here's my version of this.  It doesn't require DosLib:
Code: [Select]
;;;Written by Jamie Myers
;;;Loose extrapilation from Tony Tanzillo's XGETSTRING sub-routine
(defun xgetkword (msg StringInput / s)
   (setq s
  (getkword
    (strcat "\n" msg
    (cond (StringInput (strcat " <" StringInput ">: "))
  (t ": ")))))
   (cond ((eq s nil) StringInput) (t s))
)

;;;------------------------------------------------------------------------------------------------
(setq choice "testxs")
(initget "testxs testcoxl testcn testxopen testexrs testrlo testxrlc EditLayerFromSelection")
(setq choice (xgetkword "[testxs/testcoxl/testcn/testxopen/testexrs/testrlo/testxrlc/EditLayerFromSelection] " choice))
Seems like a bit of extra typing just to avoid loading a very useful addon like DosLib.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: What would you want in a set of Xref tools?
« Reply #74 on: May 06, 2011, 08:11:04 AM »
modify to suit (add/change properties, export result to file ...)

Quote
                                    ...Values greater than 1 suggest you may
    ;;      have a CADD Bozo who inadvertantly copied an XREF during
    ;;      a copy sequence, whereas a instance count of 0 suggests
    ;;      said quack deleted the xref during an erase sequence.

 :-D