Altium Designer SDK 빠른 시작 가이드

개요

이 단계별 SDK 가이드를 따라 첫 번째 Custom Altium Designer 확장 기능을 만들어 보세요. 개발 도구 설정과 C# 프로젝트 생성부터 Schematic 또는 프로젝트의 Net 이름을 표시하는 명령 추가 및 실행까지 전 과정을 안내합니다. 핫 리로드를 지원하는 명령줄 템플릿 옵션도 소개합니다. Altium Designer의 기능을 확장하는 첫걸음을 시작해 보세요.

- SDK 확장 기능 개발에 필요한 사전 요구 사항과 설정 단계를 알아봅니다.
- Altium Designer 내에서 “Net 표시” 명령을 구현하고 등록한 후 실행하는 방법을 배웁니다.
- 다음 확장 기능 개발에 활용할 명령줄 템플릿과 참고 자료를 찾아봅니다.
AI로 더 깊이 알아보기:

Altium Designer SDK는 현재 비공개 베타 단계이며, 선정된 소수의 얼리 액세스 고객에게만 제공됩니다.

Altium Designer SDK를 사용하면 Altium Designer에 직접 통합되는 사용자 지정 확장 기능을 개발할 수 있습니다. 관리형 .NET API를 통해 명령을 추가하고, 워크플로를 자동화하고, 설계 데이터에 액세스할 수 있습니다.

이 가이드에서는 개발 도구 설치, 확장 기능 프로젝트 생성, 명령 추가, Altium Designer 내 실행 과정을 안내합니다.

Prefer the command line? Altium Designer Extension Template을 사용하면 앱 내 마법사나 Visual Studio 없이도 명령 하나가 포함된 완전한 C# 확장 기능을 생성할 수 있습니다. hot-reloads your code while Altium Designer keeps running.

dotnet new install Altium.Designer.Extension.Templates
dotnet new ad-extension -n MyTools --altium-system-dir "C:\Program Files\Altium\AD26\System"

Altium Designer 24 이상 및 .NET SDK 8 이상이 필요합니다(Altium Designer 26.12 이상에서는 .NET SDK 10 필요). 아래 Step 3의 명령 코드는 템플릿 기반 프로젝트에서도 동일하게 작동합니다.

사전 요구 사항

1단계: Altium Developer 확장 기능 설치

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 Version: latest

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

여기서 사용되는 형식(IProject, IDocument 및 DXP.GlobalVars )은 Altium Designer SDK 참조 문서에 설명되어 있습니다.

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. 명령을 클릭하면 Net 목록이 있는 대화 상자가 나타납니다.

다음 단계

  • Altium Designer SDK 참조 문서에서 SCH, PCB, EDP, DXP, ComponentLib 및 Embedded 네임스페이스의 전체 .NET API를 살펴보세요.

  • API 규칙을 읽고 진입점, GetState/SetState 메서드 및 열거형이 어떻게 구성되어 있는지 알아보세요.

  • Altium Designer Extension Template으로 다음 확장 기능 개발을 시작하고, Altium Designer 실행 중에 핫 리로드를 활용하세요.

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