[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-user: [Patch] pcb Added ActionSetMaskGap for setting solder mask gap



Hi all,

This patch is as requested in:

http://archives.seul.org/geda/user/Oct-2008/msg00088.html

I don't know if this is *exactly* what DJ meant but it works for me.

This action sets the gap to the desired value whatever the former gap
distance was (this action even accepts negative gaps, that is, mask
overlapping the area to be wetted by solder, for if you want tented
vias).

Just my EUR 0.02

Kind regards,

Bert Timmerman.
From 6d5112ee489dd81e9588c727c20f0512b3f03a7f Mon Sep 17 00:00:00 2001
From: Bert Timmerman <bert.timmerman@xxxxxxxxx>
Date: Sun, 29 Nov 2009 10:24:26 +0100
Subject: [PATCH] Added ActionSetMaskGap to allow for setting of a solder mask gap for [Selected, all] pins, vias and pads.

Sets the mask gap between the pin/via or pad edge and the mask edge, of all
or selected pins and/or pads to the required value.
What you can do is this:
* Enable the mask layer.
* Select everything that needs the mask distance value.
* :SetMaskGap(Selected,8,mil) to change them all to that amount.
For all pins, vias and pads to set the mask distance you can do this:
* Enable the mask layer.
* :SetMaskGap(8,mil) to change them all to that amount.
---
 src/action.c |  104 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)

diff --git a/src/action.c b/src/action.c
index 6b979d3..5d3a46b 100644
--- a/src/action.c
+++ b/src/action.c
@@ -4251,6 +4251,107 @@ ActionMinMaskGap (int argc, char **argv, int x, int y)
 
 /* ---------------------------------------------------------------------------  */
 
+static const char setmaskgap_syntax[] =
+  "SetMaskGap(value)\n"
+  "SetMaskGap(Selected, value)";
+
+static const char setmaskgap_help[] =
+  "Sets the mask to the given distance (value) from pins/vias and pads.";
+
+/* %start-doc actions SetMaskGap
+
+Sets the mask gap between the pin/via or pad edge and the mask edge, of all 
+or selected pins and/or pads to the required value.
+
+What you can do is this:
+
+* Enable the mask layer.
+
+* Select everything that needs the mask distance value.
+
+* :SetMaskGap(Selected,8,mil) to change them all to that amount.
+
+For all pins, vias and pads to set the mask distance you can do this:
+
+* Enable the mask layer.
+
+* :SetMaskGap(8,mil) to change them all to that amount.
+
+There is a MinMaskGap() action to increase the mask gap to vendor
+minimum requirements.
+
+%end-doc */
+
+static int
+ActionSetMaskGap (int argc, char **argv, int x, int y)
+{
+  char *function = ARG (0);
+  char *delta = ARG (1);
+  char *units = ARG (2);
+  Boolean r;
+  int value;
+  int flags;
+
+  if (!function)
+    return 1;
+  if (strcasecmp (function, "Selected") == 0)
+    flags = SELECTEDFLAG;
+  else
+    {
+      units = delta;
+      delta = function;
+      flags = 0;
+    }
+  value = 2 * GetValue (delta, units, &r);
+
+  HideCrosshair (True);
+  SaveUndoSerialNumber ();
+  ELEMENT_LOOP (PCB->Data);
+  {
+    PIN_LOOP (element);
+    {
+      if (!TEST_FLAGS (flags, pin))
+        continue;
+      else
+	{
+	  ChangeObjectMaskSize (PIN_TYPE, element, pin, 0,
+				pin->Thickness + value, 1);
+	  RestoreUndoSerialNumber ();
+	}
+    }
+    END_LOOP; /* PIN_LOOP */
+    PAD_LOOP (element);
+    {
+      if (!TEST_FLAGS (flags, pad))
+        continue;
+      else
+	{
+	  ChangeObjectMaskSize (PAD_TYPE, element, pad, 0,
+				pad->Thickness + value, 1);
+	  RestoreUndoSerialNumber ();
+	}
+    }
+    END_LOOP; /* PAD_LOOP */
+  }
+  END_LOOP; /* ELEMENT_LOOP */
+  VIA_LOOP (PCB->Data);
+  {
+    if (!TEST_FLAGS (flags, via))
+      continue;
+    else
+      {
+	ChangeObjectMaskSize (VIA_TYPE, via, 0, 0, via->Thickness + value, 1);
+	RestoreUndoSerialNumber ();
+      }
+  }
+  END_LOOP; /* VIA_LOOP */
+  RestoreUndoSerialNumber ();
+  IncrementUndoSerialNumber ();
+  return 0;
+}
+
+/* ---------------------------------------------------------------------------  */
+
 static const char mincleargap_syntax[] =
   "MinClearGap(delta)\n" "MinClearGap(Selected, delta)";
 
@@ -6919,6 +7020,9 @@ HID_Action action_action_list[] = {
   {"SaveTo", 0, ActionSaveTo,
    saveto_help, saveto_syntax}
   ,
+  {"SetMaskGap", 0, ActionSetMaskGap,
+   setmaskgap_help, setmaskgap_syntax}
+  ,
   {"SetSquare", 0, ActionSetSquare,
    setsquare_help, setsquare_syntax}
   ,
-- 
1.5.0.6


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user