개정판 60f4405d
dev issue #000 : 각도 계산 버그 수정
Change-Id: Id76e27e6df0e6119653634714fd24d7fe02749a4
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
156 | 156 |
SplashScreenManager.CloseForm(false); |
157 | 157 |
Log.Write("\r\n"); |
158 | 158 |
} |
159 |
|
|
160 |
GC.Collect(); |
|
159 | 161 |
} |
160 | 162 |
} |
161 | 163 |
private void RunEquipmentModeling() |
... | ... | |
877 | 879 |
if (_LMSymbol != null) |
878 | 880 |
{ |
879 | 881 |
_LMSymbol.Commit(); |
882 |
|
|
883 |
// ConnCheck |
|
884 |
List<string> ids = new List<string>(); |
|
885 |
foreach (LMConnector item in _LMSymbol.Connect1Connectors) |
|
886 |
{ |
|
887 |
if (item.get_ItemStatus() == "Active" && !ids.Contains(item.Id)) |
|
888 |
ids.Add(item.Id); |
|
889 |
ReleaseCOMObjects(item); |
|
890 |
} |
|
891 |
foreach (LMConnector item in _LMSymbol.Connect2Connectors) |
|
892 |
{ |
|
893 |
if (item.get_ItemStatus() == "Active" && !ids.Contains(item.Id)) |
|
894 |
ids.Add(item.Id); |
|
895 |
ReleaseCOMObjects(item); |
|
896 |
} |
|
897 |
|
|
898 |
int createdSymbolCount = document.SYMBOLS.FindAll(i => i.CONNECTORS.Find(j => j.CONNECTEDITEM == symbol.UID) != null && !string.IsNullOrEmpty(i.SPPID.RepresentationId)).Count; |
|
899 |
if (targetSymbol == null && ids.Count != createdSymbolCount) |
|
900 |
{ |
|
901 |
double currentX = _LMSymbol.get_XCoordinate(); |
|
902 |
double currentY = _LMSymbol.get_YCoordinate(); |
|
903 |
|
|
904 |
|
|
905 |
} |
|
906 |
|
|
880 | 907 |
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id; |
881 | 908 |
symbol.SPPID.ModelItemID = _LMSymbol.ModelItemID; |
882 | 909 |
symbol.SPPID.GraphicOID = _LMSymbol.get_GraphicOID().ToString(); |
... | ... | |
1636 | 1663 |
placeRunInputs.AddPoint(-0.1 - index, y); |
1637 | 1664 |
else |
1638 | 1665 |
{ |
1639 |
if (SPPIDUtil.CalcAngle(groupLine.SPPID.START_X, groupLine.SPPID.START_Y, groupLine.SPPID.END_X, groupLine.SPPID.END_Y) < 45) |
|
1640 |
placeRunInputs.AddPoint(x, -0.1 - index); |
|
1641 |
else |
|
1666 |
Line nextLine = groupLine.CONNECTORS[0].ConnectedObject as Line; |
|
1667 |
if (SPPIDUtil.CalcAngle(nextLine.SPPID.START_X, nextLine.SPPID.START_Y, nextLine.SPPID.END_X, nextLine.SPPID.END_Y) < 45) |
|
1642 | 1668 |
placeRunInputs.AddPoint(-0.1 - index, y); |
1669 |
else |
|
1670 |
placeRunInputs.AddPoint(x, -0.1 - index); |
|
1643 | 1671 |
} |
1644 | 1672 |
} |
1645 | 1673 |
|
... | ... | |
1654 | 1682 |
placeRunInputs.AddPoint(-0.1 - index, y); |
1655 | 1683 |
else |
1656 | 1684 |
{ |
1657 |
if (SPPIDUtil.CalcAngle(groupLine.SPPID.START_X, groupLine.SPPID.START_Y, groupLine.SPPID.END_X, groupLine.SPPID.END_Y) < 45) |
|
1658 |
placeRunInputs.AddPoint(x, -0.1 - index); |
|
1659 |
else |
|
1685 |
Line nextLine = groupLine.CONNECTORS[1].ConnectedObject as Line; |
|
1686 |
if (SPPIDUtil.CalcAngle(nextLine.SPPID.START_X, nextLine.SPPID.START_Y, nextLine.SPPID.END_X, nextLine.SPPID.END_Y) < 45) |
|
1660 | 1687 |
placeRunInputs.AddPoint(-0.1 - index, y); |
1688 |
else |
|
1689 |
placeRunInputs.AddPoint(x, -0.1 - index); |
|
1661 | 1690 |
} |
1662 | 1691 |
} |
1663 | 1692 |
} |
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs | ||
---|---|---|
194 | 194 |
} |
195 | 195 |
public static double CalcAngle(double x1, double y1, double x2, double y2) |
196 | 196 |
{ |
197 |
double result = 0; |
|
197 |
double result = 90;
|
|
198 | 198 |
if (x1 - x2 != 0) |
199 | 199 |
{ |
200 | 200 |
result = Math.Atan(Math.Abs(y2 - y1) / Math.Abs(x2 - x1)) * 180 / Math.PI; |
내보내기 Unified diff