title: Using python to insert a block into autocad document, unsuccessfully
body: <p>I am using Python to insert a block into autocad document.The code below:</p>
  
  <pre><code>import comtypes.client
  app = comtypes.client.GetActiveObject("AutoCAD.Application")
  ms = app.ActiveDocument
  files = r"C:\Users\TOM\Desktop\02python\516.00-501.50.dwg"
  insertionPnt = [0,0,0]
  ms.ModelSpace.InsertBlock(insertionPnt, files, 1, 1, 1, 0)
  </code></pre>
  
  <p>The block is inserted into the document, but the modelspace doesn't display. The exceptions are:</p>
  
  <pre class="lang-none prettyprint-override"><code>File "C:\Users\TOM\Documents\002pybookcode\backup_code\test.py", line 10, in &lt;module&gt;
      ms.ModelSpace.InsertBlock(insertionPnt, files, 1, 1, 1, 0)
  _ctypes.COMError: (-2147024809, '\xb2\xce\xca\xfd\xb4\xed\xce\xf3\xa1\xa3', (None, None, None, 0, None))
  </code></pre>
  
  <p>I've solved this problem,and the code below is working.</p>
  
  <pre><code>import win32com.client
  import pythoncom
  
  def POINT(x,y,z):
      return win32com.client.VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_R8, (x,y,z))  
  
  acad = win32com.client.Dispatch("AutoCAD.Application")  
  doc = acad.ActiveDocument  
  ms = doc.ModelSpace  
  files = r"C:\Users\TOM\Desktop\02python\516.00-501.50.dwg"
  doc.Utility.Prompt("hello World\n")
  pt1= POINT(0.0,0.0,0.0)
  ms.InsertBlock(pt1, files, 1.0,1.0,1.0, 0)
  </code></pre>