CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

StandardFileName Property (ActiveX/CSP)

2023-1-2 19:30| 发布者: admin| 查看: 151| 评论: 0|来自: AutoCAD

摘要: 指定存储修补程序对象的标准文件的名称。

指定存储修补程序对象的标准文件的名称。

支持的平台:仅窗口

Namespace:AcStMgr

集会:AcStMgr.tlb

签名

VB.NET:

object.StandardFileName

C#:

object.StandardFileName;
对象

类型:AcStFix对象

此属性适用的对象。

属性值

只读:

类型:字符串

存储修复对象的标准文件的绝对文件路径。

言论

没有额外的评论。

发布信息

释放:AutoCAD 2004 及更高版本

  • AcStMgr.tlb- AutoCAD 2004 及更高版本

例子

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
            pRecommendedFix.FixObjectId = m_LayerCacheArray( _
                                               m_RecommendedFixIndex).ObjectId

            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;
}

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-11 17:55

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部