title: LibreOffice problems drawing hash marks in shape using Python
body: <p>I am trying to create a hash mark pattern inside a shape using LibreOffice 5 on Windows 10 using the Python 3.3 that came with LibreOffice. Two thirds of the code is similar to this <a href="https://stackoverflow.com/questions/36852645/create-flowchart-in-libreoffice-using-python">post</a> with additional questions about creating hash marks at the end of the code listing.</p>
  
  <p>This is the Python code I tried.</p>
  
  <pre><code>import sys
  print(sys.version)
  
  import socket
  import uno
  
  # get the uno component context from the PyUNO runtime
  localContext = uno.getComponentContext()
  
  # create the UnoUrlResolver
  resolver = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext )
  
  # connect to the running office
  ctx = resolver.resolve( "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" )
  smgr = ctx.ServiceManager
  
  # get the central desktop object
  desktop = smgr.createInstanceWithContext( "com.sun.star.frame.Desktop",ctx)
  model = desktop.getCurrentComponent()
  
  # Create the shape
  def create_shape(document, x, y, width, height, shapeType):
      shape = model.createInstance(shapeType)
      aPoint = uno.createUnoStruct("com.sun.star.awt.Point")
      aPoint.X, aPoint.Y = x, y
      aSize = uno.createUnoStruct("com.sun.star.awt.Size")
      aSize.Width, aSize.Height = width, height
      shape.setPosition(aPoint)
      shape.setSize(aSize)
      return shape
  
  def formatShape(shape):
      shape.setPropertyValue("FillColor", int("FFFFFF", 16))  # blue
      shape.setPropertyValue("LineColor", int("000000", 16))  # black
  
      aHatch = uno.createUnoStruct("com.sun.star.drawing.Hatch")
      #HatchStyle = uno.createUnoStruct("com.sun.star.drawing.HatchStyle")
      #aHatch.Style=HatchStyle.DOUBLE;
      aHatch.Color=0x00ff00
      aHatch.Distance=100
      aHatch.Angle=450
  
      shape.setPropertyValue("FillHatch", aHatch)
      shape.setPropertyValue("FillStyle", "FillStyle.DOUBLE")
  
  shape = create_shape(model, 0, 0, 10000, 10000, "com.sun.star.drawing.RectangleShape")
  formatShape(shape)
  
  drawPage.add(shape)
  </code></pre>
  
  <p>This code should set a double crosshatch pattern inside a rectangle but no pattern shows ups inside the rectangle. </p>
  
  <pre><code>aHatch = uno.createUnoStruct("com.sun.star.drawing.Hatch")
  #HatchStyle = uno.createUnoStruct("com.sun.star.drawing.HatchStyle")
  #aHatch.Style=HatchStyle.DOUBLE;
  aHatch.Color=0x00ff00
  aHatch.Distance=100
  aHatch.Angle=450
  
  shape.setPropertyValue("FillHatch", aHatch)
  shape.setPropertyValue("FillStyle", "FillStyle.DOUBLE")
  </code></pre>
  
  <p>The line to set the hatch style pattern:</p>
  
  <pre><code>uno.RuntimeException: pyuno.getClass: 
  </code></pre>
  
  <p>Fails with the following error</p>
  
  <pre><code>com.sun.star.drawing.HatchStyleis a ENUM, expected EXCEPTION,
  </code></pre>
  
  <p>Here are some links to <a href="https://svn.apache.org/repos/asf/openoffice/trunk/test/testuno/source/fvt/uno/sd/shape/ShapeProperties.java" rel="nofollow noreferrer">Java</a> and <a href="https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Structure_of_Drawings" rel="nofollow noreferrer">BASIC</a> examples I used for reference.</p>