Форум сайта python.su
Уважаемые коллеги! В наличии следующий код:
from comtypes.client import * from comtypes.automation import * def connect_acad(self): errcode = 0 try: self.acad = GetActiveObject("AutoCAD.Application") except: errcode = 1 if errcode == 0: try: self.dwg = self.acad.ActiveDocument except: errcode = 2 if errcode == 0: self.mspace = self.dwg.ModelSpace return errcode def mark_point(self, xy, num, lay): def point(*args): lst = [0.]*3 if len(args) < 3: lst[0:2] = [float(x) for x in args[0:2]] else: lst = [float(x) for x in args[0:3]] return VARIANT(array("d",lst)) txthght = 1.0 txtshft = 0.3 crclrd = 0.3 p1 = point(xy[0], xy[1]) ent = self.mspace.AddCircle(p1, crclrd) ent.Layer = lay #htch = self.mspace.AddHatch(0, 'SOLID', False) #htch.AppendOuterLoop(array("i", [ent,])) #htch.Evaluate() #htch.Layer = lay p1 = point(xy[0]+txtshft, xy[1]+txtshft) sh = len(num) if (len(self.nprefix) > 0) and (len(num.replace(self.nprefix, '')) > 3): sh = sh // 2 th = string.Template('\H'+str(txthght)+';$n') ent = self.mspace.AddMText(p1, sh, th.substitute(n=num)) ent.LineSpacingFactor = 0.7 ent.Layer = lay
Офлайн