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

0 Members and 1 Guest are viewing this topic.

AVCAD

  • Guest
Looking for Xref Routine....
« on: June 13, 2005, 12:06:54 PM »
Is there are routine out there that will do the following:

Detattch an xref in a drawing
Save the where and what rotation it was at
reinsert the xref
and restore th placement of that xref

And if so, Can it do multiple Xrefs in 1 drawing...basically all xrefs.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Looking for Xref Routine....
« Reply #1 on: June 13, 2005, 12:16:26 PM »
If you are wanting to reset the layers to match that of the Xref drawing, I do have a VBA macro to do that. That is essentially all yoy are doing with the re-inserting of them.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Looking for Xref Routine....
« Reply #2 on: June 13, 2005, 12:28:25 PM »
Unless I'm missing something, isn't that just reloading the xref?

daron

  • Guest
Looking for Xref Routine....
« Reply #3 on: June 13, 2005, 12:33:38 PM »
Yes, but I can't give mine out.

Check your dxf values and set variables for them
(entget (car (entsel)))
Insertion point 10
Rotation angle 50? I forget.
Of course, Dommy's comment should be the same thing, unless you need these for a greater purpose than you've let on here.

CADaver

  • Guest
Looking for Xref Routine....
« Reply #4 on: June 13, 2005, 12:42:10 PM »
I'm with Dommy on this one.  Why not just unload the files, then reload when you want 'em back.  All the layer controls remain set.

Some quickies:
Code: [Select]

(DEFUN C:xru ()
(command "-xref" "unload" (cdr (assoc 2 (ENTGET (CAR (ENTSEL "\N Select Element in XREF to UNLOAD  "))))))
)  
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:xrd ()
(command "-xref" "detach" (cdr (assoc 2 (ENTGET (CAR (ENTSEL "\N Select Element in XREF to DETACH  "))))))
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(DEFUN C:xre ()
(command "-xref" "reload" (cdr (assoc 2 (ENTGET (CAR (ENTSEL "\N Select Element in XREF to RELOAD  "))))))
)

AVCAD

  • Guest
Looking for Xref Routine....
« Reply #5 on: June 14, 2005, 02:29:57 PM »
Just unloading the Xrefs wont change all the colors, or the Layer state according to t he master xref file.

Jeff may have what I am looking for. He was correct when saying all I want is to change the layer states of the master xref file.

If unloading a drawing that is xrefed already wont shut off the (lets jsut say) Doors layer if I had shut it off in the master xref file. IT will still keep the layer states that are current in that file.

Does that make any sense I think I lost my self.....

I would like to try out the VBA macro that Jeff uses. EMail it to me me or post it here please.

CADaver

  • Guest
Looking for Xref Routine....
« Reply #6 on: June 14, 2005, 02:32:44 PM »
Ahh VISRETAIN.

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Looking for Xref Routine....
« Reply #7 on: June 14, 2005, 03:20:55 PM »
Avcad,
I posted a zip file in The Lilly Pond with my routines. The lisp file will call the correct dvb file depending on the version of Acad you are using (or it is supposed to anyway). To use, make sure all 3 files are in the support search path, just load the lisp and type XREF_SYNC to run it.

Jeff

AVCAD

  • Guest
Looking for Xref Routine....
« Reply #8 on: June 14, 2005, 05:32:36 PM »
I am using ACAD Version 2004

I am getting an error and it is opening Visual Basic to fix it but I have no clue what to fix...

any help would be nice

Thanks!

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Looking for Xref Routine....
« Reply #9 on: June 14, 2005, 06:35:43 PM »
What is the error?
What line is highlighted in the VBAIDE?

CADaver

  • Guest
Looking for Xref Routine....
« Reply #10 on: June 14, 2005, 08:21:44 PM »
Quote from: AVCAD
I am getting an error
You didn't like VISRETAIN?

Code: [Select]

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

CADaver

  • Guest
Looking for Xref Routine....
« Reply #11 on: June 14, 2005, 08:31:50 PM »
Code: [Select]

(defun c:fixallxrefcolors ()
(command "undo" "begin")
(command "-xref" "unload" "*")
(setvar "visretain" 0)
(command "-xref" "reload" "*")
(setvar "visretain" 1)
(command "undo" "end")
(princ)
)

AVCAD

  • Guest
Looking for Xref Routine....
« Reply #12 on: June 15, 2005, 09:50:00 AM »
when I run the xref_sync command this is the line that is  highlighted...


Dim dbxDoc As AxDbDocument


???? I have no clue what that means.. :?

AVCAD

  • Guest
Looking for Xref Routine....
« Reply #13 on: June 15, 2005, 09:54:14 AM »
I will have to play with that CAD. I never really played with the visretain options.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Looking for Xref Routine....
« Reply #14 on: June 15, 2005, 09:56:17 AM »
It's an ObjectDBX document. You'll need to add a reference to the AutoCAD/ObjectDBX Common Type library thru "Tools -> References" from the VBA editor.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst