Page 1 of 1

CAD Import .NET XRefs

Posted: 17 Jul 2006, 21:51
by fchateau
Hi,

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

Regards,

Fred Chateau

Posted: 17 Jul 2006, 21:52
by fchateau
That's supposed to say:

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

Regards,

Fred Chateau

Posted: 19 Jul 2006, 10:54
by support
Yes, CADImport.NET can handle Xrefs

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

Posted: 08 Mar 2007, 06:27
by jdmcd
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?

Posted: 09 Mar 2007, 10:50
by support
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

Re: CAD Import .NET XRefs

Posted: 28 Sep 2023, 17:32
by jcs
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);
}