thandxfatt.py :  » Business-Application » ThanCad » thancad-0.0.9 » p_gdxf » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Business Application » ThanCad 
ThanCad » thancad 0.0.9 » p_gdxf » thandxfatt.py
#############################################################################
#############################################################################

class ThanDxfAtt:
    "Mixin for setting and writting attributes."

    def __init__(self):
        "Initialisation is not needed, but for compatibility."
        pass

    def thanDxfWrEntry(self, icod, whatever):
        "Writes a basic entry to dxf file."
  self.thanFdxf.write(str(icod) + "\n" + str(whatever) + "\n")

    def thanDxfWrLayer(self):
        "Writes layer name of a entity."
  self.thanFdxf.write("8\n" + self.thanLayer + "\n")

    def thaDxfWrLtype(self):
        "Writes linetype of a linear entity."
        if self.thanLtype != "BYLAYER":
            self.thanFdxf.write("6\n" + self.thanLtype + "\n")

    def thanDxfWrColor(self):
        "Writes color of an entity."
        if self.thanColor != 0:
            self.thanFdxf.write("62\n" + str(self.thanColor) + "\n")

    def thanDxfWrTstyle(self):
        "Writes text style of text entity."
  if self.thanTstyle != "DEFAULT":
            self.thanFdxf.write("7\n" + self.thanTstyle + "\n")

    def thanDxfWrLinatts(self):
        "Writes all the attributes of a linear entity together."
        self.thanFdxf.write("8\n" + self.thanLayer + "\n")
        if self.thanLtype != "BYLAYER":
            self.thanFdxf.write("6\n" + self.thanLtype + "\n")
        if self.thanColor != 0:
            self.thanFdxf.write("62\n" + str(self.thanColor) + "\n")

    def thanDxfWrXy(self, x, y):
        "Writes xy coordinates."
  self.thanFdxf.write("10\n" + str(x) + "\n20\n" + str(y) + "\n")

    def thanDxfWrXyz(self, x, y, z):
        "Writes xyz coordinates."
  self.thanFdxf.write("10\n" + str(x) + "\n20\n" + str(y) + "\n30\n" + str(z) + "\n")

    def thanDxfWrXy1(self, x, y):
        "Writes xyz coordinates."
  self.thanFdxf.write("11\n" + str(x) + "\n21\n" + str(y) + "\n")

    def thanDxfWrXyz1(self, x, y, z):
        "Writes xyz coordinates."
  self.thanFdxf.write("11\n" + str(x) + "\n21\n" + str(y) + "\n31\n" + str(z) + "\n")

    def thanDxfWrXyc(self, c, x, y):
        "Writes xy coordinates."
  self.thanFdxf.write("%d\n%f\n%d\n%f\n" % (10+c, x, 20+c, y))

    def thanDxfWrXyzc(self, c, x, y, z):
        "Writes xyz coordinates."
  self.thanFdxf.write("%d\n%f\n%d\n%f\n%d\n%f\n" % (10+c, x, 20+c, y, 30+c, z))

    def thanDxfSetLayer(self, la):
        "Sets the linetype for subsequent entities."
        self.thanLayer = la

    def thanDxfSetLtype(self, lt):
        "Sets the linetype for subsequent linear entities."
        self.thanLtype = lt

    def thanDxfSetColor(self, co):
        "Sets the color for subsequent entities."
        self.thanColor = co

    def thanDxfSetPlineWidth(self, w1, w2):
        "Sets the text style for subsequent text entities."
        self.thanPlineWidth = (w1, w2)

    def thanDxfSetTstyle(self, lt):
        "Sets the text style for subsequent text entities."
        self.thanTstyle = lt

#############################################################################
#############################################################################

#MODULE LEVEL FUNCTIONS


#############################################################################
#############################################################################

#MODULE LEVEL CODE. IT IS EXECUTED ONLY ONCE

if __name__ == "__main__":
    dxf = ThanDxfAtt()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.