Author Topic: xref layer problem  (Read 4425 times)

0 Members and 1 Guest are viewing this topic.

CADaver

  • Guest
xref layer problem
« Reply #15 on: May 06, 2005, 10:36:38 AM »
because we regularly rename reference files, and we sometimes have the file referenced with different names, it seems that your method 2 would be my choice.  it's only drawback is detaching a file loses it's info and that is more than acceptable performance for our uses.

but before your run off and write a whole program, could you maybe break it up in manageable pieces and step through so that I (we) can learn a little something along the way?  i understand that may be more time consuming on your end, and if so nevermind, it was just a thought.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
xref layer problem
« Reply #16 on: May 06, 2005, 11:05:29 AM »
Thanks for the input Randy.

I'll write it the way I attempt to write the majority of my apps that are not quick one offs --

• Identify and code all the functions required to solved the problem; each function does exactly one thing and no more.
• Name functions and variables so they are self documenting.
• Call defined functionality so that problem is solved; this is usually via a function named 'main'.
• Add comments as required so that others might understand the overall process.*

Hope that will suffice.

* I don't comment things like "This is a loop ...". IMO those kind of comments serve only to litter up source code and actually drive me nuts.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CADaver

  • Guest
xref layer problem
« Reply #17 on: May 06, 2005, 01:08:36 PM »
Quote from: MP
Thanks for the input Randy.

Hope that will suffice.
whatever you do, it will be considerably more than i have now, thanks for the effort.

t-bear

  • Guest
xref layer problem
« Reply #18 on: May 06, 2005, 10:26:49 PM »
I've been using this for a while now.  When you have new layers that you want to freeze, run this routine, select a vport with the "bad" layers,then pick the objects on that layer....bingo! frozen in all vports.  Not *totally* automatic, but close.......
Code: [Select]
;Will freeze selected layers in ALL vports, you pick 'em, they're chilled!
;Thanks to the "gurus" at CADalog forums for this routine...3/7/03
;Keith, Trev, Hendie & Paul
;
;
(defun c:vplfrz   ()
  (setvar "TileMode" 0) ;  Force PaperSpace
  (setq vpFlag (getvar "cvport"))
  (if (= vpFlag 1)
    (progn
      (setq sel-vpt 1)
      (setq sel-vport (car (entsel "\nSelect view port: ")))
      (if (= sel-vport nil)
   (progn
     (alert "You must select a viewport\nTry again!")
     (c:vplfrz)
   )
   (progn
     (setq entvport (entget sel-vport))
     (if (= (cdr (assoc 0 entvport)) "VIEWPORT")
       (frz-vplayer)
       (progn
         (alert "You must select a viewport\nTry again!")
         (c:vplfrz)
       )
     )
   )
      )
    ); else Viewport is already selected
    (frz-vplayer)
  ) ;endif (= vpFlag 1)
)

(defun frz-vplayer ()
  (setq   e2    (entget sel-vport)
   viewport (cdr (assoc 69 e2))
  )
  (command "mspace")
  (setvar "cvport" viewport)
  (setq loop "")
  (while loop
    (setq
      pik (nentsel "\nSelect an item on XREF to Freeze: ESC to Exit:")
    )

    (cond
      ((/= pik nil)
       (setq lay (assoc 8 (entget (car pik))))
       (setq str (cdr lay))
       (command "vplayer" "f" str "All" "") ; Freeze in ALL viewports
      )
      ((= pik nil)
       (alert "Nothing Selected!\nTry Again!")
       (frz-vplayer)
      )
    )
  ) ; End while
  (command "pspace")
  (princ)
)

(prompt "\nType VPLFRZ to run")
(prin1)

Don't know how helpful it'll be, but maybe it can be "tweaked" to do what it doesn't, if it doesn't do what you want/need.......

hudster

  • Gator
  • Posts: 2848
xref layer problem
« Reply #19 on: May 08, 2005, 07:02:22 AM »
If the layer names you need aren't going to change you could easily write a script to do this for you.

Just assign it to a macro button and away you go.

Code: [Select]
-layer;freeze;*;;
-layer;thaw;layer1;
thaw;layer2;
thaw;layer3;
etc etc
Revit BDS 2017, 2016, 2015, 2014, AutoCAD 2017, 2016, Navisworks 2017, 2016, BIM360 Glue

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
xref layer problem
« Reply #20 on: May 09, 2005, 12:37:46 AM »
Status update: Managed to write 3/4 of the functions tonight. Gonna call it quits early with a melatonin or two in attempt to get a good sleep tonight. Should have a finished program per "method 2" tomorrow or tuesday. Over and out.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst