Author Topic: Looking for Xref Routine....  (Read 5478 times)

0 Members and 1 Guest are viewing this topic.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Looking for Xref Routine....
« Reply #15 on: June 15, 2005, 12:36:41 PM »
The problem with changing VISRETAIN is that it affects ALL Xrefs you have in the drawing. If you only want to update the layers to match those in one Xref and you have 2 or more, VISRETAIN is NOT what you want. That is what led me to write the VBA macro.

AVCAD, sorry about that. I should have noted that since I don't have R2004+ I couldn't set the reference. Once the VBAIDE opens with the error, select the cancel/end button. Still in the VBAIDE, go to the Tools pulldown menu and select References... In the references dialog you will see an item near the top that says ObjectDBX Type 1.0 library(not found)...uncheck the box next to that; scroll down and find another ObjectDBX  X.X Type Library, where X.X is a higher number than 1.0, and select it. Save and close. That should fix it.

CADaver

  • Guest
Looking for Xref Routine....
« Reply #16 on: June 15, 2005, 01:21:36 PM »
Quote from: Jeff_M
The problem with changing VISRETAIN is that it affects ALL Xrefs you have in the drawing.
ummm... not in R2002.  It only affects those you reload while it is off.


Quote from: Jeff_M
If you only want to update the layers to match those in one Xref and you have 2 or more, VISRETAIN is NOT what you want.
Gee, it works just fine for me, but I was making it even harder than it needed to be:

Code: [Select]
(defun c:fxc ()
(command "undo" "begin")
(setvar "visretain" 0)
(command "-xref" "reload" (cdr (assoc 2 (ENTGET (CAR (ENTSEL "\N Select XREF to Reset Layers  "))))))
(setvar "visretain" 1)
(command "undo" "end")
(princ)
)



Now if you want to pick a bunch to reset try this:

