Python AddHatch using comtypes

Python AddHatch using comtypes

Anonymous
Not applicable
1,893 Views
0 Replies
Message 1 of 1

Python AddHatch using comtypes

Anonymous
Not applicable

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

0 Likes
1,894 Views
0 Replies
Replies (0)