My code allows you select as nested as you want, but it will also give you all the entities that it is nested within, so you can just step up until you find the block, and not an xref. I don't have time to help right now though.
If you are good at matrix math, and/or vector math, I think it is possible to translate the insertion point of a nested block, to the current ucs. I'm not that person though. No ObjectDBX needed.
T.Willey:
I am not that good programmer yet, let alone math.
Maybe (if you find the time for it) you can tell me how to step up to get the block..?
@ Lee:
If you try the code in the first post (it's yours, maybe you know it's function without trying) you will see how it works.
A little note: I use the code together with a macro.
In the macro there are 2 variables stated: "dist" and "block".
The code does this, when in a drawing with blocks (not blocks in xref):
command: <test> -->macro says (setq block "abc") & (setq dist 10)
1. Grab a bunch of blocks <enter>
Let's say I have selected 10 blocks with different names.
After the enter, all of those blocks insertion points are calculated.
Then there is put a new block ("abc") put on the insertion block of the selected blocks.
The direction is also the same as the block selected.
The variable distance allows me to offset the insertion points.
Well, all of this is working great, but I allways need to open an xref to apply this code.
Then I need to filter my newly created blocks out of the xref and paste them in my dwg.
So I figured: why not scan the xref for blocks and then do the same trick?
You did once try to help me but we did not find a solution.
Maybe now?
See old link:
http://www.cadtutor.net/forum/showthread.php?t=36963&page=2