Code: [Select]
(defun c:fxc ( / old setlgth co t2 temp blkname)
(command ".undo" "BEGIN")
   (setvar "cmdecho" 0)
   (setvar "visretain" 0)  
   (prompt "\N Select XREFs to Reset Layers  ")
      (setq
        old (ssget)
        setlgth (sslength old)
        co -1
        t2 "t"
      )
  (while (boundp 't2)
     (progn
       (setq
         co (1+ co)
         temp (entget (ssname old co))
         blkname (cdr (assoc 2 temp))
         t2 (ssname old (1+ co))
       )
(command "-xref" "reload" blkname)
       )      ;; end progn
   )          ;; end while
(setq co (1+ co))
(setvar "visretain" 1)
(princ (strcat "\n  FINISHED...  " (rtos co 2 0) " XREFs Reset to original colors"))
(princ)
(command ".undo" "END")
(princ)
)



Quote from: Jeff_M
That is what led me to write the VBA macro.
Now VBA may work faster, but toggling VISRETAIN is working for me.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Looking for Xref Routine....
« Reply #17 on: June 15, 2005, 01:53:12 PM »
Quote from: CADaver
Quote from: Jeff_M
The problem with changing VISRETAIN is that it affects ALL Xrefs you have in the drawing.
ummm... not in R2002.  It only affects those you reload while it is off.
Quote from: Jeff_M
That is what led me to write the VBA macro.
Now VBA may work faster, but toggling VISRETAIN is working for me.

OK, I'll admit I never tried changing VISRETAIN/unload/reload on individual xrefs. What I originally wanted was a way to update just the linetype or color of the xref layers, not necessarily the entire drawing's display. I guess it was for more of a specific purpose that I have migrated to general use.

CADaver

  • Guest
Looking for Xref Routine....
« Reply #18 on: June 15, 2005, 02:28:17 PM »
Quote from: Jeff_M
What I originally wanted was a way to update just the linetype or color of the xref layers, not necessarily the entire drawing's display.
That's all it does, it only updates the display of the selected XREF, not the entire drawing.  Or am I missing something?

Quote from: Jeff_M
I guess it was for more of a specific purpose that I have migrated to general use.
How much more specific than a selected XREF do you want to get?

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Looking for Xref Routine....
« Reply #19 on: June 15, 2005, 03:13:46 PM »
Quote from: CADaver
That's all it does, it only updates the display of the selected XREF, not the entire drawing.  Or am I missing something?

How much more specific than a selected XREF do you want to get?

The architect changes the linetypes to be used for some features on his plan. I have his drawing Xref'ed into mine with only specific layers thawed & on. To update the new linetypes using VISRETAIN means I must update the entire Xref in my drawing meaning I must go back and freeze/thaw & turn /on/off my specific layers. Using my macro I only update the linetypes.....period.

CADaver

  • Guest
Looking for Xref Routine....
« Reply #20 on: June 15, 2005, 03:48:15 PM »
Quote from: Jeff_M
The architect changes the linetypes to be used for some features on his plan. I have his drawing Xref'ed into mine with only specific layers thawed & on. To update the new linetypes using VISRETAIN means I must update the entire Xref in my drawing meaning I must go back and freeze/thaw & turn /on/off my specific layers. Using my macro I only update the linetypes.....period.
Gee, had I just downloaded your function and run it, I'd have seen that.  That's pretty cool Jeff, the only thing to make that slicker I could see is allowing multiple xref file selections.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Looking for Xref Routine....
« Reply #21 on: June 15, 2005, 04:05:45 PM »
Quote from: CADaver
That's pretty cool Jeff, the only thing to make that slicker I could see is allowing multiple xref file selections.
Thanks! Yeah, this was actually one of my first VBA applications...and I had no clue how to do that. Now that I know how to at least find a clue, maybe I'll go back and see if I can add the multiple files option.

CADaver

  • Guest
Looking for Xref Routine....
« Reply #22 on: June 15, 2005, 05:11:54 PM »
Quote from: Jeff_M
Quote from: CADaver
That's pretty cool Jeff, the only thing to make that slicker I could see is allowing multiple xref file selections.
Thanks! Yeah, this was actually one of my first VBA applications...and I had no clue how to do that. Now that I know how to at least find a clue, maybe I'll go back and see if I can add the multiple files option.
Yeah well, don't break a neck on my account, I gripe if I was hung with a new rope.

AVCAD

  • Guest
Looking for Xref Routine....
« Reply #23 on: June 16, 2005, 10:49:43 AM »
Jeff,

I am in the same boat you are. I first receive a set of Arch files, clean them up and change the colors to specific color that our ctb file uses, thaw, off, and lock layers that we dont need. Then I xref the arch files to a "master xref" for our office.

Right now everytime I get updated drawings I have go through that process over and over again. If I just over wrote the old drawings with the new drawings and used the visretain option on my sheet files all the xref'ed layers would then take the architects colors and layers settings back.

I still havent gotten your program to work...actually I havent tried to fix it yet  :wink:

we will see what happens.

AVCAD

  • Guest
Looking for Xref Routine....
« Reply #24 on: June 16, 2005, 10:56:37 AM »
Quote from: Jeff_M
AVCAD, sorry about that. I should have noted that since I don't have R2004+ I couldn't set the reference. Once the VBAIDE opens with the error, select the cancel/end button. Still in the VBAIDE, go to the Tools pulldown menu and select References... In the references dialog you will see an item near the top that says ObjectDBX Type 1.0 library(not found)...uncheck the box next to that; scroll down and find another ObjectDBX  X.X Type Library, where X.X is a higher number than 1.0, and select it. Save and close. That should fix it.


OK I tried this but the references option is greyed out?  :?

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Looking for Xref Routine....
« Reply #25 on: June 16, 2005, 11:49:00 AM »
Quote from: AVCAD

OK I tried this but the references option is greyed out?
I think that the references is only greyed out if you try to access it while the program is still running. Make sure to End the macro before editing. You may need to load the dvb manually since the lisp routine is supposed to unload it. To do that, before trying to run it type VBAMAN at the command prompt. In the dialog select "Load" and browse to the Xref_sync-2004.dvb file and load it. Now select the "Visual Basic Editor" button. In the VBAIDE you should have a pane on the left with any open projects, make sure that the Xref_sync is the one highlighted then set the references correctly and save.

If this doesn't work, maybe someone else with experience and 2004 can fix it up for you.