I'm using comtypes to acess AutoCAD and I´m in trouble with arrays and
Python....

I need help....there is a LightweightPolyline object (eg.
*<POINTER(IAcadLWPolyline)
ptr=0x332f054 at 6ffe800>) *I need to transform this object into an array
to create a Region (AddRegion). I don´t understand how to build this array
correctly.

My goal is to create a solid.....but before the AddExtrudedSolid I need to
create a Region (AddRegion).

The problem is to bulid the array correctly. The examle below is to draw a
"L" shape....user must inform the width and tickness.

Thanks again,

Luciano

from pyautocad import *
from array import *
from math import radians

acad = Autocad()
desenho = acad.model
documento = acad.doc

aba = acad.doc.Utility.GetString(1,'Digite ABA da cantoneira: ')
espessura = acad.doc.Utility.GetString(1,'Digite ESPESSURA da cantoneira: ')

insersao = acad.doc.Utility.GetPoint(APoint(0,0,0),'Pto de insercao: ')
p1 = array('d', insersao)

p2 = acad.doc.Utility.PolarPoint(p1, radians(0), float(aba))
p3 = acad.doc.Utility.PolarPoint(array('d', p2), radians(90),
float(espessura))
p4 = acad.doc.Utility.PolarPoint(array('d', p3), radians(180),
float(aba)-float(espessura))
p5 = acad.doc.Utility.PolarPoint(array('d', p4), radians(90),
float(aba)-float(espessura))
p6 = acad.doc.Utility.PolarPoint(array('d', p5), radians(180),
float(espessura))

pontos = [p1[0] , p1[1], p2[0] , p2[1], p3[0] , p3[1], p4[0] , p4[1] ,p5[0]
, p5[1] ,p6[0] , p6[1]]
pontos_1 = array('d', pontos)

poli = desenho.AddLightweightPolyline(pontos_1)
poli.Closed = 1

#a = array('c',str(poli)) # first attempt
#aa = numpy.array(poli, dtype='O') # second attempt

#g = desenho.AddRegion(aa)

solido = poli.AddExtrudedSolid(g, 1000, 0)
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to