attachxref bug?

attachxref bug?

Anonymous
Not applicable
319 Views
2 Replies
Message 1 of 3

attachxref bug?

Anonymous
Not applicable
I'm using AutoCAD 2006, and have written a routine to copy an xref from one drawing to another maintaining layer properties.

There seems to be a glitch in the attachexternalreference method, whereby the angle isn't being set correctly. The code I have is:

Set NewXref = DestinationDrawing.ModelSpace.AttachExternalReference(SourceXref.Path, SourceXref.Name, SourceXref.InsertionPoint, SourceXref.XScaleFactor, SourceXref.YScaleFactor, SourceXref.ZScaleFactor, SourceXref.Rotation, True)

This basically overlays a newxref object using the parameters of the original (source) xref object. The problem is that when either or both drawings have a UCS set, the destination xref doesn't inherit the WCS insertion point and rotation of the source xref.

If I follow this attach line with the following, then the new xref is repositioned correctly, despite apparently doing the same thing as the attach line:

NewXref.InsertionPoint = SourceXref.InsertionPoint
NewXref.Rotation = SourceXref.Rotation

Does anyone know why this is the case? The help file states that insertion point is a 3D WCS point, and that rotation is an angle relative to the objects WCS X axis. Insertion point sounds self explanatory and should just work, although I'm not sure what 'objects WCS' implies.
0 Likes
320 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Yeah, it look like a bug to me. The method does not act the same as the
InsertBlock method, and the documentation explicitly mentions the
InsertionPoint is in WCS. Also, resetting the two properties does correct
the new XRef, as you mentioned.

However, I've only noted the issue occuring when a UCS is active in the
target drawing. A UCS in the source drawing is immaterial.

--
R. Robert Bell


wrote in message news:5228473@discussion.autodesk.com...
I'm using AutoCAD 2006, and have written a routine to copy an xref from one
drawing to another maintaining layer properties.

There seems to be a glitch in the attachexternalreference method, whereby
the angle isn't being set correctly. The code I have is:

Set NewXref =
DestinationDrawing.ModelSpace.AttachExternalReference(SourceXref.Path,
SourceXref.Name, SourceXref.InsertionPoint, SourceXref.XScaleFactor,
SourceXref.YScaleFactor, SourceXref.ZScaleFactor, SourceXref.Rotation, True)

This basically overlays a newxref object using the parameters of the
original (source) xref object. The problem is that when either or both
drawings have a UCS set, the destination xref doesn't inherit the WCS
insertion point and rotation of the source xref.

If I follow this attach line with the following, then the new xref is
repositioned correctly, despite apparently doing the same thing as the
attach line:

NewXref.InsertionPoint = SourceXref.InsertionPoint
NewXref.Rotation = SourceXref.Rotation

Does anyone know why this is the case? The help file states that insertion
point is a 3D WCS point, and that rotation is an angle relative to the
objects WCS X axis. Insertion point sounds self explanatory and should just
work, although I'm not sure what 'objects WCS' implies.
0 Likes
Message 3 of 3

Anonymous
Not applicable
Thanks for the feedback, it's reasurring to know I haven't missed something.

I guess I struck lucky that the drawings I tested with were the sort where we'd have a UCS!
0 Likes