|
|
|
@ -587,17 +587,32 @@ public class ViewportHelperPro |
|
|
|
|
int.TryParse(key.Split("_")[1], out facetIndex); |
|
|
|
|
List<Vector3> facetPoints = new List<Vector3>(); |
|
|
|
|
value.ForEach(e => { facetPoints.Add(e.Point1); facetPoints.Add(e.Point2); facetPoints.Add(e.Point3); }); |
|
|
|
|
|
|
|
|
|
if (ViewportManager.DiamondData.Count > 1 && facetIndex != -1) |
|
|
|
|
var param = ViewportManager.DicFacetToValueParam.ContainsKey(selFacetType) ? ViewportManager.DicFacetToValueParam[selFacetType] : null; |
|
|
|
|
if (param == null) |
|
|
|
|
{ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (groupedDic.Count == 1) |
|
|
|
|
{ |
|
|
|
|
Logger.Info($"【面文本生成】 钻石数据有效,Index有效"); |
|
|
|
|
facetIndex += 1; |
|
|
|
|
var param = ViewportManager.DicFacetToValueParam.ContainsKey(selFacetType) ? ViewportManager.DicFacetToValueParam[selFacetType] : null; |
|
|
|
|
if (param == null) |
|
|
|
|
{ continue; |
|
|
|
|
|
|
|
|
|
var paramValue = ViewportManager.DiamondData[$"{param}"]; |
|
|
|
|
if (paramValue == null) |
|
|
|
|
{ |
|
|
|
|
Logger.Info($"【面文本生成】 {param} Key不存在"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(),param); |
|
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {facetIndex}"); |
|
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
|
result.Add(DisplayText3D($"{valueFloat}", facetTextPoint, textColor)); |
|
|
|
|
|
|
|
|
|
}else if (groupedDic.Count == 16) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
} else if (ViewportManager.DiamondData.Count > 1 && facetIndex != -1) |
|
|
|
|
{ |
|
|
|
|
facetIndex += 1; |
|
|
|
|
|
|
|
|
|
var detail = ViewportManager.DiamondData[$"{param}_DETAIL"]; |
|
|
|
|
if (detail == null) |
|
|
|
|
{ |
|
|
|
@ -613,7 +628,7 @@ public class ViewportHelperPro |
|
|
|
|
} |
|
|
|
|
Logger.Info($"【面文本生成】 {param}_DETAIL.{param}_{facetIndex} ==={paramValue}"); |
|
|
|
|
|
|
|
|
|
var valueFloat = float.Parse(paramValue.ToString()).ToString("F1"); |
|
|
|
|
var valueFloat = ValueFormat(paramValue.ToString(),param); |
|
|
|
|
Logger.Info($"【面文本生成】 {valueFloat} -- {facetIndex}"); |
|
|
|
|
var facetTextPoint = GetOffsetCenter(facetPoints, ViewportManager.CenterVector); |
|
|
|
|
result.Add(DisplayText3D($" {facetIndex} \r\n {valueFloat}", facetTextPoint, textColor)); |
|
|
|
@ -1355,6 +1370,27 @@ public class ViewportHelperPro |
|
|
|
|
Vector3 endPoint = line.Item2; |
|
|
|
|
return Math.Round(Vector3.Distance(startPoint, endPoint), 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static string ValueFormat(string value, string type, bool hasUnit = false) |
|
|
|
|
{ |
|
|
|
|
if (double.TryParse(value, out var v) ) |
|
|
|
|
{ |
|
|
|
|
switch (type) |
|
|
|
|
{ |
|
|
|
|
case "DIAMETER": return hasUnit ? $"{v.ToString("F1")}mm" : v.ToString("F1"); |
|
|
|
|
case "CROWN_ANGLE": |
|
|
|
|
case "PAV_ANGLE": |
|
|
|
|
case "TWIST": return hasUnit ? $"{v.ToString("F1")}°" : v.ToString("F1"); |
|
|
|
|
case "TABLE": |
|
|
|
|
//var vv = v % 0.5 |
|
|
|
|
default: |
|
|
|
|
return hasUnit ? $"{(v*100).ToString("F1")}%" : (v*100).ToString("F1"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return "--"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
} |