Package: inkex-bh
Inkscape Extensions for Barn HuntHere are some Inkscape extensions that are possibly useful when usingInkscapeto drawBarn Huntmaps.These are a freshly updated and rewritten version of plugins that I
(and Sandra, my wife) have been using for several years to draw our
maps. The sample course map on the officialBHA Judging Assignment
Cheat Sheetis one of mine. (The previous versions of the
plugins worked with Inkscape version 0.x.  The plugin API has changed
considerably since then, so a rewrite was necessary to get the plugins
to work with more modern versions of Inkscape.)These extensions are, as yet, poorly documented, and likely not to
work without tweaks in all environments (I used Linux — these
extensions are totally untested on Windows), so I'm not sure that
they're generally useful, yet.The goal is for these to work on all version of Inkscape with versions
of 1.0 or greater.  Currently, these have be cursorily tested under
Inkscape versions 1.1.2 and 1.2.1.What’s Here?Currently there are four extensions.Count SymbolsWe use Inkscape symbol libraries containing map elements like
individual bales, rat tube markers, etc to draw our maps.  This plugin
simply counts what symbols are visible, and reports a list of symbol
names along with how many times they are used in the drawing.  (By
default, only symbols on visible layers are counted.)The bh:count-as symbol attributeSymbols may be marked with a custombh:count-asattribute, in order
to have them counted under some name other than their XMLid.I have a number of different symbols for bales: first level bales,
second level bales, bales on edge, leaners, etc.  I would like all
bales of a given size counted under the same name.  So, in my symbol
libraries, I set abh:count-as="bale-42x18x16"on each of the
variants of 42”x18”x16” bales.Create InsetThis extension creates an embedded PNG image created by exporting a
portion of the drawing.  Such images are useful, for example, to include
a base-layer map (possibly at reduced scale) on the same page as the complete
course map.To use, one should:Hide/unhide layers as you wish, to make what you want visible in
the exported image visible.Select one object in the drawing. That object will define the
rectangular bounding box of the exported image.  Then run the
extension.This will create an image. It will be created on top of all other
layers in the drawing. (You will probably want to move that image into
an appropriate layer.)Regenerating the InsetsThe layers that were visible when the image was generated, and the
object which defined the boundary of the image are recorded in custom
attributes on the<svg:image>element.  This makes it easy to
regenerate the image(s), should that become necessary (e.g. after
you've made changes to the drawing.)Simply select just the generated images you'd like regenerated, and
fire off the extension.  It will adjust layer visibility to match what
it was when each image was first exported, and re-export it.Hide RatsThe third extension is used to randomize the position of rat tubes on rat maps.Instructions pending... :-/Set Random SeedThis sets or updates a random number stored in a custom attribute out
the<svg>element of the drawing.  This number is used by thebarnhuntprogram to seed the pseudo-random number generator used
when expanding text templates.  Setting it to a unique number ensure,
e.g., that the Master random rat numbers come out random, but still
reproducible.When one copies an existing.svgfile to use a template for a new
trial, one should run this plugin, with theforce-reseedcheckbox
checked, to ensure that the copied file gets a new, unique random
seed.InstallationThe easiest way to install these extensions is using the newinstallsub-command of mybarnhuntscript:First installInkscape,python, and, then,
mybarnhunt script.
Finally, run:barnhuntinstallto install both these extensions and mysymbol
setsinto
your Inkscape configuration.Manual InstallationIt is now recommended to use thebarnhunt installsub-command to
install these extensions (see above).  However, they may still be
installed manually.To manually install a released version of this package:Download the packaged zip fileassetfrom the GitHubReleases
pagefor the
desired release.  (Those are the zip files named something likeinkex_bh-version.zip.)Unzip the zip file into your Inkscape user extensions directory.On Linux this can be done thusly:# remove previous installed version, if anyrm-r"$(inkscape--user-data-directory)/extensions/org.dairiki.inkex_bh"# unpack desired version of extensions to user's Inkscape extensions directoryunzip-d"$(inkscape--user-data-directory)/extensions"inkex_bh-X.Y.Z.zipWarning: It is no longer recommended to install the extensions
usingpip.  (Though, for now, the package will continue to be
published to PyPI.)PackagingTo build a packaged zip file from the git source, clone the git
repository, installhatch, then runhatchbuild--targetzipped-directoryThat should build a zip archive in thedist/subdirectory.What's Elsewhere?There are two other bits I use when drawing maps.Neither of these are published in a public place, yet.And, of course, their use is not documented at all.Kick me if you want to know more.Barn Hunt Symbol Libraries for InkscapeI've constructed some symbol libraries for Inkscape containing things
like bales, boards, rat markers, fluff pile symbols, etc.I've even got a semi-automatic scheme set up by which I can generate
symbol sets for arbitrary sized bales.Thebarnhuntcommand-line export utilityI draw all my maps for a given course (for a day or weekend) on
various nested layers in a single drawing.  By hiding and unhiding
various sets of layers all of my maps can be generated.I have a python script namedbarnhunt, whose primary job
is to automate that layer hiding/unhiding and PDF exporting process.
While exporting the map, it can also expand special template syntax in
text in the drawings.  This can be used to automate the printing of
course names and blind numbers on the exported map, and is also used
to generate the random Master rat numbers.Sadly, at present there is zero documentation on how to use it.Kick me if you want to know more.AuthorJeff Dairiki, BHAJ-221Adairiki@dairiki.orgChanges1.0.0 (2023-08-26)create-insetFix to work when there are visible clones of layers with hidden parents. (#2)1.0.0rc7 (2023-03-08)update-symbolsOnly skip symbol sets if they contain a symbol id that conflicts
with an already scanned symbol set.  Standard-scale (48:1) symbols
sets are loaded first, so this results in skipping non-standard
symbol sets, butonlyif they contain conflicting symbol ids.
Previously, we just ignored all non-standard symbol sets.(Until recently, bale sets for non-standard scales (e.g. 60:1) used
the same symbol ids as the standard scale (48:1) sets. As ofbh-symbols==1.0.0rc5, all symbols now have globally unique ids.)Do not update unchanged symbols.Adddry-runoption to report which symbols would be updated.Report the currently installed version ofbh-symbols.1.0.0rc6 (2023-03-06)Added newupdate-symbolsextension to update the symbol definitions
in a drawing to those in the installed version of thebh-symbolssymbol
library.NOTETheupdate symbolsoperation, if it goes badly, has the
capability to significantly mangle the drawing.  Make sure you have
a back-up copy of the drawing before running the extension.1.0.0rc5 (2023-02-17)RefactorUse helpers provided byinkex.command(rather than callingsubprocess.rundirectly) to run Inkscape (and optipng) from thecreate-insetextension.TestingAdd integration test for thecreate-insetextension. This checks
that the extension can be invoked from Inkscape's batch mode.Omit use of virtual environment intest_run_module_in_installed_extensions.1.0.0rc4 (2023-02-14)BugsFix thecreate insetextensions when running from the AppImage-packaged version
of Inkscape 1.2.2.1.0.0rc3 (2022-10-12)BugsFix thecreate insetandhide ratsextensions so that they might
actually run under Inkscape 1.0.x.PackagingWe now build and publish — as GitHub Release artifacts — zip
archives of the extension that suitable for unzipping in a user's
Inkscape extensions directory.Usehatchfor packaging.TestingInstallinkexfrom custom-built wheels in the python registry athttps://gitlab.com/dairiki/inkex/.  The versions ofinkexon PyPI
are stale, and also don't match theinkexincluded in any
particular version of Inkscape.We now test (I think) under truly the whole matrix of supported
python × Inkscape/inkex versions.1.0.0rc2 (2022-09-25)Bugs FixedHide RatsWhenClone rat layerselected, cloning of text was screwed up.1.0.0rc1 (2022-08-31)This is a fairly complete rewrite and repackaging of a set of Barn
Hunt extensions I used with Inkscape 0.9x.  (As of Inkscape 1.0, the
extension API changed significantly, so this required a significant
rework.)