Discussion:
XREF Overlay or Attach?
(too old to reply)
Kevin Grigsby
2004-01-16 14:52:18 UTC
Permalink
I am trying to figure out a way, via VBA, to determine if an XREF block is
an Overlay or an Attachment?

Thanks,
Kevin Grigsby
Mike Tuersley
2004-01-16 15:54:08 UTC
Permalink
Here you go Kevin, outta the help file:

The IsXRef property works with the IsLayout property. If both properties
are FALSE, then the block is a simple block. If the IsXRef property is
TRUE, then the block is an external reference. If the IsLayout property
is TRUE, then the block contains all the geometry associated with a
layout.

Dim tempBlock As AcadBlock
Dim msg As String
msg = vbCrLf & vbCrLf
ThisDrawing.Application.ZoomAll
For Each tempBlock In ThisDrawing.Blocks
If Not (tempBlock.IsLayout) And Not (tempBlock.IsXRef) Then
' Block is simple
msg = msg & tempBlock.name & ": Simple"
ElseIf tempBlock.IsXRef Then
' Block is an external reference
msg = msg & tempBlock.name & ": External Reference
If tempBlock.IsLayout Then
' Block also contains layout geometry
msg = msg & tempBlock.name & " and Contains Layout Geometry"
End If
ElseIf tempBlock.IsLayout Then
' Block contains layout geometry
msg = msg & tempBlock.name & ": Contains Layout Geometry"
End If
msg = msg & vbCrLf ' Move to next line
Next

___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies
Chuck Gabriel
2004-01-16 17:56:50 UTC
Permalink
I'm not sure you read the question right Mike. I think Kevin wants to know if
there is a way to tell whether an XREF is attached versus overlaid.

The short answer is no (at least not in vanilla VBA). The better answer is that
you can do it with an add-in. Frank Oquendo's vbExtender will allow you to do
it if you can get your hands on it. I'm not sure if it is still available for
download from Frank's site www.AcadX.com. Tony Tanzillo's AcadX
(www.caddzone.com) most likely offers similar functionality.
Post by Mike Tuersley
The IsXRef property works with the IsLayout property. If both properties
are FALSE, then the block is a simple block. If the IsXRef property is
TRUE, then the block is an external reference. If the IsLayout property
is TRUE, then the block contains all the geometry associated with a
layout.
Dim tempBlock As AcadBlock
Dim msg As String
msg = vbCrLf & vbCrLf
ThisDrawing.Application.ZoomAll
For Each tempBlock In ThisDrawing.Blocks
If Not (tempBlock.IsLayout) And Not (tempBlock.IsXRef) Then
' Block is simple
msg = msg & tempBlock.name & ": Simple"
ElseIf tempBlock.IsXRef Then
' Block is an external reference
msg = msg & tempBlock.name & ": External Reference
If tempBlock.IsLayout Then
' Block also contains layout geometry
msg = msg & tempBlock.name & " and Contains Layout Geometry"
End If
ElseIf tempBlock.IsLayout Then
' Block contains layout geometry
msg = msg & tempBlock.name & ": Contains Layout Geometry"
End If
msg = msg & vbCrLf ' Move to next line
Next
___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies
unknown
2004-01-16 18:35:26 UTC
Permalink
If you're not apposed to VLAX, then here's a link to a procedure on our site
that will do it.

http://code.acadx.com/visualbasic/059.htm
--
Bobby C. Jones
www.AcadX.com
Post by Chuck Gabriel
I'm not sure you read the question right Mike. I think Kevin wants to know if
there is a way to tell whether an XREF is attached versus overlaid.
The short answer is no (at least not in vanilla VBA). The better answer is that
you can do it with an add-in. Frank Oquendo's vbExtender will allow you to do
it if you can get your hands on it. I'm not sure if it is still available for
download from Frank's site www.AcadX.com. Tony Tanzillo's AcadX
(www.caddzone.com) most likely offers similar functionality.
Kevin Grigsby
2004-01-16 19:52:36 UTC
Permalink
Bobby,

