betafullpac

Altium Script Examples

Altium Script Examples Average ratng: 3,0/5 1149 votes

Below are tips and code examples to write your own Altium scripts. I prefer VBScript (which to me personally was one of the easiest to grasp coming from a C/C++/C# background, and seems to be one of the widely supported languages), however most are written in Delphi Script. Altium TechDocs are online documentation for Altium products, providing the basic information you need to get the most out of our tools. Discover features you didn't. Script Examples Gallery Reference. This Script Examples Gallery Reference covers the script examples in the Examples Scripts folder of your Altium Designer installation.

Script Filename Description IniFileEg This script demonstrates the use of TIniFile object and the Read/Write methods. Mandelbrot This script demonstrates the use of graphics to build a Mandelbrot set on a script form.

MM This script demonstrates the use of TMediaPlayer component. The Protel.avi file is needed for this MM script. ShowModalEg This script demonstrates the use of ShowModal property for the script form.

SineWave This script demonstrates how to generate and plot a sine wave on a script form. TextFileConvert The input.txt file is provided for demo purposes. TicTac A Tic Tac Toe game! UpdateTime This script demonstrates the use of TTimer component and the Time function. DelphiScript Scripts General HelloWorld.PRJSCR.

Script Filename Description ClientServerInterfacesReport This script demonstrates how to use Client interfaces and retrieves information on server installation files, window kinds, commands and panels. ExtractFilesFromIntLibs This script demonstrates how to extract source library files from integrated library files with an INTLIB extension. IntLibSearchDemo This script demonstrates how to find footprints and 3d models in integrated library files and in PCBLIB files. OpenADoc This script demonstrates how to open a text document using Client's OpenDocument method. ReportIntLibData This script demonstrates use of Integrated Library Manager and Model Type Manager interfaces to extract data associated with each interface.

ReportPCBViews This script reports all opened PCB documents and its views in DXP. ServerProcessReport This script demonstrates how to generate a report for all installed servers' processes in DXP. SettingDocumentDirty This script demonstrates how to set a document dirty, so it gets saved when Save command is invoked. DelphiScript Scripts DXP DXPVersion.PrjScr.

Script Filename Description CountConnectionLines This script demonstrates how to count connection lines (unrouted tracks) on a PCB document and displays the results on the Messages panel. CreateAVia This script demonstrates how to create a new Via object on a PCB document. CreateComponentOnPCB This script demonstrates how to create a new component on a PCB document. CreateFootprintInLibrary This script demonstrates how to create a new footprint on a Library document. CreatePCBObjects This script has various functions to create different PCB objects on a PCB document. This script uses the SendMessageToRobots method to send PCB messages CreateRules This script demonstrates how to create two different rules - maximum - minimum width rule and a room definition rule (confinement constraint). CyclePcbCursorType This script cycles through available cursor types on a PCB document.

DeletePCBObjects This script demonstrates how to delete PCB Objects and update the Undo System properly. EmbeddedObjects This script demonstrates the use of embedded objects; that is, creates and fetches these embedded objects on a current PCB document. NetObjectAssign This script demonstrates how to assign a net property to a new object that has been placed on a PCB document.

PadViaCacheProperties This script demonstrates the use of TPadCache record and GetObjectAtCursor method for Pad and Via Objects. Load PadViaExamples.PcbDoc from the Examples Scripts DelphiScript Scripts PCB folder of your Altium Designer installation before running the script. PadStackInfo This script demonstrates how to fetch different pad stack information on a PCB document. QueryBoard This script queries the current PCB document for board settings information.

Undo This script demonstrates the PCB's Undo system. Two procedures to demonstrate how the Undo system works - as one large Undo or multiple smaller Undos. DelphiScript Scripts PCB BoardOutline Copier CopyBoardOutline.PrjScr.

Script Filename Description MillExporter A Project file. Export a PCB design into a format that can be milled by a CNC Milling machine. Currently only Roland RML milling language is supported. MillExporter This unit converts a Board Outline of the PCB document to a polygon so that data can be generated for the PCB document and be milled by a CNC milling machine. MMExportDlg This unit controls the settings for exporting a PCB document to be routed on a milling machine. MMSetup Setup the default values for a milling machine to be used by MillExporter in an INI text file. Delphiscript Scripts PCB PCBClassGenerator.PrjScr.

Altium Script Examples

Script Filename Description v Countpads This script counts the number of pads on a current PCB document. CountTracksInComponent This script counts tracks of five different components on a current PCB document. IterateComponentBodies This script fetches component bodies from the current PCB document. IterateNets This script demonstrates how to iterate for Nets of the current PCB document. IteratePolygons This script iterates Polygons from the current PCB document. IterateRegions This script iterates regions from the current PCB document. LibraryIterator This script demonstrates the use of the library iterator and displays the number of child objects (primitives of a footprint) for each footprint found in a PCB library SpatialIterator This script demonstrates the use of ChooseRectangleByCorners method and the spatial iterator.

Selects free primitives only on the focused PCB. DelphiScript Scripts PCB PCB Layers PCBLayers.PrjScr. Script Filename Description LayersInfo This script fetches Layers information for the layer stack of the PCB. QueryLayerPairs This script queries the current PCB document for PCB Layer pairs. QueryLayersOfMechType This script queries the current PCB document for mechanical layers. QueryLayerStack This script queries the Layer Stack of the current PCB document. QueryMechLayers This script queries mechanical layers of the current PCB document.

QueryUsedLayers This script queries the current PCB document for layers that are used. RebuildInternalAndSplitPlanes This script forces a rebuild of the internal and split planes for the PCB. ToggleConnectlayerdisplay The script toggles the visibility of the connect layer on the current PCB. ValidateLayerStack This script validates the layer stack and reports a warning if the stack is invalid. DelphiScript Scripts PCB PCB Logo Creator PCBLogoCreator.PrjScr. Script Filename Description AddModelToComponentScript This script demonstrates on how to add a simulation model to a 555 component. This is done by adding a 555.ckt file to this component.

CountPorts This script uses an iterator to count ports CreateComponentonSch This script demonstrates how to place a component on a schematic document. CreateSchObjects This script creates Schematic Objects two ways; 1/ the first procedure places two ports and only one undo will remove both 2/ the second procedure places two ports and need two undos to remove both. This script uses the RobotManager interface to send schematic messages. DeleteSchObjects The script demonstrates how to delete Schematic Objects and Updating the Undo System by using the RobotManager interface to send schematic messages.

FetchParameters This script has two procedures. The first procedure fetches system parameters (document parameters) and the second one how to fetch parameters of a component. IterateSchSheets This script shows how to fetch open schematic sheet handles in Altium Designer. ModelsOfaComponent This script obtains models for each component on a schematic document and generate a report with a list of components and their associated (linked) models. ModifySchObjects This script shows how to fetch and modify Schematic Objects and update the undo system by using the RobotManager interface to send schematic messages.

MoveParameters This script shows how to move parameters graphically of a parent object such as a component using the Location property and its get/set methods. ParentChildIterators This script uses an iterator to look for sheet symbols and then within each sheet symbol, use the sheet symbol's iterator to look for sheet entries. PlaceAPort This simple script shows how to place a new port object on a Schematic sheet. PlaceSchObjects This simple script places different objects on a schematic sheet. ReplaceSchObjects This script replaces cross sheet connectors with port objects and transferring net information automatically. SchDocsRenamer This script utilises the FileCopy function from Windows unit in Borland Delphi to copy existing files with different filenames. SimModelsOfComponents This script fetches Simulation models and their relevant parameters for each component and then generate a text report on these models and parameters.

UndoRedo This script demonstrates how to use the Undo system when a schematic document is being modified. UsingaSpatialIterator This script demonstrates the use of a spatial iterator to conduct a search within a defined region.

UsingSchInterfaces This script demonstrates the Schematic interfaces. UsingWSMInterfaces This script demonstrates the WorkSpace Manager interfaces. DelphiScript Scripts SCH SchLibScripts.Prjscr.

Script Filename Description CheckPins This script checks for valid pins of symbols in a library. CreateCompinLib This script demonstrates how to create a new symbol in the library. CompLibReader This script uses the CreateLibCompInfoReader method to extract component data of a specified Schematic Library. LibIterator This script shows how to iterate through a schematic library and fetch symbols.

ParametersOfSymbolsInALibrary This script shows how to fetch parameters of symbols in a schematic library using an iterator. SymbolPrimsIterator This script shows how to fetch primitives of a symbol. DelphiScript Scripts SCH Circad Translator Sch Translator.PrjScr. Script Filename Description ImportPinsForm The ImportPinsForm is the main form. You need a CSV file that contains data for pins to import and create new Pins onto a SchLib document. To use the script: 1/ Execute the ImportPins procedure and the Pins Importer dialog appears.

2/ Click on browse button to load in the CSV file of schematic pins data. 3/ Click on the Update Mapping button to refresh the links between text fields and pin properties, then click on Import button to generate a list of different pins on a Sch library page. ChangeMappingForm Change Mapping Dialog to map fields from a CSV text file. This script is used by the main Import Pin dialog ConvUtils This script has the Conversion of Schematic Types To Strings and Vice Versa routines PinData.CSV This file contains pin information which is used for the ImportPins script. DelphiScript Scripts SCH UpdateFootprintLocations FootprintPathUpdater.PrjScr. Script Filename Description UpdateFootprintPathsOfComps A Schematic Component has a Footprint (PCB Model) property and its Library Path property.

There are situations when components have the same footprint name but come from different libraries. This script allows you to choose a footprint name from the currently open schematic and then choose one of available footprint locations. The locations are based on existing components footprint' locations. Then when dialog is closed, all the components that have the same footprint name have their locations updated with the specified location. Make sure you have libraries installed for the Schematic Components so that footprint library locations (paths) can appear. DelphiScript Scripts SCH UserDefinedParameters UserDefinedCompParameters.PrjScr. Script Filename Description Clrins1 This script demonstrates how to delete objects within an area defined by user.

Clrins2 This script demonstrates how to delete objects within an area defined by user. But the user is prompted before objects are cleared.

CirWiz This script form generates a simple filter circuit and place on a schematic sheet. PCBColor This script demonstrates how to change PCB Colors for a PCB document using the SetupPreferences process. PCBLayer This script demonstrates how to toggle the visibility of PCB Layers using the DocumentPreference process. PlacePCBPolygon This script places a new PCB polygon object on a PCB document using the PlacePolygonPlane process. PlaceSchPort This script places a new Schematic Port object on a Schematic document using the PlacePort process. PublishToPDFScript This script publishes from a current project's OutJob document to a PDF and bypasses the Publish to PDF Settings dialog.

QuikCopy This script demonstrates how to select objects, then copy and paste them using ToggleSelection, Deselect, Paste and Copy processes. RunCommonDialog This script demonstrates how to invoke the Client module's Common dialog and to fetch parameters. ShowNetlist This script demonstrates how easy it is to generate a report using WorkspaceManager's GenerateReport process. SimpleExample This script demonstrates the use of AddIntegerParameter and GetIntegerParameter functions. Workspace Manager Scripts DelphiScript Scripts WSM WSMScripts.PrjScr.

Script Filename Description AddDocToProject This script demonstrates how to insert a schematic sheet in a new PCB Project. There needs to be a sheet1.schdoc file in C: folder first. Netlister This script demonstrates how to generate a specific PackingList format file for a Schematic project ProjectReporter This script finds currently open projects including Free projects in DXP. A free project is a group of documents that are not related to any project. UsingMessagePanel This script demonstrates how to insert text messages in the Message Panel in Altium Designer. This is a useful debugging tool.

DelphiScript Scripts WSM ProtelNetlister ScripterProtelNetlist.PrjScr. Script Filename Description ScripterProtelNetlist This script demonstrates the use of WorkSpace Manager interfaces to generate a Protel Netlist.

The Netlist file is generated in Generated folder for the current Project on the Projects Panel. To run this script, you need to have the ScripterProtelNetlist.PRJSCR project opened, then call Run script command from the DXP System menu and select the ScripterProtelNetlist.pas file from the Select Item to Run dialog. The script will then generate a netlist for the current project, so make sure you have that project focused before you run the script. EnableBasic Script Examples The script examples are in Examples Scripts EnableBasic folder. The EnableBasic scripts have a.bas extension. Script Filename Description CirWiz The script demonstrates the use of processes in placing/connecting parts together.

Clrins1 Delete objects within an area defined by user. Clrins2 Delete objects within an area defined by user.

Confirm before deleting. PcbColor This script demonstrates the use of processes in changing PCB Colors. PcbLayer This script demonstrates the use of processes in changing PCB Layers. PlaceSchPort Place Schematic Port Object with the PlacePort process. Quikcopy This script demonstrates how to select objects and then Copy and Paste. JScript Script Examples The script examples are in the Examples Scripts JScript Scripts folder.

The JScript scripts have a.js extension. Script Filename Description AddDocToProject This script demonstrates how to insert a sheet in a PCB Project. There needs to be a sheet1.schdoc file in C: folder first. BuiltInFunctions This script demonstrates how to use built in date and math objects and display the results using the ShowMessage function. CopyBoardOutlineForm This script copies the board outline as tracks and arcs onto specified layer. GetScriptEngineInfo Retrieves the Microsoft Scripting Engine version number. HelloWorld A simple hello world - an introduction to JScript language.

ParentChildIterators This script uses an iterator to look for sheet symbols and then within each sheet symbol, use the sheet symbol's iterator to look for sheet entries. ServerProcessReport This script demonstrates how to generate a report for all installed servers' processes in Altium Designer. SineWave This script demonstrates how to plot a sine wave on a script form. ViaCreation This script demonstrates how to create a new Via object on a PCB.

TCL Script Examples No examples at present. VBScript Scripts Examples The script examples are in the Examples Scripts VBScript Scripts folder. The VBScript scripts have a.vbs extension. VBScript examples.

Script Filename Description AddDocToProject This script demonstrates how to insert a schematic sheet in a new PCB Project. There needs to be a sheet1.schdoc file in C: folder first. CopyBoardOutline This script copies the board outline as tracks and arcs onto specified layer. Layer and Width values to be specified by the user before proceeding. Uses PCB Object Model.

GetScriptEngineInfo Retrieves the Microsoft Scripting Engine version number. HelloWorld A simple hello world - an introduction to VBScript language. ParentChildIterators This script uses an iterator to look for sheet symbols and then within each sheet symbol, use the sheet symbol's iterator to look for sheet entries. Uses Schematic Object Model. ServerProcessReport This script demonstrates how to generate a report for all installed servers' processes in Altium Designer. SineWave This script demonstrates how to generate and plot a sine wave on a script form. Uses Components and a Script form.

ViaCreation This script demonstrates how to create a new Via object on a PCB document. Uses PCB Object model. Query Script Examples The script examples are in Examples Scripts Query Scripts folder. Query Script examples.

BEFORE YOU WATCH – the purpose of this video is to provide a very high-level overview of scripting in Altium Designer. This is not a “how to”. It provides you an overview of what you will need to know going into this effort.

Unfortunately, this is not a trivial effort. Along with this video, please consider the following commentary: Many high-end tools offer the ability to script. It is a feature that intrigues most engineers who are always looking for a way to automate something.

Embarking on a script, especially one that has to do with evaluating the position of primitives is much like writing a novel. It may be exciting at first, but it can take a good deal of time and enthusiasm to get it up and running. More often than not, though we have the interest, work obligations get into the way. For example, if I can repeat of key clicks and mouse motions 100 times and can do it in 5 minutes, am I willing to invest 20 minutes researching whether a feature exists and more so, how to use it? Am I also willing to invest 1 or 2 hours if this is something that needs to be coded?

Altium Script Examples

If mashing a bunch of keys and mouse clicks dozens of times is a one-time proposition, then most of us just grin and bear it. If we have to do it again at some time in the future or if we know that our colleagues also partake this particular manual effort, then we may consider the other options. This question was posed to one of our experts in Altium scripting. As if scripting was not difficult enough, Altium makes it more difficult by not providing all the processes and their options. When someone approaches Nine Dot Connects about a script, it is carefully reviewed to ensure that it is viable option. As for whether one should pursue a script, consider one or more of the following criteria:. Does it meet (a) specific need(s) which typical users believe is needed but with which they have difficulty either remembering or implementing without making mistakes?.

Does it significantly speed up processes done regularly and thus saves a lot of time?. Does it implement a process which is too manually complex, obscure or esoteric such that the user has trouble remembering how do it?. Does it implement a feature which is too complex (computationally or otherwise) for the user to do manually?. Would it be simple and fast such that it saves way more time that is takes to use it? A good script is more than pressing a run button.

It needs to provide feedback. It should have control and reporting dialog boxes to confirm it is being run, allow the setting of options, and summarize immediate results. And, if the script is going to be sold, it needs to provide much more value than it costs to invest in the tool. In all cases it must not conflict with procedures a company has already established (such as file naming and storage protocols, configuration managements, etc.).

It also must be something which is done fairly regularly so the user does not forget how to use it. For example a script to draw schematic templates (with borders, zones, title block, parameters, fields, section indicators, different sheet sizes, top vs. Continuation sheets, logo insertion, etc.) could be really nice for a design service, but not of a lot of value to a customer at one company who would only do it once.

It would be of little value it its sole purpose replicated an intrinsic function of the tool, such as checking for connectivity. It is much safer to check and report on conditions than to modify or create layout because of the esoteric relations to other things. In order to be created and used correctly and effectively, scripts should do relatively simple and well-bounded things (although repetition is straightforward). For example, a script to move vias onto the nearest grid would be simple but fixing the aftermath would be very complex and possibly impossible. And lastly, make certain that all other workarounds have been sought before embarking on this effort. Would you like to see other webinar recordings or videos from us?

Check out or reach out to us at info@ninedotconnects.com or 214-699-7719.