Message 1 of 1
Python AddHatch using comtypes

Not applicable
07-24-2019
01:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am new to python. And i am working on comtypes package to automate drawing on autocad. But I encountered some problem with assigning boundary for hatch object. for example
from comtypes.client import CreateObject
from comtypes.client import GetActiveObject
import array
#Create Autocad file
try:
Aapp= GetActiveObject("AutoCad.Application")
Aapp.Visible= True
Adrawing=Aapp.ActiveDocument
except:
Aapp = CreateObject("AutoCad.Application")
Aapp.Visible = True
Adrawing = Aapp.ActiveDocument
ms= Adrawing.Modelspace
from comtypes.gen.AutoCAD import *
center = array.array('d', [15, 10, 0.0])
circle = ms.AddCircle(center, 15)
circle.color = acGreen
SolidHatch=ms.AddHatch(0, "Solid", False)
SolidHatch.color = acRed
SolidHatch.AppendOuterLoop(circle)
SolidHatch.Evaluate
while running the code i keep on getting error on SolidHatch.AppendOuterLoop (circle). I need help on how to assign the boundary the right way