.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Xref Status

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
696 Views, 8 Replies

Xref Status

Hi all,

Is there any way that I can find out the Xref Status in VB.NET? I am using ObjectDBX.
Please help.
Thanks
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

Look into the XrefGraph. I used it in a current drawing, but I would think
that you could use it with ObjectDBX.

--

Tim
"A blind man lets nothing block his vision."


wrote in message news:5301760@discussion.autodesk.com...
Hi all,

Is there any way that I can find out the Xref Status in VB.NET? I am using
ObjectDBX.
Please help.
Thanks
Message 3 of 9
Anonymous
in reply to: Anonymous

Thanks Willey!

But I didn't find any example on XrefGraph. Please can you help me?

Thanks
Message 4 of 9
Anonymous
in reply to: Anonymous

Here is one I wrote with the help of Glenn R. over at theswamp.org

using System;

using Autodesk.AutoCAD.ApplicationServices;

using Autodesk.AutoCAD.Runtime;

using Autodesk.AutoCAD.DatabaseServices;

using Autodesk.AutoCAD.EditorInput;

using acadApp = Autodesk.AutoCAD.ApplicationServices.Application;

[assembly: CommandClass (typeof(Test.Xref))]

namespace Test

{

///

/// Description of Xref.

///


public class Xref

{

[CommandMethod("XrGraphTest")]

static public void GraphTest()

{

Document ActDoc = acadApp.DocumentManager.MdiActiveDocument;

Database DocDb = ActDoc.Database;

Editor DocEd = ActDoc.Editor;

using (Transaction DocDbTrans = DocDb.TransactionManager.StartTransaction())

{

BlockTable DocDbBlkTbl =
(BlockTable)DocDbTrans.GetObject(DocDb.BlockTableId, OpenMode.ForRead);

XrefGraph DocDbXrGraph = DocDb.GetHostDwgXrefGraph(false);

for (int i = 0; i
{

XrefGraphNode XrGraphNode = DocDbXrGraph.GetXrefNode(i);

if (DocDbXrGraph.HostDrawing.Name == XrGraphNode.Name)

{

DocEd.WriteMessage("Drawing Name: {0}, In: {1}, Out: {2}", XrGraphNode.Name,
XrGraphNode.NumIn, XrGraphNode.NumOut);

}

else

{

DocEd.WriteMessage("Name: {0}, In: {1}, Out: {2}", XrGraphNode.Name,
XrGraphNode.NumIn, XrGraphNode.NumOut);

}

if (XrGraphNode.NumOut > 0)

{

OutNodePrint1(XrGraphNode);

}

}

}

}

static public void OutNodePrint1(XrefGraphNode XrGraphNode)

{

Document ActDoc = acadApp.DocumentManager.MdiActiveDocument;

Editor DocEd = ActDoc.Editor;

for (int i = 0; i < XrGraphNode.NumOut; ++i)

{

XrefGraphNode tmpNode = XrGraphNode.Out(i) as XrefGraphNode;

if (tmpNode != null)

{

DocEd.WriteMessage(" {0}", tmpNode.Name);

}

else

{

DocEd.WriteMessage(" Not found as an "XrefGraphNode"!");

}

}

}

}

}


--

Tim
"A blind man lets nothing block his vision."


wrote in message news:5303614@discussion.autodesk.com...
Thanks Willey!

But I didn't find any example on XrefGraph. Please can you help me?

Thanks
Message 5 of 9
Anonymous
in reply to: Anonymous

I'm so sorry Willey, I am working in VB.Net. Hence the code didn't help me. But I tried converting it to VB, but in vein. Please help.
Message 6 of 9
Anonymous
in reply to: Anonymous

Please can anybody give me an example of XrefGraphNode as I think that may help in what I am trying to do.
I have done the code to retrieve the xrefs and the XrefStatus. But if I want to change the path of a nested xref, it is not possible. What should I do?
Please help!
Message 7 of 9
Anonymous
in reply to: Anonymous

This is my code:

Dim db As Autodesk.AutoCAD.DatabaseServices.Database
acadApp.DocumentManager.Open("C:\AR- 02- 202.dwg", False, Nothing)
db = New Database(False, False)
db.ReadDwgFile("C:\AR- 02- 202.dwg", IO.FileShare.ReadWrite, False, Nothing)

Dim tm As DBTransMan = db.TransactionManager
Dim ta As Transaction = tm.StartTransaction()
Dim bt As Autodesk.AutoCAD.DatabaseServices.BlockTable
Dim btr As BlockTableRecord
Dim blockId As ObjectId
Dim iter As IEnumerator

bt = ta.GetObject(db.BlockTableId, OpenMode.ForRead)
iter = bt.GetEnumerator()

Do While iter.MoveNext()
blockId = iter.Current
btr = ta.GetObject(blockId, OpenMode.ForWrite)
If btr.IsFromExternalReference Then
If btr.IsUnloaded = True Then
btr.PathName = "C:\$Blank.dwg"
btr.IsUnloaded = False
End If
End If
Loop
ta.Commit()
ta.Dispose()

db.SaveAs("C:\newtest.dwg", DwgVersion.Current)db.Dispose()

Please help as there is no documentation on this issue.
Thanks
Message 8 of 9
Anonymous
in reply to: Anonymous

I'm just starting in C#, and know nothing about VB. I come from a lisp
background. As per your other question, I don't think you can change the
path of a nested xref. The only way to do it, is to open up the top most
xref and change the xref in that drawing.

--

Tim
"A blind man lets nothing block his vision."


wrote in message news:5310461@discussion.autodesk.com...
I'm so sorry Willey, I am working in VB.Net. Hence the code didn't help me.
But I tried converting it to VB, but in vein. Please help.
Message 9 of 9
Anonymous
in reply to: Anonymous

But we can repath nested xref in VBA. So it can also be done in VB.Net, I think.

Thanks

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost