翻譯|使用教程|編輯:楊鵬連|2021-04-21 11:37:17.683|閱讀 269 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學習。本文將會介紹如何糾正為Infinity或NaN double值的對象屬性。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
VectorDraw開發人員框架(VDF)是一個使用的應用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創建,編輯,管理,輸出,輸入和打印2D和3D圖形文件。該庫還支持許多向量和先前輸入和輸出格式,包括本地PDF和SVG輸入。
問:如何校正為Infinity或NaN double值的對象屬性?
答:出于某種原因,圖中可能存在的物體是無窮大或NaN的雙重性質 ,這可能產生很多問題到圖像替換或選擇。在下面的示例檢查所有的圖中有對StartTangent和EndTangent無效屬性的多段線。
使用下面的代碼在出口前DWG格式圖紙
//check if a double value is a valid number
static bool IsdoubleValid(double d)
{
return !(double.IsNaN(d) && !double.IsInfinity(d));
}
//check if a Vector x,y,z are valid numbers
static bool IsValidVector(Vector v)
{
return IsdoubleValid(v.x) && IsdoubleValid(v.y) && IsdoubleValid(v.z);
}
document.UndoHistory.PushEnable(false);//force disable the undo history .Changes of polylines wrong properties does not need to be saved to undo history
vdPrimariesList primaries = document.GetPrimaries(true);//get all entities in the drawing in all layouts and all blocks
foreach (vdPrimary item in primaries)
{
vdPolyline pl = item as vdPolyline;
if (pl == null) continue;
if (pl.StartTangent != null && !IsValidVector(pl.StartTangent)) pl.StartTangent = null;
if (pl.EndTangent != null && !IsValidVector(pl.EndTangent)) pl.EndTangent = null;
}
document.UndoHistory.PopEnable();//restore the undo history to previous state4
================================================== =====
如果您對想要購買正版授權VectorDraw Developer Framework(VDF),可以聯系咨詢相關問題。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自: