資源簡介
DWGdirect_NET_3_02,由于公司需求,最近也是找了好久才終于找到C#.NET讀取DWG格式的CAD文件信息方法,采用 DWGdirect_NET_3_02動態(tài)庫里的方法,可以完美的讀到DWG文件的信息,這里分享出來,壓縮文件包括了DEMO和動態(tài)庫文件,DEMO可以完美運行(VS2010測試通過,添加的自測的部分注釋!)
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.IO;
using?DWGdirect.DatabaseServices;
using?DWGdirect.Geometry;
using?DWGdirect.GraphicsInterface;
using?DWGdirect.Colors;
using?DWGdirect;
//?note?that?Getobject?doesn‘t?work?in?Acad?2009?so?we?use?“obsolete“?Open?instead
#pragma?warning?disable?618
namespace?OdReadExMgd
{
??class?DbDumper
??{
????public?DbDumper()?{?}
????static?string?toDegreeString(double?val)
????{
??????return?(val?*?180.0?/?Math.PI)?+?“d“;
????}
????static?string?toHexString(int?val)
????{
??????return?string.Format(“0{0:X}“?val);
????}
????static?string?toArcSymbolTypeString(int?val)
????{
??????switch?(val)
??????{
????????case?0:?return?“Precedes?text“;
????????case?1:?return?“Above?text“;
????????case?2:?return?“None“;
??????}
??????return?“???“;
????}
????/************************************************************************/
????/*?Shorten?a?path?with?ellipses.????????????????????????????????????????*/
????/************************************************************************/
????static?string?shortenPath(string?Inpath?int?maxPath)
????{
??????string?path?=?Inpath;
??????/**********************************************************************/
??????/*?If?the?path?fits?just?return?it???????????????????????????????????*/
??????/**********************************************************************/
??????if?(path.Length?<=?maxPath)
??????{
????????return?path;
??????}
??????/**********************************************************************/
??????/*?If?there‘s?no?backslash?just?truncate?the?path????????????????????*/
??????/**********************************************************************/
??????int?lastBackslash?=?path.LastIndexOf(‘\\‘);
??????if?(lastBackslash?0)
??????{
????????return?path.Substring(0?maxPath?-?3)?+?“...“;
??????}
??????/**********************************************************************/
??????/*?Shorten?the?front?of?the?path??????????????????????????????????????*/
??????/**********************************************************************/
??????int?fromLeft?=?(lastBackslash?-?3)?-?(path.Length?-?maxPath);
??????//?(12?-?3)?-?(19?-?10)?=?9?-?9?=?0?
??????if?((lastBackslash?<=?3)?||?(fromLeft?1))
??????{
????????path?=?“...“?+?path.Substring(lastBackslash);
??????}
??????else
??????{
????????path?=?path.Substring(0?fromLeft)?+?“...“?+?path.Substring(lastBackslash);
??????}
??????/**********************************************************************/
??????/*?Truncate?the?path??????????????????????????????????????????????????*/
??????/**********************************************************************/
??????if?(path.Length?>?maxPath)
??????{
????????path?=?path.Substring(0?maxPath?-?3)?+?“...“;
??????}
??????return?path;
????}
????static?string?shortenPath(string?Inpath)
????{
??????return?shortenPath(Inpath?40);
????}
????/****************
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-12-04?22:58??DWGdirect_NET_3_02\
?????目錄???????????0??2012-12-04?21:36??DWGdirect_NET_3_02\bin\
?????文件???????98968??2009-11-11?22:54??DWGdirect_NET_3_02\bin\AcIdViewObj_3.02_8.drx
?????文件???????86680??2009-11-11?22:54??DWGdirect_NET_3_02\bin\AsdkSmileyDb_3.02_8.drx
?????文件???????90776??2009-11-11?22:54??DWGdirect_NET_3_02\bin\AutoSurfServices_3.02_8.drx
?????文件??????189080??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DbCommands_3.02_8.drx
?????文件??????709272??2009-11-11?22:53??DWGdirect_NET_3_02\bin\DD_AcisBuilder_3.02_8.dll
?????文件???????14488??2009-11-11?22:53??DWGdirect_NET_3_02\bin\DD_Alloc_3.02_8.dll
?????文件??????311960??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_Ave_3.02_8.drx
?????文件???????16024??2009-11-11?22:53??DWGdirect_NET_3_02\bin\DD_BmpExport_3.02_8.dll
?????文件??????307864??2009-11-11?22:53??DWGdirect_NET_3_02\bin\DD_BrepRenderer_3.02_8.dll
?????文件???????94872??2009-11-11?22:53??DWGdirect_NET_3_02\bin\DD_Br_3.02_8.dll
?????文件??????283288??2009-11-11?22:53??DWGdirect_NET_3_02\bin\DD_DbRoot_3.02_8.dll
?????文件?????8172184??2009-11-11?22:53??DWGdirect_NET_3_02\bin\DD_Db_3.02_8.dll
?????文件??????328344??2009-11-11?22:53??DWGdirect_NET_3_02\bin\DD_Dwf7Export_3.02_8.dll
?????文件??????246424??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_Dwf7Import_3.02_8.drx
?????文件??????123544??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_DwfUnderlay_3.02_8.drx
?????文件??????381592??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_DynBlocks_3.02_8.drx
?????文件??????369304??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_FtFontEngine_3.02_8.drx
?????文件?????1057432??2009-11-11?22:53??DWGdirect_NET_3_02\bin\DD_Ge_3.02_8.dll
?????文件??????701080??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_Gi_3.02_8.dll
?????文件??????475800??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_Gs_3.02_8.dll
?????文件?????4432536??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_Mgd_3.02_8.dll
?????文件??????238232??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_PdfExport_3.02_8.dll
?????文件??????565912??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_Root_3.02_8.dll
?????文件??????381592??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_Sm_3.02_8.drx
?????文件???????37016??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_STLExport_3.02_8.drx
?????文件??????221848??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DD_SvgExport_3.02_8.drx
?????文件??????303768??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DWFCore.dll
?????文件?????1516184??2009-11-11?22:54??DWGdirect_NET_3_02\bin\DWFToolkit.dll
?????文件??????676504??2009-11-11?22:55??DWGdirect_NET_3_02\bin\ExCustObjs_3.02_8.drx
............此處省略210個文件信息
評論
共有 條評論