개정판 1ba9c671
dev issue #000 : 도면 사이즈 적용 및 Attribute Label LeaderLine 적용
Change-Id: I991272aa8a7acbbf49edf23db5ac7737cee3828b
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
27 | 27 |
{ |
28 | 28 |
Placement _placement; |
29 | 29 |
LMADataSource dataSource; |
30 |
dynamic newDrawing; |
|
30 | 31 |
dynamic application; |
31 | 32 |
Ingr.RAD2D.Application radApp; |
32 | 33 |
SPPID_Document document; |
... | ... | |
41 | 42 |
this._ETCSetting = ETCSetting.GetInstance(); |
42 | 43 |
} |
43 | 44 |
|
44 |
public void Test()
|
|
45 |
public void Run()
|
|
45 | 46 |
{ |
46 |
_placement = new Placement(); |
|
47 |
dataSource = _placement.PIDDataSource; |
|
48 |
|
|
49 |
Ingr.RAD2D.Symbol2d symbol2d = radApp.ActiveSelectSet[0] as Ingr.RAD2D.Symbol2d; |
|
50 |
if (symbol2d != null) |
|
47 |
try |
|
51 | 48 |
{ |
52 |
string modelID = symbol2d.AttributeSets[0][5].GetValue().ToString(); |
|
49 |
_placement = new Placement(); |
|
50 |
dataSource = _placement.PIDDataSource; |
|
53 | 51 |
|
54 |
LMModelItem modelItem = dataSource.GetModelItem(modelID); |
|
55 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
52 |
newDrawing = application.Drawings.Add(document.Unit, document.Template, document.DrawingNumber, document.DrawingName); |
|
53 |
application.ActiveWindow.Fit(); |
|
54 |
Thread.Sleep(500); |
|
55 |
application.ActiveWindow.Zoom = 2000; |
|
56 |
Thread.Sleep(1000); |
|
57 |
|
|
58 |
double maxX = 0; |
|
59 |
double maxY = 0; |
|
60 |
foreach (object drawingObj in radApp.ActiveDocument.ActiveSheet.DrawingObjects) |
|
56 | 61 |
{ |
57 |
if (rep.Attributes["RepresentationType"].get_Value() == "Symbol") |
|
62 |
Ingr.RAD2D.SmartFrame2d smart = drawingObj as Ingr.RAD2D.SmartFrame2d; |
|
63 |
if (smart != null) |
|
58 | 64 |
{ |
59 |
LMSymbol symbol = dataSource.GetSymbol(rep.Id); |
|
60 |
|
|
61 |
int rotateIndex = symbol.get_IsRotatableIndex(); |
|
62 |
int mirrorIndex = symbol.get_IsMirroredIndex(); |
|
63 |
|
|
65 |
double x1 = 0; |
|
66 |
double x2 = 0; |
|
67 |
double y1 = 0; |
|
68 |
double y2 = 0; |
|
69 |
smart.Range(out x1, out y1, out x2, out y2); |
|
70 |
maxX = Math.Max(x2, maxX); |
|
71 |
maxY = Math.Max(y2, maxY); |
|
64 | 72 |
} |
65 | 73 |
} |
66 |
|
|
67 |
|
|
68 |
//symbol2d.AttributeSets[] |
|
69 |
//dataSource.GetSymbol() |
|
70 |
} |
|
71 |
} |
|
72 | 74 |
|
73 |
public void Run() |
|
74 |
{ |
|
75 |
CloseOPCForm.Run(); |
|
76 |
_placement = new Placement(); |
|
77 |
dataSource = _placement.PIDDataSource; |
|
78 |
|
|
79 |
dynamic newDrawing = application.Drawings.Add(document.Unit, document.Template, document.DrawingNumber, document.DrawingName); |
|
80 |
application.ActiveWindow.Fit(); |
|
81 |
Thread.Sleep(100); |
|
82 |
application.ActiveWindow.Zoom = 60; |
|
83 |
Thread.Sleep(100); |
|
75 |
document.SetSPPIDLocation(maxX, maxY); |
|
84 | 76 |
|
85 |
try |
|
86 |
{ |
|
87 | 77 |
// Equipment Modeling |
88 | 78 |
foreach (Equipment equipment in document.Equipments) |
89 | 79 |
EquipmentModeling(equipment); |
... | ... | |
220 | 210 |
} |
221 | 211 |
finally |
222 | 212 |
{ |
213 |
application.ActiveWindow.Fit(); |
|
214 |
|
|
215 |
if (newDrawing != null) |
|
216 |
ReleaseCOMObjects(newDrawing); |
|
217 |
|
|
223 | 218 |
ReleaseCOMObjects(dataSource); |
224 | 219 |
ReleaseCOMObjects(_placement); |
225 | 220 |
} |
226 |
|
|
227 |
CloseOPCForm.Stop(); |
|
228 |
//System.Windows.Forms.MessageBox.Show("end"); |
|
229 | 221 |
} |
230 | 222 |
|
231 | 223 |
private void LineModelingByRun(LineRun run) |
... | ... | |
1259 | 1251 |
if (item.GetType() == typeof(Line)) |
1260 | 1252 |
{ |
1261 | 1253 |
Line line = item as Line; |
1262 |
if (modelItemId != line.SPPID.ModelItemId) |
|
1263 |
{ |
|
1264 |
AutoJoinPipeRun(line.SPPID.ModelItemId); |
|
1265 |
modelItemId = line.SPPID.ModelItemId; |
|
1266 |
} |
|
1254 |
AutoJoinPipeRun(line.SPPID.ModelItemId); |
|
1255 |
modelItemId = line.SPPID.ModelItemId; |
|
1256 |
//if (modelItemId != line.SPPID.ModelItemId) |
|
1257 |
//{ |
|
1258 |
|
|
1259 |
//} |
|
1267 | 1260 |
} |
1268 | 1261 |
} |
1269 | 1262 |
} |
... | ... | |
1657 | 1650 |
CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, mapping.Location); |
1658 | 1651 |
Array array = new double[] { 0, x, y }; |
1659 | 1652 |
|
1660 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: true);
|
|
1653 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine);
|
|
1661 | 1654 |
if (_LMLabelPersist!=null) |
1662 | 1655 |
{ |
1663 | 1656 |
_LMLabelPersist.Commit(); |
내보내기 Unified diff