개정판 475071f2
dev issue #1225 : text model and fix label angle
Change-Id: I6d4a27d4cf015d863e3e3595d92ccfba81774bd2
DTI_PID/APIDConverter/AVEVA.PID.CustomizationUtility_ACAD2018_x64.csproj | ||
---|---|---|
142 | 142 |
<Reference Include="WindowsBase" /> |
143 | 143 |
</ItemGroup> |
144 | 144 |
<ItemGroup> |
145 |
<Compile Include="Model\PlantItem\Text.cs" /> |
|
145 | 146 |
<Compile Include="Utils\AccessPropertyForm.cs" /> |
146 | 147 |
<Compile Include="APIDConverterExplorer.cs"> |
147 | 148 |
<SubType>UserControl</SubType> |
DTI_PID/APIDConverter/AutoModeling.cs | ||
---|---|---|
100 | 100 |
try |
101 | 101 |
{ |
102 | 102 |
SplashScreenManager.ShowForm(typeof(APIDSplashScreen), true, true); |
103 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllStepCount, 3);
|
|
103 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllStepCount, 4);
|
|
104 | 104 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetDocumentName, document.AvevaDrawingNumber + document.AvevaSheetNumber); |
105 | 105 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetParent, Autodesk.AutoCAD.ApplicationServices.Application.MainWindow.Handle); |
106 | 106 |
|
... | ... | |
109 | 109 |
RunLineModeling(); |
110 | 110 |
RunOPCModeling(); |
111 | 111 |
RunSymbolModeling(); |
112 |
|
|
113 |
|
|
112 |
RunTextModeling(); |
|
114 | 113 |
} |
115 | 114 |
catch (System.Exception ex) |
116 | 115 |
{ |
... | ... | |
158 | 157 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null); |
159 | 158 |
} |
160 | 159 |
} |
160 |
private void RunTextModeling() |
|
161 |
{ |
|
162 |
//SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllProgress, document.text.Count); |
|
163 |
//SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetStep, "Line Modeling"); |
|
164 |
//foreach (var item in document.LINES) |
|
165 |
//{ |
|
166 |
// if (item.Aveva.Handle == 0) |
|
167 |
// LineModeling(item); |
|
168 |
|
|
169 |
// SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
170 |
//} |
|
171 |
} |
|
161 | 172 |
#endregion |
162 | 173 |
|
163 | 174 |
#region Modeling Method |
... | ... | |
244 | 255 |
{ |
245 | 256 |
Point3d point = new Point3d(lineNumber.Aveva.X, lineNumber.Aveva.Y, 0); |
246 | 257 |
commandParam.Add(point); |
247 |
commandParam.Add(lineNumber.ANGLE);
|
|
258 |
commandParam.Add(lineNumber.Aveva.Angle);
|
|
248 | 259 |
|
249 | 260 |
commandParam.Add(null); |
250 | 261 |
} |
DTI_PID/APIDConverter/Model/PlantItem/Document.cs | ||
---|---|---|
685 | 685 |
item.Aveva.X = x; |
686 | 686 |
item.Aveva.Y = y; |
687 | 687 |
item.Aveva.LabelType = LabelType.LineNumber; |
688 |
item.Aveva.Angle = RadianToDegree(item.ANGLE); |
|
688 | 689 |
} |
689 | 690 |
|
690 | 691 |
return result; |
... | ... | |
701 | 702 |
y = Convert.ToDouble(drawingSizeHeight / id2Height * Convert.ToDecimal(y)); |
702 | 703 |
} |
703 | 704 |
|
705 |
private double RadianToDegree(double angle) |
|
706 |
{ |
|
707 |
return angle * (180.0 / Math.PI); |
|
708 |
} |
|
709 |
|
|
704 | 710 |
#endregion |
705 | 711 |
} |
706 | 712 |
} |
DTI_PID/APIDConverter/Model/PlantItem/Other/AvevaLabelInfo.cs | ||
---|---|---|
14 | 14 |
} |
15 | 15 |
public class AvevaLabelInfo |
16 | 16 |
{ |
17 |
public double Angle { get; set; } |
|
17 | 18 |
public LabelType LabelType { get; set; } |
18 | 19 |
public double X { get; set; } |
19 | 20 |
public double Y { get; set; } |
DTI_PID/APIDConverter/Model/PlantItem/Text.cs | ||
---|---|---|
1 |
using System; |
|
2 |
using System.Collections.Generic; |
|
3 |
using System.Linq; |
|
4 |
using System.Text; |
|
5 |
using System.Threading.Tasks; |
|
6 |
|
|
7 |
namespace AVEVA.PID.CustomizationUtility.Model |
|
8 |
{ |
|
9 |
public class Text |
|
10 |
{ |
|
11 |
private string _UID; |
|
12 |
private string _OWNER; |
|
13 |
private string _ATTRIBUTEVALUE; |
|
14 |
private string _NAME; |
|
15 |
private string _LOCATION; |
|
16 |
private double _LOCATION_X; |
|
17 |
private double _LOCATION_Y; |
|
18 |
public double LOCATION_X { get { return _LOCATION_X; } } |
|
19 |
public double LOCATION_Y { get { return _LOCATION_Y; } } |
|
20 |
private string _VALUE; |
|
21 |
private double _ANGLE; |
|
22 |
private string _WIDTH; |
|
23 |
private string _HEIGHT; |
|
24 |
private string _AREA; |
|
25 |
private string _SCENE; |
|
26 |
private bool _ASSOCIATION; |
|
27 |
|
|
28 |
public string UID { get => _UID; set => _UID = value; } |
|
29 |
public string ATTRIBUTEVALUE { get => _ATTRIBUTEVALUE; set => _ATTRIBUTEVALUE = value; } |
|
30 |
public string NAME { get => _NAME; set => _NAME = value; } |
|
31 |
public string LOCATION |
|
32 |
{ |
|
33 |
get |
|
34 |
{ |
|
35 |
return _LOCATION; |
|
36 |
} |
|
37 |
set |
|
38 |
{ |
|
39 |
_LOCATION = value; |
|
40 |
double x = 0; |
|
41 |
double y = 0; |
|
42 |
APIDUtils.ConvertPointBystring(_LOCATION, ref x, ref y); |
|
43 |
_LOCATION_X = x; |
|
44 |
_LOCATION_Y = y; |
|
45 |
} |
|
46 |
} |
|
47 |
public string VALUE { get => _VALUE; set => _VALUE = value; } |
|
48 |
public double ANGLE |
|
49 |
{ |
|
50 |
get |
|
51 |
{ |
|
52 |
return _ANGLE; |
|
53 |
} |
|
54 |
set |
|
55 |
{ |
|
56 |
double gap = 0.05; |
|
57 |
if (value < gap) |
|
58 |
value = 0; |
|
59 |
else if (1.57 - gap < value && value < 1.57 + gap) |
|
60 |
value = 90 * Math.PI / 180; |
|
61 |
else if (3.14 - gap < value && value < 3.14 + gap) |
|
62 |
value = Math.PI; |
|
63 |
else if (4.71 - gap < value && value < 4.71 + gap) |
|
64 |
value = 270 * Math.PI / 180; |
|
65 |
|
|
66 |
_ANGLE = value; |
|
67 |
} |
|
68 |
} |
|
69 |
public string WIDTH { get => _WIDTH; set => _WIDTH = value; } |
|
70 |
public string HEIGHT { get => _HEIGHT; set => _HEIGHT = value; } |
|
71 |
public string AREA { get => _AREA; set => _AREA = value; } |
|
72 |
public bool ASSOCIATION { get => _ASSOCIATION; set => _ASSOCIATION = value; } |
|
73 |
public string OWNER { get => _OWNER; set => _OWNER = value; } |
|
74 |
|
|
75 |
public string SCENE |
|
76 |
{ |
|
77 |
get |
|
78 |
{ |
|
79 |
return _SCENE; |
|
80 |
} |
|
81 |
set |
|
82 |
{ |
|
83 |
string[] split = value.Split(','); |
|
84 |
X1 = Convert.ToDouble(split[0]); |
|
85 |
Y1 = Convert.ToDouble(split[1]); |
|
86 |
X2 = X1 + Convert.ToDouble(split[2]); |
|
87 |
Y2 = Y1 + Convert.ToDouble(split[3]); |
|
88 |
_SCENE = value; |
|
89 |
} |
|
90 |
} |
|
91 |
public double X1 { get; set; } |
|
92 |
public double X2 { get; set; } |
|
93 |
public double Y1 { get; set; } |
|
94 |
public double Y2 { get; set; } |
|
95 |
} |
|
96 |
} |
내보내기 Unified diff