Поддръжка за DWT файлове
Aspose.CAD за .NET позволява на разработчиците да зареждат и запазват DWT файлове. Примерен код е даден по-долу, за да се постигне тази функционалност.
Примерен код
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The path to the documents directory. | |
string MyDir = RunExamples.GetDataDir_ConvertingCAD(); | |
using (CadImage image = (CadImage)Image.Load(MyDir+"example.dwt")) | |
{ | |
foreach (CadBaseEntity entity in image.Entities) | |
{ | |
//do your work here | |
} | |
} | |
} |
Различаване на форматите DWT и DWG
По-долу е представен кодът, който демонстрира как да се различават DWT и DWG форматите с помощта на Aspose.CAD за .NET.
Примерен код
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var formatTypeDwt = Image.GetFileFormat(GetFileFromDesktop("sample.dwt")); | |
Assert.IsTrue(formatTypeDwt.ToString().ToLower().Contains("dwt")); | |
var formatTypeDwg = Image.GetFileFormat(GetFileFromDesktop("sample.dwg")); | |
Assert.IsTrue(formatTypeDwg.ToString().ToLower().Contains("dwg")); | |