TheSwamp

Code Red => .NET => Topic started by: cadpro on November 04, 2008, 03:49:21 AM

Title: Xref overlay without detach
Post by: cadpro on November 04, 2008, 03:49:21 AM
Hi,

Can xref be overlayed without detaching it?

Thanks
Title: Re: Xref overlay without detach
Post by: Kerry on November 04, 2008, 04:10:52 AM

If you detach it, the xref cant be overlayed or attached .. cause it is detached and not linked(referenced) into the drawing.
Title: Re: Xref overlay without detach
Post by: Kerry on November 04, 2008, 04:23:44 AM
.. and i see that you've posted the same question on autodesk.autocad.customization.dotnet.
will be interesting to see if you get a different answer.


ps;
I haven't checked, but it seems that almost every question you've asked for the last couple of years has been about xrefs ... you should be an expert at them shortly :D
Title: Re: Xref overlay without detach
Post by: Glenn R on November 04, 2008, 06:03:14 AM
 :lmao:
Title: Re: Xref overlay without detach
Post by: cadpro on November 04, 2008, 07:47:12 AM
ps;
I haven't checked, but it seems that almost every question you've asked for the last couple of years has been about xrefs ... you should be an expert at them shortly

I wish I could be!   :wink:
Title: Re: Xref overlay without detach
Post by: cadpro on November 04, 2008, 07:50:34 AM

If you detach it, the xref cant be overlayed or attached .. cause it is detached and not linked(referenced) into the drawing.


All sample codes that I saw throughout the threads do a detach of the same xref before changing it to overlay. But, this doesn't work if the block is xrefed in multiple layouts.

Is there a way to access the xrefmanager to change the xref to overlay?
Title: Re: Xref overlay without detach
Post by: jmaeding on November 04, 2008, 11:05:55 AM
I'd like to know too, it seems like it would be such an easy thing to put in the API.
I would use that in about three different tools I can think of.
Title: Re: Xref overlay without detach
Post by: jmaeding on November 04, 2008, 11:10:42 AM
wait, this is a duplicate thread, let's keep to the other one with all the code.
Title: Re: Xref overlay without detach
Post by: T.Willey on November 04, 2008, 11:16:32 AM
You can try the lisp code here [ http://www.theswamp.org/index.php?topic=25232.0 ].  If it works for you, then you should be able to change it to .Net for your purpose, but it does detach and reattach the xref as the type you want.
Title: Re: Xref overlay without detach
Post by: Bryco on November 04, 2008, 12:54:03 PM
At a guess, when you change an xref (w/ multiple inserts) from insert to overlay they all change at the same time. So remove all xrefs with that name and reinsert them.  Oh I guess you already tried that and it didn't work, silly me.
Title: Re: Xref overlay without detach
Post by: cadpro on November 05, 2008, 12:08:30 AM
So remove all xrefs with that name and reinsert them.

That is the issue!  :ugly:
Title: Re: Xref overlay without detach
Post by: cadpro on November 05, 2008, 12:20:05 AM
You can try the lisp code here [ http://www.theswamp.org/index.php?topic=25232.0 ].  If it works for you, then you should be able to change it to .Net for your purpose, but it does detach and reattach the xref as the type you want.

That didn't work.
Title: Re: Xref overlay without detach
Post by: T.Willey on November 05, 2008, 06:47:48 PM
You can try the lisp code here [ http://www.theswamp.org/index.php?topic=25232.0 ].  If it works for you, then you should be able to change it to .Net for your purpose, but it does detach and reattach the xref as the type you want.

That didn't work.
Are you working with nested xrefs?  If so, then it wasn't tested for that since I don't use them.  If not, then maybe you can post the drawing file and xrefs, so that I can test.
Title: Re: Xref overlay without detach
Post by: cadpro on November 11, 2008, 03:19:07 AM
No nested xrefs. Only title blocks.
Title: Re: Xref overlay without detach
Post by: jjs on November 14, 2008, 01:55:51 PM
Why can't you record all the insertion information, then detach and reattach?
You could save a layerstate before and reapply it afterward.
Insertion points and scale factors should not be hard.
Title: Re: Xref overlay without detach
Post by: KewlToyZ on November 14, 2008, 03:41:52 PM
I got this routine from here, couldnt remember the post it was from.
x2a turns them all to attachments x2o changes them all to overlays
Title: Re: Xref overlay without detach
Post by: jmaeding on November 19, 2008, 04:26:12 PM
detaching is very undesirable, as I have tried that approach of recording the original data, and resetting afterwards.
Its ok on simple stuff, but anything complicated like nested items, or multiple viewports makes it really involved to do.  It would be far, far, better to be able to change the attach flag via the API.
Title: Re: Xref overlay without detach
Post by: Bob Wahr on November 19, 2008, 04:51:05 PM
I agree that it would be swell to be able to change an xref from an attachment to an overlay, but AutoCAD doesn't give that ability at this point in time.
Title: Re: Xref overlay without detach
Post by: jjs on November 19, 2008, 05:31:15 PM
what about with dotted pairs in lisp? You used to be able to look at the dotted pairs and change those directly. Someone on vbdesign even came up with a vba routine that changed the dotted pairs.
Title: Re: Xref overlay without detach
Post by: jjs on November 19, 2008, 05:34:53 PM
http://www.autodesk.com/techpubs/autocad/dxf/dxf2002.pdf
70 - 8 seems to be overlay.
Code: [Select]
Block group codes (continued)

100 Subclass marker (AcDbEntity)
8 Layer name
100 Subclass marker (AcDbBlockBegin)
2 Block name
70 Block-type flags (bit coded values, may be combined):
0 = Indicates none of the following flags apply
1 = This is an anonymous block generated by hatching, associative
dimensioning, other internal operations, or an application
2 = This block has non-constant attribute definitions (this bit is not set if
the block has any attribute definitions that are constant, or has no
attribute definitions at all)
4 = This block is an external reference (xref)
8 = This block is an xref overlay
16 = This block is externally dependent
32 = This is a resolved external reference, or dependent of an external
reference (ignored on input)
64 = This definition

Title: Re: Xref overlay without detach
Post by: jjs on November 19, 2008, 05:47:14 PM
TWO DXF FILES, ONLY DIFFERENCE WAS XREF TYPE.

OVERLAY
Code: [Select]
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
0800200GTB
 70
    44

 10
0.0
 20
0.0
 30
0.0
  3
0800200GTB
  1
..\arch\0800200GTB.dwg
  0
ENDBLK

ATTACH
Code: [Select]
AcDbEntity
  8
0
100
AcDbBlockBegin
  2
0800200GTB
 70

    36
 10
0.0
 20
0.0
 30
0.0
  3
0800200GTB
  1
..\arch\0800200GTB.dwg
  0
ENDBLK
Title: Re: Xref overlay without detach
Post by: jjs on November 19, 2008, 05:49:41 PM
if you change the 36 to 44 or vice versa and open the dxf, the attachement type changes accordingly.
Title: Re: Xref overlay without detach
Post by: Bob Wahr on November 19, 2008, 06:17:56 PM
Wasn't it SCMDave who was doing that.