Thanks, that works for me.

Take it easy,
Kev
Post by unknown
If you're not apposed to VLAX, then here's a link to a procedure on our site
that will do it.
http://code.acadx.com/visualbasic/059.htm
--
Bobby C. Jones
www.AcadX.com
Post by Chuck Gabriel
I'm not sure you read the question right Mike. I think Kevin wants to
know if
Post by Chuck Gabriel
there is a way to tell whether an XREF is attached versus overlaid.
The short answer is no (at least not in vanilla VBA). The better answer
is that
Post by Chuck Gabriel
you can do it with an add-in. Frank Oquendo's vbExtender will allow you
to do
Post by Chuck Gabriel
it if you can get your hands on it. I'm not sure if it is still
available
Post by unknown
for
Post by Chuck Gabriel
download from Frank's site www.AcadX.com. Tony Tanzillo's AcadX
(www.caddzone.com) most likely offers similar functionality.
unknown
2004-01-16 19:58:05 UTC
Permalink
I'm glad that worked out for you Kevin! I'm also glad that you weren't
"apposed", sheesh!, to VLAX :-)
--
Bobby C. Jones
www.AcadX.com
Post by Kevin Grigsby
Bobby,
Thanks, that works for me.
Take it easy,
Kev
Post by unknown
If you're not apposed to VLAX, then here's a link to a procedure on our
site
Post by unknown
that will do it.
http://code.acadx.com/visualbasic/059.htm
--
Bobby C. Jones
www.AcadX.com
Mike Tuersley
2004-01-16 18:34:07 UTC
Permalink
Oops! You're right Chuck, I didn't pay attention.
___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies
Kevin Grigsby
2004-01-16 18:29:54 UTC
Permalink
I know all that stuff Mike. I was looking more specifically to find out if
there is a way to determine of the specific block/xref is an OVERLAY or
ATTACH type.

Kevin
Post by Mike Tuersley
The IsXRef property works with the IsLayout property. If both properties
are FALSE, then the block is a simple block. If the IsXRef property is
TRUE, then the block is an external reference. If the IsLayout property
is TRUE, then the block contains all the geometry associated with a
layout.
Dim tempBlock As AcadBlock
Dim msg As String
msg = vbCrLf & vbCrLf
ThisDrawing.Application.ZoomAll
For Each tempBlock In ThisDrawing.Blocks
If Not (tempBlock.IsLayout) And Not (tempBlock.IsXRef) Then
' Block is simple
msg = msg & tempBlock.name & ": Simple"
ElseIf tempBlock.IsXRef Then
' Block is an external reference
msg = msg & tempBlock.name & ": External Reference
If tempBlock.IsLayout Then
' Block also contains layout geometry
msg = msg & tempBlock.name & " and Contains Layout Geometry"
End If
ElseIf tempBlock.IsLayout Then
' Block contains layout geometry
msg = msg & tempBlock.name & ": Contains Layout Geometry"
End If
msg = msg & vbCrLf ' Move to next line
Next
___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies
Mike Tuersley
2004-01-16 18:54:10 UTC
Permalink
Sorry Kev, I didn't *really* read it:(

Chuck's suggestion of VBExtender is good providing you're using 2002 or
less [I can get you a copy if you want it]. I don't believe it was
updated for 2004.

Only way I know of is to go thru lisp - DXF code 70 for a block. If the
value is:

4 = This block is an external reference (attachment)
8 = This block is an xref overlay

There are other values for 70 as well and the values can be combined.

Mike

___________________________
Mike Tuersley
AutoCAD Clinic
Rand IMAGINiT Technologies
Continue reading on narkive:
Search results for 'XREF Overlay or Attach?' (Questions and Answers)
4
replies
Images or Photographs-in Autocad?
started 2008-02-16 11:26:21 UTC
programming & design
Loading...