Author Topic: Seperating Xrefs from blocks  (Read 10259 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Seperating Xrefs from blocks
« Reply #30 on: August 24, 2006, 05:03:13 PM »
Tim

Tim

I just caught this thread and tried your revised routine.
Works great, I can sure use this one. Thanks.

Gary
Cool! 8-)
Thanks for testing Gary.

Edit: Gary/all the way it's coded, it should work with drawings opened with ObjectDBX.  It will print to the current drawing opened.

So, I can use objectdbx to bind all xrefs within a directory, by using this function within an objectdbx routine?
Kool.

Gary

Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Seperating Xrefs from blocks
« Reply #31 on: August 24, 2006, 05:15:26 PM »
Yup.  You would need to make small changes (to make it work like it should with multiply drawings).
Tim

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

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Seperating Xrefs from blocks
« Reply #32 on: August 25, 2006, 12:53:42 PM »
Aaron,

  This code works on your drawing.  I had some bad order in the way it worked.  I detached the xref, and then tried to get the name, and that won't work, so I had to get the name first.

Let me know it still causes problems.

Code: [Select]
(defun ReloadBindXrefs (Doc / XrefList LstLen TroubleList *error* tmpName)

(defun *error* (msg)
;(vl-bt)
(prompt (strcat "\n Error--> " msg))
)

(vlax-for Blk (vla-get-Blocks Doc)
 (if (= (vla-get-IsXref Blk) :vlax-true)
  (progn
   (if
    (vl-catch-all-error-p
     (vl-catch-all-apply 'vla-Reload (list Blk))
    )
    (if
     (and
      (setq tmpName (vla-get-name Blk))
      (vl-catch-all-error-p
       (vl-catch-all-apply 'vla-Detach (list Blk))
      )
     )
     (setq TroubleList (cons Blk TroubleList))
     (prompt (strcat "\n Detached xref: " tmpName))
    )
    (progn
     (vla-Bind Blk :vlax-true)
     (if
      (and
       (= (vla-get-IsXref Blk) :vlax-true)
       (not (vl-position (vla-get-Name Blk) XrefList))
      )
      (setq XrefList (cons Blk XrefList))
     )
    )
   )
  )
 )
)
(setq LstLen (length XrefList))
(while
 (and
  (> LstLen 0)
  (> LstLen (setq LstLen (length XrefList)))
 )
 (foreach Blk XrefList
  (if
   (or
    (= (vla-get-IsXref Blk) :vlax-false)
    (and
     (vla-Bind Blk :vlax-true)
     (= (vla-get-IsXref Blk) :vlax-true)
    )
   )
   (setq XrefList (vl-remove Blk XrefList))
  )
 )
)
(foreach Blk (append XrefList TroubleList)
 (prompt (strcat "\n Unable to bind xref: " (vla-get-Name Blk)))
)
(princ)
)
Call with (for current drawing)
(ReloadBindXrefs (vla-get-ActiveDocument (vlax-get-Acad-Object)))
Tim

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

Please think about donating if this post helped you.

Hangman

  • Swamp Rat
  • Posts: 566
Re: Seperating Xrefs from blocks
« Reply #33 on: August 25, 2006, 05:53:23 PM »
Hey Tim,
This works superbly.  THANK YOU very much.  I appreciate your help.

btw, I was reading the One Up link from Se7en and found your comment about tidying up an eleven year stint.
I hope it's in your best interest.
And why would you put so much time into helping me when you have more pressing issues at hand ???  Now I owe you a double THANK YOU !!

Best of luck in your endeavors.  And if there's anything I can do for you, let me know, you have my email addr.

And so, ... now we need to work on the images.  :-D
Hangman  8)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Drafting Board, Mechanical Arm, KOH-I-NOOR 0.7mm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Seperating Xrefs from blocks
« Reply #34 on: August 25, 2006, 06:44:18 PM »
Hey Tim,
This works superbly.  THANK YOU very much.  I appreciate your help.
You're welcome.  I seem to be drawn to questions about xrefs.  It's like I must answer.  :-D

btw, I was reading the One Up link from Se7en and found your comment about tidying up an eleven year stint.
I hope it's in your best interest.
This was directed toward Michael.  I haven't been coding that long.  :wink:

Best of luck in your endeavors.  And if there's anything I can do for you, let me know, you have my email addr.
Thanks.

And so, ... now we need to work on the images.  :-D
Did you see I started a thread about them.  I can't seem to figure that one out, and it looks like I'm not the only one.  I have started looking into coding with C# (.Net) and didn't see anything about images that would help, but it was a quick look.  This really bugs me that I/we can't figure it out.
Tim

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

Please think about donating if this post helped you.

Maverick®

  • Seagull
  • Posts: 14778
Re: Seperating Xrefs from blocks
« Reply #35 on: August 26, 2006, 01:09:41 PM »
Tim, Have you been learning reply ettique from Cadaver?   :-D