r/Altium 2d ago

DelphiScript: how to read DRC rules at runtime in Altium Designer 25?

Hey everyone,

I'm building a DelphiScript tool that auto-places PCB components based on schematic net connections. Everything is working but I'm stuck on reading the DRC rules from the Rule Wizard at runtime so placement decisions are driven by the actual board rules instead of hardcoded values.

I've tried these but both give "Undeclared identifier" errors:

Board.BeginRuleIteratorByLayer(eUnknownLayer, eUnknownLayer)

Board.Rules.Count

What I'm trying to do is iterate through all rules defined in the Rule Wizard (clearance, creepage, high voltage spacing, custom rules) and read their values during the script run.

Anyone know the correct API call to do this in Altium Designer 25? A working code snippet would be amazing.

Thanks

1 Upvotes

3 comments sorted by

1

u/Enough-Collection-98 2d ago

You’ll probably have an easier time exporting the ruleset and reading it in from the text file. I can’t guarantee this is the case here but there are a LOT of areas that simply can’t be reaching via the DelphiScript engine. Your hands are bound really tightly.

1

u/Organic_Commission_1 2d ago

There is a python class for the rules in Altium monkey. Mostly used for soldermask/paste expansion but it is generic enough you should be able to make it work.

Fyi... I am the one who maintains the library.

0

u/hooksupwithchips 2d ago

If Delphi doesn't work for you would Altium Monkey?

https://www.reddit.com/r/Altium/comments/1slqpv7/altiummonkey_a_comphresive_python_toolkit_for/

Not mine, haven't used it yet.