修正オブジェクトのプロパティ値をエラー オブジェクトの同じプロパティに適用します。
サポートされているプラットフォーム: Windows のみ
名前空間: AcStMgr
アセンブリ: AcStMgr.tlb
VB.NET:
Public Sub FixError(pError, pFix[, pFailedReason]) _ Implements IAcStPlugin2.FixError ... End Sub
C#:
public void FixError(pError, pFix[, out pFailedReason]) { ...; }
タイプ: AcStErrorIterator オブジェクト
このメソッドが適用されるオブジェクト。
アクセス: 入力のみ
タイプ: AcStError オブジェクト
設定された CAD 標準仕様と一致しないエラー オブジェクト。
アクセス: 入力のみ
タイプ: AcStFix オブジェクト
エラー オブジェクトのプロパティの修正に使用される修正オブジェクト。
アクセス: 出力のみ
タイプ: 文字列
修正に失敗した理由を表すエラー値。返される値は、 AcStResultStatus 列挙の値のいずれかと一致する必要があります。
既定の戻り値は 0 です。
戻り値はありません。
追加の注意はありません。
バージョン: AutoCAD 2004 以降
VB.NET:
Public Sub FixError(ByVal pError As AcStError, _ ByVal pFix As AcStFix, _ Optional ByRef pFailedReason As String = "0") _ Implements IAcStPlugin2.FixError ' << Change based on standards implementation >> If IsNothing(pError) = False Then Dim sFixClrVal As ACAD_COLOR Dim sFixLWVal As ACAD_COLOR ' Get the drawing object to fix Dim badObjID As Long = pError.BadObjectId Dim badObj As AcadLayer = m_pCheckDatabase.ObjectIdToObject(badObjID) ' If no fix is provided, try the recommended fix If IsNothing(pFix) Then Dim tmpFix As New AcStFix() tmpFix = GetRecommendedFix(pError) If IsNothing(tmpFix) Then ' Set the result status of the error to Failed and No Recommended Fix pError.ResultStatus = AcStResultStatus.acStResFixFailed + AcStResultStatus.acStResNoRecommendedFix Else ' Fix the bad object pFix = tmpFix tmpFix = Nothing ' Fix the color of the layer pFix.PropertyValueGet("Color", sFixClrVal) Try badObj.color = sFixClrVal pError.ResultStatus = AcStResultStatus.acStResFixed Catch m_ex As Exception pError.ResultStatus = AcStResultStatus.acStResFixFailed End Try ' Fix the Lineweight of the layer pFix.PropertyValueGet("Lineweight", sFixLWVal) Try badObj.Lineweight = sFixLWVal pError.ResultStatus = AcStResultStatus.acStResFixed Catch m_ex As Exception pError.ResultStatus = AcStResultStatus.acStResFixFailed End Try End If tmpFix = Nothing Else ' Fix the color of the layer pFix.PropertyValueGet("Color", sFixClrVal) Try badObj.color = sFixClrVal pError.ResultStatus = AcStResultStatus.acStResFixed Catch m_ex As Exception pError.ResultStatus = AcStResultStatus.acStResFixFailed End Try ' Fix the Lineweight of the layer pFix.PropertyValueGet("Lineweight", sFixLWVal) Try badObj.Lineweight = sFixLWVal pError.ResultStatus = AcStResultStatus.acStResFixed Catch m_ex As Exception pError.ResultStatus = AcStResultStatus.acStResFixFailed End Try End If End If End Sub
C#:
public void FixError(AcStError pError, AcStFix pFix, out string pFailedReason) { // << Change based on standards implementation >> if ((pError == null) == false) { object sFixClrVal = default(ACAD_COLOR); object sFixLWVal = default(ACAD_LWEIGHT); // Get the drawing object to fix long badObjID = pError.BadObjectId; AcadLayer badObj = (AcadLayer)m_pCheckDatabase.ObjectIdToObject(badObjID); // If no fix is provided, try the recommended fix if (pFix == null) { AcStFix tmpFix = new AcStFix(); tmpFix = GetRecommendedFix(pError); if (tmpFix == null) { // Set the result status of the error to Failed and No Recommended Fix pError.ResultStatus = AcStResultStatus.acStResFixFailed | AcStResultStatus.acStResNoRecommendedFix; } else { // Fix the bad object pFix = tmpFix; tmpFix = null; // Fix the color of the layer pFix.PropertyValueGet("Color", ref sFixClrVal); try { badObj.color = (AcColor)sFixClrVal; pError.ResultStatus = AcStResultStatus.acStResFixed; } catch (Exception m_ex) { pError.ResultStatus = AcStResultStatus.acStResFixFailed; } // Fix the Lineweight of the layer pFix.PropertyValueGet("Lineweight", ref sFixLWVal); try { badObj.Lineweight = (ACAD_LWEIGHT)sFixLWVal; pError.ResultStatus = AcStResultStatus.acStResFixed; } catch (Exception m_ex) { pError.ResultStatus = AcStResultStatus.acStResFixFailed; } } } else { // Fix the color of the layer pFix.PropertyValueGet("Color", ref sFixClrVal); try { badObj.color = (AcColor)sFixClrVal; pError.ResultStatus = AcStResultStatus.acStResFixed; } catch (Exception m_ex) { pError.ResultStatus = AcStResultStatus.acStResFixFailed; } // Fix the Lineweight of the layer pFix.PropertyValueGet("Lineweight", ref sFixLWVal); try { badObj.Lineweight = (ACAD_LWEIGHT)sFixLWVal; pError.ResultStatus = AcStResultStatus.acStResFixed; } catch (Exception m_ex) { pError.ResultStatus = AcStResultStatus.acStResFixFailed; } } } pFailedReason = "0"; }