CAD Import .NET XRefs

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
fchateau
Posts: 7
Joined: 28 Dec 2005, 00:22
Location: USA
Contact:

CAD Import .NET XRefs

Post by fchateau » 17 Jul 2006, 21:51

Hi,

Did you even get CAD Import .NET to handle Xrefs?

Regards,

Fred Chateau

fchateau
Posts: 7
Joined: 28 Dec 2005, 00:22
Location: USA
Contact:

Post by fchateau » 17 Jul 2006, 21:52

That's supposed to say:

Did you "ever" get CAD Import .NET to handle Xrefs?

Regards,

Fred Chateau

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 19 Jul 2006, 10:54

Yes, CADImport.NET can handle Xrefs

please post questions to the forum or write to support@cadsofttools.com

jdmcd
Posts: 2
Joined: 08 Mar 2007, 06:18
Contact:

Post by jdmcd » 08 Mar 2007, 06:27

Can you show us simple code to access the XRef count and XRef paths from a DWG drawing file. I can't seem to make out how to do that from your documentation. I have been able to open the file as both a CADImage and a DWGImage. How do I extract XRef info from these objects?

support
Posts: 3271
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 09 Mar 2007, 10:50

Hello!

Please try the following code:

Code: Select all

<font color="blue">private void</font id="blue"> btnGetXRefs_Click(<font color="blue">object</font id="blue"> sender, System.EventArgs e)
{
	<font color="blue">if</font id="blue">(<font color="blue">this</font id="blue">.FCADImage == <font color="blue">null</font id="blue">) <font color="blue">return</font id="blue">;
	<font color="blue">if</font id="blue">(<font color="blue">this</font id="blue">.FCADImage.Converter.XRefs == <font color="blue">null</font id="blue">) <font color="blue">return</font id="blue">;
	<font color="blue">int</font id="blue"> cn = <font color="blue">this</font id="blue">.FCADImage.Converter.XRefs.Count;
	MessageBox.Show(<font color="blue">string</font id="blue">.Format("Count XRefs - {0}", cn));
	CADXRef rf;
	<font color="blue">for</font id="blue">(<font color="blue">int</font id="blue"> i = 0; i < cn; i++)
	{
		rf = (CADXRef)<font color="blue">this</font id="blue">.FCADImage.Converter.XRefs[i];
		MessageBox.Show(<font color="blue">string</font id="blue">.Format("XRefs[{0}] path - {1}", i, rf.Path));
	}
}
Sergey.

Please post questions to the forum or write to support@cadsofttools.com

jcs
Posts: 2
Joined: 28 Sep 2023, 13:57

Re: CAD Import .NET XRefs

Post by jcs » 28 Sep 2023, 17:32

Hello,
If it can be useful to someone: The code in c#

Code: Select all

using CADImport;
...

string path = "c:\\Users\\User\\exampleWithXrefs.dwg";
CADImport.DWG.DWGImage vCADFile = new CADImport.DWG.DWGImage();
vCADFile.LoadFromFile(p.rutaLocal);

CADEntityCollection xrefs = vCADFile.Converter.XRefs;
foreach (CADXRef rf in xrefs)
{
    System.Diagnostics.Debug.WriteLine(" ***" + rf.Path);
}

Post Reply