KB: Altium API의 최신 변경 사항을 수용하도록 스크립트를 수정하세요

Altium Designer Altium Designer
Altium Designer API가 지속적으로 업데이트되면서 스크립팅 시스템 인터페이스와 그 메소드 및 속성도 변경되었습니다. 따라서 일부 레거시 스크립트 예제는 원래 의도한 대로 작동하지 않을 수 있으며, 최신 Altium Designer에서 작동하도록 일부 수정이 필요할 수 있습니다.

Solution Details

For many questions & issues, posting on our community forum to see if another user has written a script for a similar function or had a similar issue may get a favorable response:
https://forum.live.altium.com/#/search?searchText=script
Please understand that creating and reviewing your own scripts is outside the scope of our technical support.
 
Upfront, there are few known changes that need to be made to accommodate progressive updates to the Altium Designer API:
• In some variable assignments, you need to prepend set\get to avoid the error "Object doesn't support this property or method".
• It is only starting in AD19 that unlimited number of mechanical layers is supported, such that constants prescribed prior are defined only in the fixed range of [eMechanical1..eMechanical16].

Variable Assignments
You need to prepend set\get to avoid the error such as below.
image.png

e.g.
error: Param = SchServer.SchObjectFactory(eParameter, eCreate_Default)
no error: Set Param = SchServer.SchObjectFactory(eParameter, eCreate_Default)

Constant Definition
It is only starting in AD19 that unlimited number of mechanical layers is supported, such that constants prescribed prior are defined only in the fixed range of [eMechanical1..eMechanical16]
A newer, more robust way to access mechanical layer would be as depicted in the following code snippet.

for LayerType := 1 to N do    
-  begin        
   LyrMech := Stack.LayerObject[PCBServer.LayerUtils.MechanicalLayer(LayerType)];        
   LayerName := Board.LayerName(PCBServer.LayerUtils.MechanicalLayer(LayerType));   
   end;
   end;

Script Language supported:
For the foreseeable future, Altium continues to support the use of different kinds of scripting languages.  Delphi is recommended, as this is a language for which no additional resources need to be installed on a computer to run it.  Since Version AD18 the support for JavaScript, VisualBasic Script, EnableBasic Script and TCL needs to be enabled in the Preferences » System » General » Advanced section of Altium Designer.  Check the box under the Value column for the Preference Name Legacy.Scripts.SupportOldLanguages.

List of Additional Documentation Related to Scripting:
Automating Design Tasks with Scripting
   (notice there are sub-pages in the left pane)
Overview & Setup of the Scripting System
Scripting Examples Reference
Automating Design Tasks with Scripting
Altium Scripting And Using The API
gbmhunter / AltiumScriptCentral
Altium-Designer-addons / scripts-libraries
Writing Scripts
Using ChatGPT for Altium Scripting

Managed Scripts:
Script

Participating in SDK Beta Program:
In contrast to scripting, SDK can be used for larger projects, where Vector manipulation, dictionary, maps, sort, select and group algorithms are needed. Therefore a compiler needs to be installed.  For companies that want to create their own applications, if qualified, we may provide the Altium Software Development Kit (SDK) in the current beta version free of charge.  The technical exchange and questions about the Altium Developer will take place exclusively via the forum provided at that time.

Information and the possibility to request this extension can be found on the following websites:
ALTIUM DXP DEVELOPER  (You can begin a participation form from the bottom of this page.)
An Overview of the Altium SDK
Altium Designer SDK (Beta)

 

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.