获取指定错误的建议修复对象。 支持的平台:仅窗口 Namespace:AcStMgr 集会:AcStMgr.tlb 签名 - AcStError 对象VB.NET: RetVal = object.GetRecommendedFix() C#: RetVal = object.GetRecommendedFix();
签名 - IAcStPlugin2 接口VB.NET: Public Function GetRecommendedFix(pError) As AcStFix _
Implements IAcStPlugin2.GetRecommendedFix
Return ...
End Function
C#: public AcStFix GetRecommendedFix(pError)
{
return ...;
}
言论没有额外的评论。 发布信息释放:AutoCAD 2004 及更高版本
示例 - AcStError 对象VB.NET: Not available C#: Not available Examples - IAcStPlugin2 interfaceVB.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;
}
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 06:06
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.