altium-designerdelphiscript

AltiumDesigner25 script leaves visual artifacts after moving components


Moving components from a script causes persistent visual artifacts that don’t disappear even after restarting.

Here is what I've tried:

All code that moves components executes between these 2 procedure calls:

PCBBoard.BeginModify;
[...]
PCBBoard.EndModify;

I update the components as such:

Component.MoveToXY(MMsToCoord(X), MMsToCoord(Y));
[...]
Component.GraphicallyInvalidate;

At the end I also call these procedures:

PCBBoard.ViewManager_FullUpdate;
PCBBoard.ViewManager_UpdateLayerTabs;

which (I expected) should fully redraw PCB editor without leftover graphics.

What is the correct way to force a clean redraw or invalidate the viewport?

UPD: Running DRC seems to help. AD's scripting API is a mess. UPD2: If someone has the same problem, you can also try Component.Rebuild;


Solution

  • Altium doesn’t always refresh the PCB view correctly when objects are moved from script code. GraphicallyInvalidate is usually not enough on its own.

    After moving a component you generally need to force a rebuild on the object, not just the board:

    Component.Rebuild;
    

    That usually clears the leftover graphics immediately.
    If not, running a DRC or toggling a layer view also triggers the full redraw, but Rebuild is the lighter fix.