Altium Designer SDK 빠른 시작 가이드

Altium Designer SDK를 사용하면 Altium Designer에 직접 통합되는 사용자 지정 확장을 빌드할 수 있으며, 이를 통해 명령 추가, 워크플로 자동화, 관리형 .NET API를 통한 설계 데이터 접근이 가능합니다.

이 가이드에서는 개발 도구 설치, 확장 프로젝트 생성, 명령 추가, 그리고 Altium Designer 내부에서 이를 실행하는 방법을 단계별로 안내합니다.

사전 요구 사항

1단계: Altium Developer Extension 설치

Altium Developer 확장은 프로젝트 템플릿과 SDK 도구를 Altium Designer에 직접 추가합니다.

  1. Altium Designer에서 Extensions and Updates → Available(으)로 이동합니다.

  2. Software Extensions 섹션에서 Altium Developer을(를) 검색합니다.

  3. 확장을 설치한 다음, 메시지가 표시되면 Altium Designer를 다시 시작합니다.

2단계: 새 확장 프로젝트 만들기

  1. Altium Designer에서 File → New → Other → Extension(으)로 이동합니다.

    • Extension ID: ShowNetsExtension

    • Extension Kind: Altium Designer Server

    • Development Language: C#

    • IDE Version: latest

    • SDK Versionlatest

  2. 확장이 생성되면 Altium Designer에 해당 세부 정보가 표시됩니다. Source Location 를 확인한 다음, 해당 경로에 있는 .csproj 파일을 IDE에서 엽니다.

3단계: 첫 번째 명령 추가

Source Code\Commands.cs을(를) 열고 다음 메서드를 Commands 클래스에 추가합니다.

    /// <summary>
    /// Determines the enabled/visible state for the "Show Nets" command in Altium Designer.
    /// </summary>
    /// <param name="argContext">The current server document view context.</param>
    /// <param name="argParameters">Command parameters (unused).</param>
    /// <param name="argEnabled">Set to true if the command should be enabled.</param>
    /// <param name="argChecked">Set to true if the command should appear checked (unused).</param>
    /// <param name="argVisible">Set to true if the command should be visible (unused).</param>
    /// <param name="argCaption">Command caption (unused).</param>
    /// <param name="argImageFile">Command image file (unused).</param>
    public static void GetState_ShowNets(IServerDocumentView argContext, ref string argParameters, ref bool argEnabled,
        ref bool argChecked, ref bool argVisible, ref string argCaption, ref string argImageFile)
    {
        // Retrieve the currently focused project from Altium Designer's workspace.
        var project = DXP.GlobalVars.DXPWorkSpace.DM_FocusedProject() as IProject;

        // If the project needs to be compiled (e.g., netlist out of date), compile it.
        if (project?.DM_NeedsCompile() == true)
            project.DM_Compile();

        // Enable the command only if a valid project is focused and it's not the "Free Documents" project.
        argEnabled = project != null && !IsFreeDocumentsProject(project);
    }

    /// <summary>
    /// Command handler to display all net names in the current schematic document or project.
    /// </summary>
    /// <param name="view">The current server document view.</param>
    /// <param name="parameters">Command parameters (unused).</param>
    public static void Command_ShowNets(IServerDocumentView view, ref string parameters)
    {
        // Get the currently focused project from Altium Designer.
        var project = DXP.GlobalVars.DXPWorkSpace.DM_FocusedProject() as IProject;
        if (project == null || IsFreeDocumentsProject(project))
            return;

        string documentName;
        // Get the currently focused document (e.g., schematic sheet).
        var document = DXP.GlobalVars.DXPWorkSpace.DM_FocusedDocument() as IDocument;
        if (document == null)
        {
            // If no document is focused, ensure the project is compiled and use the flattened project document.
            if (project.DM_NeedsCompile()) project.DM_Compile();
            document = project.DM_DocumentFlattened();
            documentName = "Project";
        }
        else
        {
            // Only proceed if the focused document is a schematic (DocKindSch).
            if (document.DM_DocumentKind() != EDPConstant.DocKindSch) return;
            documentName = document.DM_FileName();
        }

        // Enumerate all nets in the document, retrieve their full names, and sort them alphabetically.
        var netNames = Enumerable.Range(0, document.DM_NetCount())
            .Select(document.DM_Nets)
            .Select(net => net.DM_FullNetName())
            .OrderBy(name => name);

        // Display the list of net names in an information dialog within Altium Designer.
        DXP.Utils.ShowInfo(string.Join(Environment.NewLine, netNames), $"Nets [{documentName}]");
    }

    /// <summary>
    /// Checks if the given project is the special "Free Documents" project in Altium Designer.
    /// </summary>
    /// <param name="project">The project to check.</param>
    /// <returns>True if the project is the Free Documents project; otherwise, false.</returns>
    private static bool IsFreeDocumentsProject(IProject project)
    {
        return project == DXP.GlobalVars.DXPWorkSpace.DM_FreeDocumentsProject();
    }

Source Code\Main.cs 을(를) 열고 PluginServerModule 클래스에 명령을 등록합니다.

protected override void InitializeCommands()
{
    ((CommandLauncher)CommandLauncher).RegisterCommand("ShowNets", Commands.Command_ShowNets, Commands.GetState_ShowNets);
}

프로젝트를 빌드하여 확장을 설치합니다.

4단계: Altium Designer에서 명령 실행

  1. Altium Designer를 시작합니다.

  2. 아무 도구 모음이나 마우스 오른쪽 버튼으로 클릭한 다음 Customize…

  3. 을(를) 선택합니다. Commands에서 New… 을(를) 클릭하고 다음과 같이 구성합니다.

    • Process: ShowNetsExtension:ShowNets

    • Caption: ShowNets

  4. 새 명령을 도구 모음으로 드래그합니다.

  5. 명령을 클릭하면 넷 목록이 포함된 대화상자가 나타나야 합니다.

다음 단계

  • 회로도, PCB 레이아웃, 부품 등과 관련된 인터페이스는 Altium Designer SDK 문서를 참조하세요.

  • AltiumDeveloper GitHub 조직에서 예제 확장과 데모를 살펴보세요.

AI-LocalizedAI로 번역됨
만약 문제가 있으시다면, 텍스트/이미지를 선택하신 상태에서 Ctrl + Enter를 누르셔서 저희에게 피드백을 보내주세요.
콘텐츠