Gets the recommended fix object for the specified error.
Supported platforms: Windows only
Namespace: AcStMgr
Assembly: AcStMgr.tlb
VB.NET:
RetVal = object.GetRecommendedFix()
C#:
RetVal = object.GetRecommendedFix();
Type: AcStError object
The object this method applies to.
VB.NET:
Public Function GetRecommendedFix(pError) As AcStFix _ Implements IAcStPlugin2.GetRecommendedFix Return ... End Function
C#:
public AcStFix GetRecommendedFix(pError) { return ...; }
Type: IAcStPlugin2 interface
The interface this method applies to.
Access: Input-only
Type: AcStError object
The error object for which you want to get the recommended fix.
Type: AcStFix object
The fix object that represents the recommended fix for the error object.
No additional remarks.
Releases: AutoCAD 2004 and later
VB.NET:
Not available
C#:
Not available
VB.NET:
Public Function GetRecommendedFix(ByVal pError As AcStError) As AcStFix _ Implements IAcStPlugin2.GetRecommendedFix Dim pRecommendedFix As New AcStFix() ' << Change based on standards implementation >> If m_LayerCacheArray.Length = 0 Then pError.ResultStatus = AcStResultStatus.acStResNoRecommendedFix pRecommendedFix = Nothing Else ' Get the ObjectId of the error object and the associated layer object Dim tmpObjID As Long = pError.BadObjectId() Dim tmpLayer As AcadLayer = m_pCheckDatabase.ObjectIdToObject(tmpObjID) ' Get the name of the layer Dim nameToBeChecked As String = tmpLayer.Name tmpLayer = Nothing Dim layCache As LayerCache = m_LayerCacheArray(0) m_RecommendedFixIndex = -1 ' Attempt to get the recommended fix from the cached array by matching layer names Dim i As Integer For i = 0 To UBound(m_LayerCacheArray) If m_LayerCacheArray(i).Name = nameToBeChecked Then layCache = m_LayerCacheArray(i) m_RecommendedFixIndex = i ' Exit the For loop after a match is found Exit For End If Next ' Validate if a recommended fix was found If m_RecommendedFixIndex <> -1 Then ' Populate the properties for the recommended fix object pRecommendedFix.Description = "Layer fix" pRecommendedFix.StandardFileName = m_LayerCacheArray( _ m_RecommendedFixIndex).StandardFileName pRecommendedFix.FixObjectName = m_LayerCacheArray( _ m_RecommendedFixIndex).Name If pRecommendedFix.PropertyCount = 0 Then pRecommendedFix.PropertyValuePut("Color", m_LayerCacheArray( _ m_RecommendedFixIndex).Color) pRecommendedFix.PropertyValuePut("Lineweight", m_LayerCacheArray( _ m_RecommendedFixIndex).Lineweight) End If Else pRecommendedFix = Nothing End If End If GetRecommendedFix = pRecommendedFix End Function
C#:
public AcStFix GetRecommendedFix(AcStError pError) { AcStFix pRecommendedFix = new AcStFix(); // << Change based on standards implementation >> if (m_LayerCacheArray.Length == 0) { pError.ResultStatus = AcStResultStatus.acStResNoRecommendedFix; pRecommendedFix = null; } else { // Get the ObjectId of the error object and the associated layer object long tmpObjID = pError.BadObjectId; AcadLayer tmpLayer = (AcadLayer)m_pCheckDatabase.ObjectIdToObject(tmpObjID); // Get the name of the layer string nameToBeChecked = tmpLayer.Name; tmpLayer = null; AdskLayersPlugin.StandardsHelpers.LayerCache oLayCache = m_LayerCacheArray[0]; m_RecommendedFixIndex = -1; int nLBound = m_LayerCacheArray.GetLowerBound(0); int nUBound = m_LayerCacheArray.GetUpperBound(0); // Attempt to get the recommended fix from the cached array by matching layer names for (int i = nLBound; i <= nUBound; i++) { if (m_LayerCacheArray[i].Name == nameToBeChecked) { oLayCache = m_LayerCacheArray[i]; m_RecommendedFixIndex = i; // Exit the For loop after a match is found break; } } // Validate if a recommended fix was found if (m_RecommendedFixIndex != -1) { // Populate the properties for the recommended fix object pRecommendedFix.Description = "Layer fix"; pRecommendedFix.StandardFileName = m_LayerCacheArray[m_RecommendedFixIndex].StandardFileName; pRecommendedFix.FixObjectName = m_LayerCacheArray[m_RecommendedFixIndex].Name; pRecommendedFix.FixObjectId = m_LayerCacheArray[m_RecommendedFixIndex].ObjectId; if (pRecommendedFix.PropertyCount == 0) { pRecommendedFix.PropertyValuePut("Color", (ACAD_COLOR)m_LayerCacheArray[m_RecommendedFixIndex].Color); pRecommendedFix.PropertyValuePut("Lineweight", (ACAD_LWEIGHT)m_LayerCacheArray[m_RecommendedFixIndex].Lineweight); } } else { pRecommendedFix = null; } } return pRecommendedFix; }