Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2017 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d80325f8c8d93a2c9adcf979b9101149 to your computer and use it in GitHub Desktop.
Save anonymous/d80325f8c8d93a2c9adcf979b9101149 to your computer and use it in GitHub Desktop.
Simpleware Scripting Webinar
from scanip_api import *
import csv
import itertools
import os.path
app = App.GetInstance()
doc = App.GetDocument()
class ThinObjectSmoother(Command):
def __init__(self, dilate, smooth, erode):
Command.__init__(self)
self.dilate = dilate
self.smooth = smooth
self.erode = erode
def GetName(self):
return "Special Smooth"
def OnNativeDelete(self):
doc.ReleaseCommand(self)
def Do(self):
doc.ApplyDilateFilter(Doc.TargetMask, self.dilate, 0)
doc.ApplyRecursiveGaussianFilter(Doc.TargetMask, True, Sigma(self.smooth))
doc.ApplyErodeFilter(Doc.TargetMask, self.erode, 0)
return True
# Just run once...
doc.SubmitCommand(ThinObjectSmoother(4, 4.5, 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment