I have used array module because it worked with comtypes module. If I use simple list it doesn't work with comtypes nor pywin32. If I use: pt1 = [0.0,0.0,0.0] pt2 =[1.0,1.0,0.0]
Then Python responds: <code> Traceback (most recent call last): File "<ipython console>", line 1, in <module> File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\startup.py", line 128, in runfile execfile(filename, glbs) File "C:\Documents and Settings\Administrador\Mis documentos\DropboxDani\Dropbox\PYTHON\PruebaAutoCADLinea.py", line 16, in <module> line = ms.AddLine(pt1, pt2) File "<COMObject <unknown>>", line 3, in AddLine com_error: (-2147352567, 'Ocurri\xf3 una excepci\xf3n.', (0, None, None, None, 0, -2147024809), None) </code> 2012/2/1 Mark Hammond <mhamm...@skippinet.com.au> > Re-added the python-win32 list - please keep replies on list. > > Your code uses: > > > > pt1 = array.array('d', [0.0,0.0,0.0]) > > pt2=array.array('d',[1.0,1.0,_**_0.0]) > > But these aren't supported by pywin32 in the way you expect - what happens > if you change this to: > > pt1 = [0.0,0.0,0.0] > pt2 =[1.0,1.0,0.0] > > ? > > Mark > > > > On 2/02/2012 7:12 AM, DANIEL POSE wrote: > >> Hello Mark, >> >> I understand the AutoCAD problem, but in my profession it is the most >> extended software for CAD. In my opinion it justify the efford to make >> automation tools. >> Here I post the answer from Python when I try to draw a line using >> win32com.client code in my last mail: >> >> Traceback (most recent call last): >> File "<ipython console>", line 1, in <module> >> File >> "C:\Python27\lib\site-**packages\spyderlib\widgets\** >> externalshell\startup.py", >> line 128, in runfile >> execfile(filename, glbs) >> File "C:\Documents and Settings\Usuario\Escritorio\**borrar.py", line >> 15, in <module> >> line = ms.AddLine(pt1, pt2) #This draw a line in AutoCAD >> File "<COMObject <unknown>>", line 3, in AddLine >> com_error: (-2147352567, 'Ocurri\xf3 una excepci\xf3n.', (0, None, None, >> None, 0, -2147024809), None) >> >> Thank you in advance, >> Daniel Pose. >> >> 2012/2/1 Mark Hammond <skippy.hamm...@gmail.com >> <mailto:skippy.hammond@gmail.**com <skippy.hamm...@gmail.com>>> >> >> >> Sadly not many people have access to autocad so it is hard to test. >> What errors do you get using win32com? >> >> Mark >> >> >> On 1/02/2012 5:11 AM, DANIEL POSE wrote: >> >> Hello, >> >> Recently I try to write some code to automate AutoCAD from Python. >> I >> have to draw lines from Python using win32com.client module, but I >> obtain error. By other hand I solved the problem using comtypes >> module. >> However, If I try to obtain block attributes information, comtypes >> doesn't work but win32com.client work properly. >> >> AutoCAD attributes working code (work for win32com.client but no >> for >> comtypes): >> [code] >> import win32com.client >> acad= win32com.client.Dispatch("__**AutoCAD.Application") >> doc = acad.ActiveDocument >> seleccion=doc.SelectionSets.__**Add('selection1') >> >> seleccion.SelectOnScreen() >> for objeto in seleccion: >> if objeto.ObjectName=='__**AcDbBlockReference': >> bloque=objeto.GetAttributes() >> bloque[0].TagString='__**newattributename' #This change >> >> the name >> for the first attribute in the selected block >> [/code] >> >> Draw line (work for comtypes but doesn't work for win32com.client): >> [code] >> import comtypes.client >> import array >> acad = comtypes.client.__**GetActiveObject("AutoCAD.__** >> Application") >> >> doc = acad.ActiveDocument >> ms = doc.ModelSpace >> pt1 = array.array('d', [0.0,0.0,0.0]) >> pt2=array.array('d',[1.0,1.0,_**_0.0]) >> >> line = ms.AddLine(pt1, pt2) #This draw a line in AutoCAD >> [\code] >> >> My question is: Is posible to fix the problem using win32com to >> draw >> autocad line in order to avoid comtypes use? >> I found on the web several coments to the problem, but no solution. >> >> Thanks for help, >> Daniel Pose. >> >> >> ______________________________**___________________ >> python-win32 mailing list >> python-win32@python.org >> <mailto:python-win32@python.**org<python-win32@python.org> >> > >> >> http://mail.python.org/__**mailman/listinfo/python-win32<http://mail.python.org/__mailman/listinfo/python-win32> >> >> <http://mail.python.org/**mailman/listinfo/python-win32<http://mail.python.org/mailman/listinfo/python-win32> >> > >> >> >> >> >
_______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32