您好,登錄后才能下訂單哦!
本文小編為大家詳細(xì)介紹“AutoCAD處理控件Aspose.CAD怎么用”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“AutoCAD處理控件Aspose.CAD怎么用”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來學(xué)習(xí)新知識吧。
Aspose.CAD for .NET是一個(gè)獨(dú)立的AutoCAD處理API。它提供將DWG,DWF和DXF文件轉(zhuǎn)換為高質(zhì)量PDF和光柵圖像的功能。開發(fā)人員可以從AutoCAD文件中選擇和轉(zhuǎn)換特定的布局和圖層,并輕松跟蹤整個(gè)文件轉(zhuǎn)換過程。
Aspose.CAD for .NET提供了使用CadImage類打開非常大的DWG文件的功能?,F(xiàn)在,您可以使用下面給出的示例示例輕松打開大文件。
//文檔目錄的路徑. string MyDir = RunExamples.GetDataDir_DWGDrawings(); string filePathDWG = MyDir + "TestBigFile.dwg"; string filePathFinish = MyDir+ "TestBigFile.dwg.pdf"; Stopwatch stopWatch = new Stopwatch(); try { stopWatch.Start(); using (CadImage cadImage = (CadImage)Image.Load(filePathDWG)) { stopWatch.Stop(); // 將經(jīng)過的時(shí)間作為TimeSpan值獲取. TimeSpan ts = stopWatch.Elapsed; //格式化并顯示TimeSpan值. string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); Console.WriteLine("RunTime for loading " + elapsedTime); CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions(); rasterizationOptions.PageWidth = 1600; rasterizationOptions.PageHeight = 1600; PdfOptions pdfOptions = new PdfOptions(); pdfOptions.VectorRasterizationOptions = rasterizationOptions; stopWatch = new Stopwatch(); stopWatch.Start(); cadImage.Save(filePathFinish, pdfOptions); stopWatch.Stop(); //將經(jīng)過的時(shí)間作為TimeSpan值獲取. ts = stopWatch.Elapsed; //格式化并顯示TimeSpan值. elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10); Console.WriteLine("RunTime for converting " + elapsedTime); } } catch (Exception ex) { Console.WriteLine(ex.Message); }
Aspose.CAD允許您為模型布局設(shè)置自定義視點(diǎn)。使用VectorRasterizationOptions可以設(shè)置自定義視點(diǎn)。以下示例顯示如何設(shè)置自定義視點(diǎn)。
//文檔目錄的路徑. string MyDir = RunExamples.GetDataDir_ConvertingCAD(); string sourceFilePath = MyDir + "conic_pyramid.dxf"; var outPath = Path.Combine(MyDir, "FreePointOfView_out.jpg"); using (CadImage cadImage = (CadImage)Image.Load(sourceFilePath)) { JpegOptions options = new JpegOptions { VectorRasterizationOptions = new CadRasterizationOptions { PageWidth = 1500, PageHeight = 1500 } }; float xAngle = 10; //沿X軸的旋轉(zhuǎn)角度 float yAngle = 30; //沿Y軸的旋轉(zhuǎn)角度 float zAngle = 40; //沿Z軸的旋轉(zhuǎn)角度 ((CadRasterizationOptions)(options.VectorRasterizationOptions)).ObserverPoint = new ObserverPoint(xAngle, yAngle, zAngle); cadImage.Save(outPath, options); }
讀到這里,這篇“AutoCAD處理控件Aspose.CAD怎么用”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識點(diǎn)還需要大家自己動(dòng)手實(shí)踐使用過才能領(lǐng)會(huì),如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。