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

Re: gEDA-user: pcb [PATCH] Added ActionSetViasTented to allow for setting the solder mask of vias to be fully tented.



On 11/30/09, Gabriel Paubert <paubert@xxxxxxx> wrote:
> Now what's the difference between that command and a more generic
> SetViaMask with zero for the mask size

Good point.

Cheers,
Ineiev
From d216ed3d969b0b2a6d9134dd0bfbaa6e07e77f76 Mon Sep 17 00:00:00 2001
From: Bert Timmerman <bert.timmerman@xxxxxxxxx>
Date: Sun, 29 Nov 2009 10:24:26 +0100
Subject: [PATCH] Add SetMask action

Action to allow for setting of a solder mask {,gap} for
{selected, all} pins, vias and pads.

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

diff --git a/src/action.c b/src/action.c
index 6b979d3..46637fc 100644
--- a/src/action.c
+++ b/src/action.c
@@ -4357,6 +4357,153 @@ ActionMinClearGap (int argc, char **argv, int x, int y)
 
 /* ---------------------------------------------------------------------------  */
 
+static const char setmask_syntax[] =
+  "SetMask([Gap,] [Selected,] [(vias|pins|pads),]... value)";
+
+static const char setmask_help[] =
+  "Sets the mask to the given value.";
+
+/* %start-doc actions SetMask
+
+@table @code
+
+@item Gap
+Set mask gap relative to the copper rather than absolute value
+of mask aperture.
+
+@item Selected
+Set mask of selected objects rather than all on the board
+
+@item vias, pins, pads
+Select types of objects.  When none is issued, all types are assumed.
+
+@item value
+This can be increment (when begins with `+' or `-') or absolute value
+(start with `=' to force), followed by optional units (mil or mm),
+e.g. SetMask(=+10,mil).  When no units follow,
+PCB internal units (1/100 mil) are assumed.
+
+@end table
+
+There is a MinMaskGap() action to increase the mask gap to vendor
+minimum requirements.
+
+%end-doc */
+
+static int
+ActionSetMask (int argc, char **argv, int x, int y)
+{
+  char *delta = NULL;
+  char *units = NULL;
+  Boolean absolute;
+  int value, mask;
+  int flags = 0;
+  int ac = 0;
+  int vias = 0, pins = 0, pads = 0, gap = 0;
+
+
+  if (ac < argc && strcasecmp (argv[ac], "gap") == 0)
+    {
+      gap = !0;
+      ac++;
+    }
+
+  if (ac < argc && strcasecmp (argv[ac], "selected") == 0)
+    {
+      flags = SELECTEDFLAG;
+      ac++;
+    }
+  while (ac < argc)
+    {
+      if (!strcasecmp (argv[ac], "vias"))
+        vias = !0;
+      else if (!strcasecmp (argv[ac], "pads"))
+        pads = !0;
+      else if (!strcasecmp (argv[ac], "pins"))
+        pins = !0;
+      else break;
+      ac++;
+    }
+
+  if (ac >= argc)
+    {
+      Message (_("SetMask: mask value must be provided\n"));
+      AFAIL (setmask);
+    }
+
+  /* no object type selection issued - assume all */
+  if (!(vias || pads || pins))
+    vias = pads = pins = !0;
+
+  delta = ARG (ac);
+  ac++;
+  units = ARG (ac);
+  if (++ac < argc)
+    {
+      Message (_("SetMask: too many arguments\n"));
+      AFAIL (setmask);
+    }
+
+  value = 2 * GetValue (delta, units, &absolute);
+  if (absolute && !value)
+    value = -1;
+
+  SaveUndoSerialNumber ();
+  if (pins || pads)
+    ELEMENT_LOOP (PCB->Data);
+    {
+      if (pins)
+	PIN_LOOP (element);
+	{
+	  if (flags && !TEST_FLAGS (flags, pin))
+	    continue;
+	  mask = value;
+	  if (gap && absolute)
+	    mask += pin->Thickness;
+
+	  ChangeObjectMaskSize (PIN_TYPE, element, pin, 0,
+				mask, absolute);
+	  RestoreUndoSerialNumber ();
+	}
+	END_LOOP; /* PIN_LOOP */
+      if (pads)
+	PAD_LOOP (element);
+	{
+	  if (flags && !TEST_FLAGS (flags, pad))
+	    continue;
+	  mask = value;
+	  if (gap && absolute)
+	    mask += pad->Thickness;
+	  ChangeObjectMaskSize (PAD_TYPE, element, pad, 0,
+				mask, absolute);
+	  RestoreUndoSerialNumber ();
+	}
+	END_LOOP; /* PAD_LOOP */
+    }
+    END_LOOP; /* ELEMENT_LOOP */
+  if (vias)
+    VIA_LOOP (PCB->Data);
+    {
+      if (flags && !TEST_FLAGS (flags, via))
+	continue;
+      mask = value;
+      if (gap && absolute)
+	mask += via->Thickness;
+      ChangeObjectMaskSize (VIA_TYPE, via, 0, 0,
+			    mask, absolute);
+      RestoreUndoSerialNumber ();
+    }
+    END_LOOP; /* VIA_LOOP */
+  if (Bumped)
+    {
+      IncrementUndoSerialNumber ();
+      gui->invalidate_all ();
+    }
+  return 0;
+}
+
+/* ---------------------------------------------------------------------------  */
+
 static const char changepinname_syntax[] =
   "ChangePinName(ElementName,PinNumber,PinName)";
 
@@ -6919,6 +7066,9 @@ HID_Action action_action_list[] = {
   {"SaveTo", 0, ActionSaveTo,
    saveto_help, saveto_syntax}
   ,
+  {"SetMask", 0, ActionSetMask,
+   setmask_help, setmask_syntax}
+  ,
   {"SetSquare", 0, ActionSetSquare,
    setsquare_help, setsquare_syntax}
   ,
-- 
1.6.5.3


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