draftlibs::dxfReader Namespace Reference

Classes

class  InitializationError
class  Object
class  StateMachine

Functions

def convert
def end
def end_section
def error
def findObject
def get_layer
def get_name
def handleBlock
def handleObject
def handleTable
def readDXF
def start
def start_section

Variables

tuple drawing = readDXF(filename)
string filename = r".\examples\block-test.dxf"

Detailed Description

This module provides a function for reading dxf files and parsing them into a useful tree of objects and data.

	The convert function is called by the readDXF fuction to convert dxf strings into the correct data based
	on their type code.  readDXF expects a (full path) file name as input.

Function Documentation

def draftlibs::dxfReader::convert (   code,
  value 
)
Convert a string to the correct Python type based on its dxf code.
code types:
        ints = 60-79, 170-179, 270-289, 370-389, 400-409, 1060-1070
        longs = 90-99, 420-429, 440-459, 1071
        floats = 10-39, 40-59, 110-139, 140-149, 210-239, 460-469, 1010-1059
        hex = 105, 310-379, 390-399
        strings = 0-9, 100, 102, 300-309, 410-419, 430-439, 470-479, 999, 1000-1009

Definition at line 132 of file dxfReader.py.

def draftlibs::dxfReader::end (   cargo  ) 
Expects (infile, drawing) as cargo, called when eof has been reached.

Definition at line 313 of file dxfReader.py.

def draftlibs::dxfReader::end_section (   cargo  ) 
Expects (infile, drawing) as cargo, searches for next section.

Definition at line 302 of file dxfReader.py.

def draftlibs::dxfReader::error (   cargo  ) 
Expects a (infile, string) as cargo, called when there is an error during processing.

Definition at line 321 of file dxfReader.py.

Referenced by Sketcher::SketchPy::addConstraint(), best_fit::ANN(), boost::numeric::bindings::amos::besi(), boost::numeric::bindings::amos::besj(), boost::numeric::bindings::amos::besy(), best_fit::Coarse_correction(), best_fit::CompTotalError(), Approximate::ComputeError(), Py::String::decode(), Py::String::encode(), Raytracing::RayProject::execute(), Part::Plane::execute(), Points::ImportAscii::execute(), Part::ImportStep::execute(), Part::ImportIges::execute(), Part::ImportBrep::execute(), Part::CurveNet::execute(), Drawing::FeaturePage::execute(), App::DocumentPy::getTempFileName(), makeLine(), SpringbackCorrection::Perform(), Base::PyException::PyException(), Approximate::Reparam(), Part::ToroidPy::setAxis(), Part::SpherePy::setAxis(), Part::PlanePy::setAxis(), Part::ParabolaPy::setAxis(), Part::HyperbolaPy::setAxis(), Part::EllipsePy::setAxis(), Part::CylinderPy::setAxis(), Part::ConePy::setAxis(), Part::CirclePy::setAxis(), Part::ArcOfCirclePy::setAxis(), Part::ToroidPy::setCenter(), Part::SpherePy::setCenter(), Part::EllipsePy::setCenter(), Part::CylinderPy::setCenter(), Part::ConePy::setCenter(), Part::CirclePy::setCenter(), Part::ArcOfCirclePy::setCenter(), Part::SurfaceOfRevolutionPy::setDirection(), Part::SurfaceOfExtrusionPy::setDirection(), Part::LinePy::setEndPoint(), Part::SurfaceOfRevolutionPy::setLocation(), Part::ParabolaPy::setLocation(), Part::HyperbolaPy::setLocation(), Data::ComplexGeoDataPy::setMatrix(), Part::OffsetCurvePy::setOffsetDirection(), Data::ComplexGeoDataPy::setPlacement(), Part::PlanePy::setPosition(), App::PropertyLength::setPyObject(), Robot::PropertyTrajectory::setPyObject(), Part::PropertyPartShape::setPyObject(), App::PropertyMaterial::setPyObject(), App::PropertyColorList::setPyObject(), App::PropertyColor::setPyObject(), App::PropertyBool::setPyObject(), App::PropertyStringList::setPyObject(), App::PropertyString::setPyObject(), App::PropertyFloatList::setPyObject(), App::PropertyFloatConstraint::setPyObject(), App::PropertyFloat::setPyObject(), App::PropertyIntegerList::setPyObject(), App::PropertyIntegerConstraint::setPyObject(), App::PropertyEnumeration::setPyObject(), App::PropertyPath::setPyObject(), App::PropertyInteger::setPyObject(), Points::PropertyPointKernel::setPyObject(), App::PropertyLinkSubList::setPyObject(), App::PropertyLinkList::setPyObject(), App::PropertyLinkSub::setPyObject(), App::PropertyLink::setPyObject(), Part::PropertyGeometryList::setPyObject(), App::PropertyPlacement::setPyObject(), App::PropertyMatrix::setPyObject(), App::PropertyVectorList::setPyObject(), App::PropertyVector::setPyObject(), App::PropertyFileIncluded::setPyObject(), Sketcher::PropertyConstraintList::setPyObject(), Mesh::PropertyMeshKernel::setPyObject(), Fem::PropertyFemMesh::setPyObject(), Part::LinePy::setStartPoint(), and Robot::Robot6AxisPy::setTcp().

def draftlibs::dxfReader::findObject (   infile,
  kind = '' 
)
Finds the next occurance of an object.

Definition at line 154 of file dxfReader.py.

def draftlibs::dxfReader::get_layer (   data  ) 
Expects object data as input.

Returns (entry, layer_name) where entry is the data item that provided the layer name.

Definition at line 119 of file dxfReader.py.

def draftlibs::dxfReader::get_name (   data  ) 
Get the name of an object from its object data.

Returns a pair of (data_item, name) where data_item is the list entry where the name was found
(the data_item can be used to remove the entry from the object data).  Be sure to check
name not None before using the returned values!

Definition at line 105 of file dxfReader.py.

def draftlibs::dxfReader::handleBlock (   block,
  infile 
)
Special handler for dealing with nested table objects.

Definition at line 223 of file dxfReader.py.

def draftlibs::dxfReader::handleObject (   infile  ) 
Add data to an object until end of object is found.

Definition at line 176 of file dxfReader.py.

def draftlibs::dxfReader::handleTable (   table,
  infile 
)
Special handler for dealing with nested table objects.

Definition at line 202 of file dxfReader.py.

def draftlibs::dxfReader::readDXF (   filename  ) 
Given a file name try to read it as a dxf file.

Output is an object with the following structure
drawing
        header
                header data
        classes
                class data
        tables
                table data
        blocks
                block data
        entities
                entity data
        objects
                object data
where foo data is a list of sub-objects.  True object data
is of the form [code, data].

Definition at line 331 of file dxfReader.py.

def draftlibs::dxfReader::start (   cargo  ) 
Expects the infile as cargo, initializes the cargo.

Definition at line 253 of file dxfReader.py.

def draftlibs::dxfReader::start_section (   cargo  ) 
Expects [infile, drawing, section] as cargo, builds a nested section object.

Definition at line 264 of file dxfReader.py.


Variable Documentation

string draftlibs::dxfReader::filename = r".\examples\block-test.dxf"

Generated on Wed Nov 23 19:01:54 2011 for FreeCAD by  doxygen 1.6.1