def openDXF(self,fileName):
     d=self.getView().getDrawing()
     for et in dxfreader.getEtt(fileName):
         if et["0"]=="LINE":
             x0=float(et["10"])
             y0=float(et["20"])
             p0=pyHPoint(x0,y0)
             x1=float(et["11"])
             y1=float(et["21"])
             p1=pyHPoint(x1,y1)
             l=pyHPolylineFigure()
             l.addPoint(p0)
             l.addPoint(p1)
             d.addFigure(l)
         if et["0"]=="CIRCLE":
             x0=float(et["10"])
             y0=float(et["20"])
             r =float(et["40"])
             c=pyHEllipseFigure(x0-r,y0-r,2*r,2*r)
             d.addFigure(c)
         if et["0"]=="POINT":
             x0=float(et["10"])
             y0=float(et["20"])
             r =2
             c=pyHEllipseFigure(x0-r,y0-r,2*r,2*r)
             d.addFigure(c)
         if et["0"]=="ARC":
             x0=float(et["10"])
             y0=float(et["20"])
             r =float(et["40"])
             ans=float(et["50"])
             ane=float(et["51"])
             c=pyHArcFigure(x0-r,y0-r,2*r,2*r,ans,ane)
             d.addFigure(c)
         if et["0"]=="LWPOLYLINE":
             xs=et["10"]
             ys=et["20"]
             c=pyHPolylineFigure()
             for i,x in enumerate(xs):
                 p=pyHPoint(float(x),float(ys[i]))
                 c.addPoint(p)
             d.addFigure(c)
         if et["0"]=="SPLINE":
             xs=et["10"]
             ys=et["20"]
             c=pyHSplineFigure()
             for i,x in enumerate(xs):
                 p=pyHPoint(float(x),float(ys[i]))
                 c.addPoint(p)
             d.addFigure(c)
     self.fillTree()
Пример #2
0
 def openDXF(self, fileName):
     d = self.getView().getDrawing()
     for et in dxfreader.getEtt(fileName):
         if et["0"] == "LINE":
             x0 = float(et["10"])
             y0 = float(et["20"])
             p0 = pyHPoint(x0, y0)
             x1 = float(et["11"])
             y1 = float(et["21"])
             p1 = pyHPoint(x1, y1)
             l = pyHPolylineFigure()
             l.addPoint(p0)
             l.addPoint(p1)
             d.addFigure(l)
         if et["0"] == "CIRCLE":
             x0 = float(et["10"])
             y0 = float(et["20"])
             r = float(et["40"])
             c = pyHEllipseFigure(x0 - r, y0 - r, 2 * r, 2 * r)
             d.addFigure(c)
         if et["0"] == "POINT":
             x0 = float(et["10"])
             y0 = float(et["20"])
             r = 2
             c = pyHEllipseFigure(x0 - r, y0 - r, 2 * r, 2 * r)
             d.addFigure(c)
         if et["0"] == "ARC":
             x0 = float(et["10"])
             y0 = float(et["20"])
             r = float(et["40"])
             ans = float(et["50"])
             ane = float(et["51"])
             c = pyHArcFigure(x0 - r, y0 - r, 2 * r, 2 * r, ans, ane)
             d.addFigure(c)
         if et["0"] == "LWPOLYLINE":
             xs = et["10"]
             ys = et["20"]
             c = pyHPolylineFigure()
             for i, x in enumerate(xs):
                 p = pyHPoint(float(x), float(ys[i]))
                 c.addPoint(p)
             d.addFigure(c)
         if et["0"] == "SPLINE":
             xs = et["10"]
             ys = et["20"]
             c = pyHSplineFigure()
             for i, x in enumerate(xs):
                 p = pyHPoint(float(x), float(ys[i]))
                 c.addPoint(p)
             d.addFigure(c)
     self.fillTree()
 def onMouseDown(self,e):
     self.f=pyHPolylineFigure()
     p=pyHPoint(e.getX(),e.getY())
     self.f.addPoint(p)
     p=pyHPoint(e.getX(),e.getY())
     self.f.addPoint(p)
     self.view.getDrawing().addFigure(self.f)
Пример #4
0
 def onMouseDown(self, e):
     self.f = pyHPolylineFigure()
     p = pyHPoint(e.getX(), e.getY())
     self.f.addPoint(p)
     p = pyHPoint(e.getX(), e.getY())
     self.f.addPoint(p)
     self.view.getDrawing().addFigure(self.f)
Пример #5
0
 def openPLT(self, fileName):
     d = self.getView().getDrawing()
     f = pyHPolylineFigure()
     for t in pltreader.getPLT(fileName):
         if len(t) == 3:
             c, x, y = t
             if pltreader.isPU(c):
                 if f:
                     if len(f.getPoints()) > 1:
                         d.addFigure(f)
                 f = pyHPolylineFigure()
                 xf = float(x) * 0.025
                 yf = float(y) * 0.025
                 p = pyHPoint(xf, yf)
                 f.addPoint(p)
             elif pltreader.isPD(c):
                 xf = float(x) * 0.025
                 yf = float(y) * 0.025
                 p = pyHPoint(xf, yf)
                 f.addPoint(p)
 def openPLT(self,fileName):
     d=self.getView().getDrawing()
     f=pyHPolylineFigure()
     for t in pltreader.getPLT(fileName):
         if len(t)==3:
             c,x,y=t
             if pltreader.isPU(c):
                 if f:
                     if len(f.getPoints())>1:
                         d.addFigure(f)
                 f=pyHPolylineFigure()
                 xf=float(x)*0.025
                 yf=float(y)*0.025
                 p=pyHPoint(xf,yf)
                 f.addPoint(p)
             elif pltreader.isPD(c):
                 xf=float(x)*0.025
                 yf=float(y)*0.025
                 p=pyHPoint(xf,yf)
                 f.addPoint(p)
Пример #7
0
 def __init__(self, v):
     '''
     Constructor
     '''
     self.view = v
     self.f = pyHPolylineFigure()
 def __init__(self,v):
     '''
     Constructor
     '''
     self.view=v
     self.f=pyHPolylineFigure()