Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: get-polygon, or, polygons as arguments to expand-polygon #736

Open
jbayless opened this issue Sep 7, 2023 · 2 comments

Comments

@jbayless
Copy link

jbayless commented Sep 7, 2023

Horizon's parameter programs have an aspect that makes them very hard to edit: polygon coordinate lists hard-coded in the program. The most common use case for the parameter program is to take some existing shape (such as a polygon on the copper layer) and expand or shrink it (to generate an offset polygon for the solder paste or solder mask layers). Yes, you can click the 'generate expand polygon' button to populate the coordinates. But why not express this workflow in the parameter program directly?

Here is an example of an existing parameter program, from the WDFN8 Pads 5-8 padstack:

get-parameter [ solder_mask_expansion ]
expand-polygon [ mask_polygon -320000 1185000 -500000 1185000 -500000 -1185000 -320000 -1185000 -320000 -1730000 250000 -1730000 250000 -1185000 1800000 -1185000 1800000 -765000 1330000 -765000 1330000 -535000 1800000 -535000 1800000 -115000 1330000 -115000 1330000 115000 1800000 115000 1800000 535000 1330000 535000 1330000 765000 1800000 765000 1800000 1185000 250000 1185000 250000 1730000 -320000 1730000 ]
0 get-parameter [ paste_mask_contraction ] -
expand-polygon [ paste_polygon_1 485000 0 485000 1185000 250000 1185000 250000 1730000 -320000 1730000 -320000 1185000 -500000 1185000 -500000 0 ]
0 get-parameter [ paste_mask_contraction ] -
expand-polygon [ paste_polygon_2 485000 0 1330000 0 1330000 115000 1800000 115000 1800000 535000 1330000 535000 1330000 765000 1800000 765000 1800000 1185000 485000 1185000 ]
0 get-parameter [ paste_mask_contraction ] -
expand-polygon [ paste_polygon_3 485000 0 485000 -1185000 250000 -1185000 250000 -1730000 -320000 -1730000 -320000 -1185000 -500000 -1185000 -500000 0 ]
0 get-parameter [ paste_mask_contraction ] -
expand-polygon [ paste_polygon_4 485000 0 1330000 0 1330000 -115000 1800000 -115000 1800000 -535000 1330000 -535000 1330000 -765000 1800000 -765000 1800000 -1185000 485000 -1185000 ]

Look at all those magic numbers... So hard to make any changes to this padstack!

What if all that could be replaced by something like this:

get-polygon-vertices [ copper_polygon ]
get-parameter [ solder_mask_expansion ]
expand-polygon-vertices [mask_polygon ]
get-polygon-vertices [ copper_polygon ]
get-parameter [ paste_mask_contraction ]
expand-polygon-vertices [paste_polygon ]

Or even this:

get-parameter [ solder_mask_expansion ]
expand-polygon-vertices [mask_polygon copper_polygon ]
get-parameter [ paste_mask_contraction ]
expand-polygon-vertices [paste_polygon copper_polygon ]

What do you think?

@carrotIndustries
Copy link
Member

Parameter programs should be idempotent, i.e. you should be able to run them any number of times on a single document with the output not changing. Expanding the polygon in-place would defeat that.

@jbayless
Copy link
Author

I see. Yes, it would require separately storing a polygon's "as-drawn" state from the shape of the polygon after the parameter program's execution, so that only the as-drawn state is usable as the polygon program input. Maybe that's too much complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants