개정판 16584d30
dev issue #366 : SpecBreakModeling 완료
Change-Id: Icd84c16676843543fd861e5701cfc8f6b2806f8f
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
204 | 204 |
foreach (var item in document.SYMBOLS) |
205 | 205 |
InputSymbolAttribute(item, item.ATTRIBUTES); |
206 | 206 |
|
207 |
// Input SpecBreak Attribute |
|
208 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set Symbols Attribute"); |
|
209 |
foreach (var item in document.SpecBreaks) |
|
210 |
InputSpecBreakAttribute(item); |
|
211 |
|
|
212 |
// Label Symbol Modeling |
|
207 | 213 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Labels Modeling"); |
208 | 214 |
foreach (var item in document.SYMBOLS) |
209 | 215 |
LabelSymbolModeling(item); |
... | ... | |
1855 | 1861 |
|
1856 | 1862 |
if (targetLMConnector != null) |
1857 | 1863 |
{ |
1858 |
string MappingPath = specBreak.SPPID.MAPPINGNAME; |
|
1859 |
Array array = new double[] { 0, specBreak.SPPID.ORIGINAL_X, specBreak.SPPID.ORIGINAL_Y }; |
|
1860 |
LMLabelPersist _LmLabelPersist = _placement.PIDPlaceLabel(MappingPath, ref array, Rotation: specBreak.ANGLE, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: true); |
|
1861 |
|
|
1862 |
if (_LmLabelPersist != null) |
|
1864 |
foreach (var attribute in specBreak.ATTRIBUTES) |
|
1863 | 1865 |
{ |
1864 |
specBreak.SPPID.RepresentationId = _LmLabelPersist.AsLMRepresentation().Id; |
|
1865 |
ReleaseCOMObjects(_LmLabelPersist); |
|
1866 |
} |
|
1866 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID); |
|
1867 |
if (mapping != null && !string.IsNullOrEmpty(mapping.SPPIDSYMBOLNAME) && mapping.SPPIDSYMBOLNAME != "None") |
|
1868 |
{ |
|
1869 |
string MappingPath = mapping.SPPIDSYMBOLNAME; |
|
1870 |
Array array = new double[] { 0, specBreak.SPPID.ORIGINAL_X, specBreak.SPPID.ORIGINAL_Y }; |
|
1871 |
LMLabelPersist _LmLabelPersist = _placement.PIDPlaceLabel(MappingPath, ref array, Rotation: specBreak.ANGLE, LabeledItem: targetLMConnector.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine); |
|
1867 | 1872 |
|
1873 |
if (_LmLabelPersist != null) |
|
1874 |
{ |
|
1875 |
ReleaseCOMObjects(_LmLabelPersist); |
|
1876 |
} |
|
1877 |
} |
|
1878 |
} |
|
1868 | 1879 |
ReleaseCOMObjects(targetLMConnector); |
1869 | 1880 |
} |
1870 | 1881 |
} |
... | ... | |
2662 | 2673 |
} |
2663 | 2674 |
|
2664 | 2675 |
/// <summary> |
2676 |
/// Input SpecBreak Attribute |
|
2677 |
/// </summary> |
|
2678 |
/// <param name="specBreak"></param> |
|
2679 |
private void InputSpecBreakAttribute(SpecBreak specBreak) |
|
2680 |
{ |
|
2681 |
try |
|
2682 |
{ |
|
2683 |
object upStreamObj = SPPIDUtil.FindObjectByUID(document, specBreak.UpStreamUID); |
|
2684 |
object downStreamObj = SPPIDUtil.FindObjectByUID(document, specBreak.DownStreamUID); |
|
2685 |
|
|
2686 |
if (upStreamObj != null && |
|
2687 |
downStreamObj != null) |
|
2688 |
{ |
|
2689 |
LMConnector targetLMConnector = FindBreakLineTarget(upStreamObj, downStreamObj); |
|
2690 |
|
|
2691 |
if (targetLMConnector != null) |
|
2692 |
{ |
|
2693 |
foreach (LMLabelPersist _LMLabelPersist in targetLMConnector.LabelPersists) |
|
2694 |
{ |
|
2695 |
string symbolPath = _LMLabelPersist.get_FileName(); |
|
2696 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.SPPIDSYMBOLNAME == symbolPath); |
|
2697 |
if (mapping != null) |
|
2698 |
{ |
|
2699 |
BaseModel.Attribute attribute = specBreak.ATTRIBUTES.Find(y => y.UID == mapping.UID); |
|
2700 |
if (attribute != null && !string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None") |
|
2701 |
{ |
|
2702 |
string[] values = attribute.VALUE.Split(new char[] { ',' }); |
|
2703 |
if (values.Length == 2) |
|
2704 |
{ |
|
2705 |
string upStreamValue = values[0]; |
|
2706 |
string downStreamValue = values[1]; |
|
2707 |
|
|
2708 |
InputAttributeForSpecBreak(upStreamObj, downStreamObj, upStreamValue, downStreamValue, mapping.SPPIDATTRIBUTENAME); |
|
2709 |
} |
|
2710 |
} |
|
2711 |
} |
|
2712 |
} |
|
2713 |
|
|
2714 |
ReleaseCOMObjects(targetLMConnector); |
|
2715 |
} |
|
2716 |
} |
|
2717 |
} |
|
2718 |
catch (Exception ex) |
|
2719 |
{ |
|
2720 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2721 |
} |
|
2722 |
|
|
2723 |
#region 내부에서만 쓰는 메서드 |
|
2724 |
void InputAttributeForSpecBreak(object upStreamObj, object downStreamObj, string upStreamValue, string downStreamValue, string sppidAttributeName) |
|
2725 |
{ |
|
2726 |
try |
|
2727 |
{ |
|
2728 |
Symbol upStreamSymbol = upStreamObj as Symbol; |
|
2729 |
Line upStreamLine = upStreamObj as Line; |
|
2730 |
Symbol downStreamSymbol = downStreamObj as Symbol; |
|
2731 |
Line downStreamLine = downStreamObj as Line; |
|
2732 |
// 둘다 Line일 경우 |
|
2733 |
if (upStreamLine != null && downStreamLine != null) |
|
2734 |
{ |
|
2735 |
InputLineAttributeForSpecBreakLine(upStreamLine, sppidAttributeName, upStreamValue); |
|
2736 |
InputLineAttributeForSpecBreakLine(downStreamLine, sppidAttributeName, downStreamValue); |
|
2737 |
} |
|
2738 |
// 둘다 Symbol일 경우 |
|
2739 |
else if (upStreamSymbol != null && downStreamSymbol != null) |
|
2740 |
{ |
|
2741 |
LMConnector zeroLenthConnector = FindBreakLineTarget(upStreamSymbol, downStreamSymbol); |
|
2742 |
LMSymbol upStreamLMSymbol = dataSource.GetSymbol(upStreamSymbol.SPPID.RepresentationId); |
|
2743 |
LMSymbol downStreamLMSymbol = dataSource.GetSymbol(downStreamSymbol.SPPID.RepresentationId); |
|
2744 |
|
|
2745 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid1Connectors) |
|
2746 |
{ |
|
2747 |
if (connector.get_ItemStatus() != "Active") |
|
2748 |
continue; |
|
2749 |
|
|
2750 |
if (connector.Id != zeroLenthConnector.Id) |
|
2751 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2752 |
} |
|
2753 |
|
|
2754 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid2Connectors) |
|
2755 |
{ |
|
2756 |
if (connector.get_ItemStatus() != "Active") |
|
2757 |
continue; |
|
2758 |
|
|
2759 |
if (connector.Id != zeroLenthConnector.Id) |
|
2760 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2761 |
} |
|
2762 |
|
|
2763 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid1Connectors) |
|
2764 |
{ |
|
2765 |
if (connector.get_ItemStatus() != "Active") |
|
2766 |
continue; |
|
2767 |
|
|
2768 |
if (connector.Id != zeroLenthConnector.Id) |
|
2769 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2770 |
} |
|
2771 |
|
|
2772 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid2Connectors) |
|
2773 |
{ |
|
2774 |
if (connector.get_ItemStatus() != "Active") |
|
2775 |
continue; |
|
2776 |
|
|
2777 |
if (connector.Id != zeroLenthConnector.Id) |
|
2778 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2779 |
} |
|
2780 |
|
|
2781 |
ReleaseCOMObjects(zeroLenthConnector); |
|
2782 |
ReleaseCOMObjects(upStreamLMSymbol); |
|
2783 |
ReleaseCOMObjects(downStreamLMSymbol); |
|
2784 |
} |
|
2785 |
else if (upStreamSymbol != null && downStreamLine != null) |
|
2786 |
{ |
|
2787 |
LMConnector zeroLenthConnector = FindBreakLineTarget(upStreamSymbol, downStreamLine); |
|
2788 |
InputLineAttributeForSpecBreakLine(downStreamLine, sppidAttributeName, downStreamValue); |
|
2789 |
LMSymbol upStreamLMSymbol = dataSource.GetSymbol(upStreamSymbol.SPPID.RepresentationId); |
|
2790 |
|
|
2791 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid1Connectors) |
|
2792 |
{ |
|
2793 |
if (connector.get_ItemStatus() != "Active") |
|
2794 |
continue; |
|
2795 |
|
|
2796 |
if (connector.Id != zeroLenthConnector.Id) |
|
2797 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2798 |
} |
|
2799 |
|
|
2800 |
foreach (LMConnector connector in upStreamLMSymbol.Avoid2Connectors) |
|
2801 |
{ |
|
2802 |
if (connector.get_ItemStatus() != "Active") |
|
2803 |
continue; |
|
2804 |
|
|
2805 |
if (connector.Id != zeroLenthConnector.Id) |
|
2806 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, upStreamValue); |
|
2807 |
} |
|
2808 |
|
|
2809 |
ReleaseCOMObjects(zeroLenthConnector); |
|
2810 |
ReleaseCOMObjects(upStreamLMSymbol); |
|
2811 |
} |
|
2812 |
else if (upStreamLine != null && downStreamSymbol != null) |
|
2813 |
{ |
|
2814 |
LMConnector zeroLenthConnector = FindBreakLineTarget(upStreamLine, downStreamSymbol); |
|
2815 |
InputLineAttributeForSpecBreakLine(upStreamLine, sppidAttributeName, upStreamValue); |
|
2816 |
LMSymbol downStreamLMSymbol = dataSource.GetSymbol(downStreamSymbol.SPPID.RepresentationId); |
|
2817 |
|
|
2818 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid1Connectors) |
|
2819 |
{ |
|
2820 |
if (connector.get_ItemStatus() != "Active") |
|
2821 |
continue; |
|
2822 |
|
|
2823 |
if (connector.Id != zeroLenthConnector.Id) |
|
2824 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2825 |
} |
|
2826 |
|
|
2827 |
foreach (LMConnector connector in downStreamLMSymbol.Avoid2Connectors) |
|
2828 |
{ |
|
2829 |
if (connector.get_ItemStatus() != "Active") |
|
2830 |
continue; |
|
2831 |
|
|
2832 |
if (connector.Id != zeroLenthConnector.Id) |
|
2833 |
InputLineAttributeForSpecBreakLMConnector(connector, sppidAttributeName, downStreamValue); |
|
2834 |
} |
|
2835 |
|
|
2836 |
ReleaseCOMObjects(zeroLenthConnector); |
|
2837 |
ReleaseCOMObjects(downStreamLMSymbol); |
|
2838 |
} |
|
2839 |
} |
|
2840 |
catch (Exception ex) |
|
2841 |
{ |
|
2842 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2843 |
} |
|
2844 |
} |
|
2845 |
|
|
2846 |
void InputLineAttributeForSpecBreakLine(Line line, string attrName, string value) |
|
2847 |
{ |
|
2848 |
try |
|
2849 |
{ |
|
2850 |
LMModelItem _LMModelItem = dataSource.GetModelItem(line.SPPID.ModelItemId); |
|
2851 |
if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active") |
|
2852 |
{ |
|
2853 |
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[attrName]; |
|
2854 |
if (_LMAAttribute != null) |
|
2855 |
{ |
|
2856 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
2857 |
_LMAAttribute.set_Value(value); |
|
2858 |
else if (_LMAAttribute.get_Value() != value) |
|
2859 |
_LMAAttribute.set_Value(value); |
|
2860 |
} |
|
2861 |
|
|
2862 |
_LMModelItem.Commit(); |
|
2863 |
} |
|
2864 |
if (_LMModelItem != null) |
|
2865 |
ReleaseCOMObjects(_LMModelItem); |
|
2866 |
} |
|
2867 |
catch (Exception ex) |
|
2868 |
{ |
|
2869 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2870 |
} |
|
2871 |
} |
|
2872 |
|
|
2873 |
void InputLineAttributeForSpecBreakLMConnector(LMConnector connector, string attrName, string value) |
|
2874 |
{ |
|
2875 |
try |
|
2876 |
{ |
|
2877 |
LMModelItem _LMModelItem = dataSource.GetModelItem(connector.ModelItemID); |
|
2878 |
if (_LMModelItem != null && _LMModelItem.get_ItemStatus() == "Active") |
|
2879 |
{ |
|
2880 |
LMAAttribute _LMAAttribute = _LMModelItem.Attributes[attrName]; |
|
2881 |
if (_LMAAttribute != null) |
|
2882 |
{ |
|
2883 |
if (DBNull.Value.Equals(_LMAAttribute.get_Value())) |
|
2884 |
_LMAAttribute.set_Value(value); |
|
2885 |
else if (_LMAAttribute.get_Value() != value) |
|
2886 |
_LMAAttribute.set_Value(value); |
|
2887 |
} |
|
2888 |
|
|
2889 |
_LMModelItem.Commit(); |
|
2890 |
} |
|
2891 |
if (_LMModelItem != null) |
|
2892 |
ReleaseCOMObjects(_LMModelItem); |
|
2893 |
} |
|
2894 |
catch (Exception ex) |
|
2895 |
{ |
|
2896 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
2897 |
} |
|
2898 |
} |
|
2899 |
#endregion |
|
2900 |
} |
|
2901 |
|
|
2902 |
/// <summary> |
|
2665 | 2903 |
/// Text Modeling - Association일 경우는 Text대신 해당 맵핑된 Symbol로 모델링 |
2666 | 2904 |
/// </summary> |
2667 | 2905 |
/// <param name="text"></param> |
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
138 | 138 |
Placement _placement = new Placement(); |
139 | 139 |
LMADataSource dataSource = new LMADataSource();//placement.PIDDataSource; |
140 | 140 |
|
141 |
string modelItemId = "76D079A9B3694A4AA46B46602729CE3F";
|
|
141 |
string modelItemId = "1D6CF009BFCB46BFA78ADEEBA09B2E07";
|
|
142 | 142 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemId); |
143 | 143 |
_LMAItem item = modelItem.AsLMAItem(); |
144 | 144 |
try |
145 | 145 |
{ |
146 |
string modelitemID = item.Id; |
|
147 |
_placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item); |
|
148 |
string afterModelItemID = item.Id; |
|
149 |
|
|
150 |
if (modelitemID != afterModelItemID) |
|
146 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
151 | 147 |
{ |
148 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
149 |
{ |
|
150 |
LMConnector _LMConnector = dataSource.GetConnector(rep.Id); |
|
152 | 151 |
|
152 |
|
|
153 |
} |
|
153 | 154 |
} |
154 |
item.Commit(); |
|
155 | 155 |
} |
156 | 156 |
catch (Exception ex) |
157 | 157 |
{ |
DTI_PID/SPPIDConverter/SPPIDModel/SPPID_Document.cs | ||
---|---|---|
414 | 414 |
return false; |
415 | 415 |
} |
416 | 416 |
|
417 |
foreach (var item in SpecBreaks) |
|
418 |
{ |
|
419 |
item.SPPID.MAPPINGNAME = @"\Piping\Segment Breaks\Piping Materials Class.sym"; |
|
420 |
} |
|
421 |
|
|
422 | 417 |
foreach (var item in LINENUMBERS) |
423 | 418 |
{ |
424 | 419 |
if (LineNumberMappings.Count > 0) |
내보내기 Unified diff