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

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



On 11/29/09, Bert Timmerman <bert.timmerman@xxxxxxxxx> wrote:
> This patch is as requested in:
> http://archives.seul.org/geda/user/Oct-2008/msg00088.html

Thanks!

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

I'm afraid it may not work when invoked without
the Selected argument (the same issue as with SetViasTented);
and probably a second optional
group of arguments, (pins|pads|vias) to select objects type,
can be useful.

> And another patch.
> This one is created from a fresh branch so it should be able to apply
> without the former patch.

SetViasTented(All) should be actually spelled
as SetViasTented(), and it seems not to work;
I'd also slightly refactor arguments
handling and other things.

Best regards,
Ineiev
From 63156621274735352e65ab0fba1cb09ffc9224c0 Mon Sep 17 00:00:00 2001
From: Bert Timmerman <bert.timmerman@xxxxxxxxx>
Date: Sun, 29 Nov 2009 10:24:26 +0100
Subject: [PATCH 1/2] Added ActionSetMaskGap

Action 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,pins,vias,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 |  130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 130 insertions(+), 0 deletions(-)

diff --git a/src/action.c b/src/action.c
index 6b979d3..140efe4 100644
--- a/src/action.c
+++ b/src/action.c
@@ -4357,6 +4357,133 @@ ActionMinClearGap (int argc, char **argv, int x, int y)
 
 /* ---------------------------------------------------------------------------  */
 
+static const char setmaskgap_syntax[] =
+  "SetMaskGap([Selected,] [(vias|pins|pads),]... value)";
+
+static const char setmaskgap_help[] =
+  "Sets the mask to the given distance (value) from pins/vias and pads.";
+
+/* %start-doc actions SetMaskGap
+
+What you can do is this:
+
+@enumerate
+
+@item Optionally enable the mask layer.
+
+@item Select everything that needs the mask distance value.
+
+@item :SetMaskGap(Selected,vias,pins,8,mil) to change
+them all to that amount.
+
+@end enumerate
+
+For all pins, vias and pads to set the mask distance you can do this:
+
+@enumerate
+
+@item Enable the mask layer.
+
+@item :SetMaskGap(8,mil) to change them all to that amount.
+
+@end enumerate
+
+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 *delta = NULL;
+  char *units = NULL;
+  Boolean r;
+  int value;
+  int flags = 0;
+  int ac = 0;
+  int vias = 0, pins = 0, pads = 0;
+
+  if (argc < 1)
+    AFAIL (setmaskgap);
+
+  if (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++;
+    }
+  /* no object type selection issued - assume all */
+  if (!(vias || pads || pins))
+    vias = pads = pins = !0;
+
+  if (ac >= argc) /* no value given */
+    AFAIL (setmaskgap);
+
+  delta = ARG (ac);
+  ac++;
+  units = ARG (ac);
+  if (++ac < argc) /* too many arguments */
+    AFAIL (setmaskgap);
+
+  value = 2 * GetValue (delta, units, &r);
+
+  SaveUndoSerialNumber ();
+  if (pins || pads)
+    ELEMENT_LOOP (PCB->Data);
+    {
+      if (pins)
+	PIN_LOOP (element);
+	{
+	  if (flags && !TEST_FLAGS (flags, pin))
+	    continue;
+	  ChangeObjectMaskSize (PIN_TYPE, element, pin, 0,
+				pin->Thickness + value, 1);
+	  RestoreUndoSerialNumber ();
+	}
+	END_LOOP; /* PIN_LOOP */
+      if (pads)
+	PAD_LOOP (element);
+	{
+	  if (flags && !TEST_FLAGS (flags, pad))
+	    continue;
+	  ChangeObjectMaskSize (PAD_TYPE, element, pad, 0,
+				pad->Thickness + value, 1);
+	  RestoreUndoSerialNumber ();
+	}
+	END_LOOP; /* PAD_LOOP */
+    }
+    END_LOOP; /* ELEMENT_LOOP */
+  if (vias)
+    VIA_LOOP (PCB->Data);
+    {
+      if (flags && !TEST_FLAGS (flags, via))
+	continue;
+      ChangeObjectMaskSize (VIA_TYPE, via, 0, 0,
+			    via->Thickness + value, 1);
+      RestoreUndoSerialNumber ();
+    }
+    END_LOOP; /* VIA_LOOP */
+  if (Bumped)
+    {
+      IncrementUndoSerialNumber ();
+      gui->invalidate_all ();
+    }
+  return 0;
+}
+
+/* ---------------------------------------------------------------------------  */
+
 static const char changepinname_syntax[] =
   "ChangePinName(ElementName,PinNumber,PinName)";
 
