PropertyCount 属性 (ActiveX/CSP)
返回与错误或修补程序关联的属性数。 支持的平台:仅限 Windows 命名空间:AcStMgr (英语) 集会:AcStMgr.tlb 属性值只读:是的 类型:长 分配给错误或修复的属性数,用于检查和修复 CAD 标准。 言论没有其他评论。 发行信息释放:AutoCAD 2004 及更高版本
例子VB.NET: Public Sub PlugIn_Next() _ Implements IAcStPlugin2.Next m_pError = Nothing If m_ContextList.Count > 0 Then ' Check to see if there are objects to check ' << Change based on standards implementation >> If m_LayerCacheArray.Length() > 0 Then Dim bFoundError As Boolean ' Check to see if this is the last object to be checked If m_curIndex < m_ContextList.Count - 1 Then m_curIndex = m_curIndex + 1 bFoundError = False ' << Change based on standards implementation >> Dim layerObj As AcadLayer Dim iCache As Integer ' Iterate the objects to be checked While m_curIndex < m_ContextList.Count ' Get the ObjectId of the object to be checked layerObj = m_pCheckDatabase.ObjectIdToObject(m_ContextList.Item(m_curIndex)) ' Iterate through each of the standards objects and check for a match based on name For iCache = LBound(m_LayerCacheArray) To UBound(m_LayerCacheArray) ' Compare the names of the two layers If (layerObj.Name.CompareTo(m_LayerCacheArray(iCache).Name) <> 0) Then ' Check to see if the object is a macth, ' if not flag as possible error bFoundError = True Else bFoundError = False ' Layer names matched, compare color and linetype values If layerObj.color.ToString() <> m_LayerCacheArray(iCache).Color.ToString() Or _ layerObj.Lineweight.ToString() <> m_LayerCacheArray(iCache).Lineweight.ToString() Then bFoundError = True End If ' Exit For loop since a match by name was found Exit For End If Next ' No match or a property difference was found If bFoundError = True Then Dim pError As New AcStError() ' Assign a description to the error pError.Description = "Layer is non-standard" ' Assign an ObjectId to the error pError.BadObjectId = layerObj.ObjectID ' Assign the name of the object, plug-in, and error type pError.BadObjectName = layerObj.Name pError.Plugin = m_pPlugin pError.ErrorTypeName = "Layer " ' Assign a result status to the error pError.ResultStatus = AcStResultStatus.acStResFlagsNone ' Assign the object's property values to the error for checking If pError.PropertyCount = 0 Then pError.PropertyValuePut("Color", layerObj.color) pError.PropertyValuePut("Lineweight", layerObj.Lineweight) End If m_pError = pError bFoundError = False Exit While End If ' Increment the counter m_curIndex = m_curIndex + 1 End While End If End If End If End Sub C#: public void PlugIn_Next() { m_pError = null; if (m_ContextList.Count > 0) { AcadLayer layerObj = default(AcadLayer); int iCache = 0; bool bFoundError = false; // Check to see if there are objects to check // << Change based on standards implementation >> if (m_LayerCacheArray.Length > 0) { // Check to see if this is the last object to be checked if (m_curIndex < m_ContextList.Count - 1) { m_curIndex = m_curIndex + 1; bFoundError = false; // Iterate the objects to be checked while (m_curIndex < m_ContextList.Count) { // Get the ObjectId of the object to be checked layerObj = (AXDBLib.AcadLayer)m_pCheckDatabase.ObjectIdToObject((long)m_ContextList.GetItem(m_curIndex)); int nLBound = m_LayerCacheArray.GetLowerBound(0); int nUBound = m_LayerCacheArray.GetUpperBound(0); // Iterate through each of the standards objects and check for a match based on name for (iCache = nLBound; iCache <= nUBound; iCache++) { // Compare the names of the two layers if ((layerObj.Name.CompareTo(m_LayerCacheArray[iCache].Name) != 0)) { // Check to see if the object is a macth, // if not flag as possible error bFoundError = true; } else { bFoundError = false; // Layer names matched, compare color and linetype values if (layerObj.color.ToString() != m_LayerCacheArray[iCache].Color.ToString() | layerObj.Lineweight.ToString() != m_LayerCacheArray[iCache].Lineweight.ToString()) { bFoundError = true; } // Exit For loop since a match by name was found break; } } // No match or a property difference was found if (bFoundError == true) { AcStError pError = new AcStError(); // Assign a description to the error pError.Description = "Layer is non-standard"; // Assign an ObjectId to the error pError.BadObjectId = layerObj.ObjectID; // Assign the name of the object, plug-in, and error type pError.BadObjectName = layerObj.Name; pError.Plugin = m_pPlugin; pError.ErrorTypeName = "Layer "; // Assign a result status to the error pError.ResultStatus = AcStResultStatus.acStResFlagsNone; // Assign the object's property values to the error for checking if (pError.PropertyCount == 0) { pError.PropertyValuePut("Color", (ACAD_COLOR)layerObj.color); pError.PropertyValuePut("Lineweight", (ACAD_LWEIGHT)layerObj.Lineweight); } m_pError = pError; bFoundError = false; break; } // Increment the counter m_curIndex = m_curIndex + 1; } } } } } |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-16 00:06
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.