@@ -6919,6 +7046,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.6.5.3

From 6f9710326e143b2ca891914079e295830934bd05 Mon Sep 17 00:00:00 2001
From: Bert Timmerman <bert.timmerman@xxxxxxxxx>
Date: Sun, 29 Nov 2009 18:09:24 +0100
Subject: [PATCH 2/2] Added ActionSetViasTented

The action allows for setting the solder
mask for vias to be fully tented.

Set the solder mask for vias to be fully tented,
that is to fully cover the copper annulus and drill hole.

What you can do is this:

* Enable the solder mask layer.
* Select the vias that need their solder mask value changed
  to fully cover the copper annulus and drilling hole.
* :SetViasTented(Selected) to change only the selected vias
  or :SetViasTented() to change all vias.
---
 src/action.c |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/src/action.c b/src/action.c
index 140efe4..c3b07f0 100644
--- a/src/action.c
+++ b/src/action.c
@@ -4251,6 +4251,72 @@ ActionMinMaskGap (int argc, char **argv, int x, int y)
 
 /* ---------------------------------------------------------------------------  */
 
+static const char setviastented_syntax[] =
+  "SetViasTented(Selected)\n"
+  "SetViasTented()";
+
+static const char setviastented_help[] =
+  "Set the solder mask for vias to be fully tented.";
+
+/* %start-doc actions SetViasTented
+
+What you can do is this:
+
+@enumerate
+
+@item Optionally enable the solder mask layer.
+
+@item Select the vias that need their solder mask value changed
+to fully cover the copper annulus and drilling hole.
+
+@item :SetViasTented(Selected) to change only the selected vias
+or :SetViasTented() to change all vias.
+
+@end enumerate
+
+There is a MinMaskGap action to increase
+the solder mask gap to vendor minimum requirements.
+
+%end-doc */
+
+static int
+ActionSetViasTented (int argc, char **argv, int x, int y)
+{
+  char *function = ARG (0);
+  int flags = 0;
+  int all = 1;
+
+  if (function)
+    {
+      if(strcasecmp (function, "Selected") == 0)
+	{
+	  flags = SELECTEDFLAG;
+	  all = 0;
+	}
+      else if (strcmp (function, ""))
+	AFAIL (setviastented);
+    }
+
+  SaveUndoSerialNumber ();
+  VIA_LOOP (PCB->Data);
+  {
+    if (all || TEST_FLAGS (flags, via))
+      {
+	ChangeObjectMaskSize (VIA_TYPE, via, 0, 0, -1, 1);
+	RestoreUndoSerialNumber ();
+      }
+  }
+  END_LOOP;
+  if (Bumped)
+    {
+      IncrementUndoSerialNumber ();
+      gui -> invalidate_all ();
+    }
+  return 0;
+}
+
+/* ---------------------------------------------------------------------------  */
+
 static const char mincleargap_syntax[] =
   "MinClearGap(delta)\n" "MinClearGap(Selected, delta)";
 
@@ -7061,6 +7127,9 @@ HID_Action action_action_list[] = {
   {"SetValue", 0, ActionSetValue,
    setvalue_help, setvalue_syntax}
   ,
+  {"SetViasTented", 0, ActionSetViasTented,
+   setviastented_help, setviastented_syntax}
+  ,
   {"ToggleHideName", 0, ActionToggleHideName,
    togglehidename_help, togglehidename_syntax}
   ,
-- 
1.6.5.3


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