importOCA Namespace Reference
OCA (Open CAD Format) file importer & exporter. More...
Functions | |
def createobject (oid, doc) | |
def decodeName (name) | |
def export (exportList, filename) | |
def getarc (data) | |
def getarea (data) | |
def getline (data) | |
def getpoint (data) | |
def gettranslation (data) | |
def insert (filename, docname) | |
def open (filename) | |
def parse (filename, doc) | |
def translate (context, txt) | |
def writepoint (vector) | |
Variables | |
params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft") | |
pythonopen = open | |
Detailed Description
OCA (Open CAD Format) file importer & exporter.
Function Documentation
◆ createobject()
def importOCA.createobject | ( | oid, | |
doc | |||
) |
Create Part::Feature object in the current document.
Parameters
----------
oid : str
ID number of a particular object in the document.
doc : App::Document
A FreeCAD document to which the object is added.
Returns
-------
None
Referenced by parse().
◆ decodeName()
def importOCA.decodeName | ( | name | ) |
Decode encoded name.
Parameters
----------
name : str
The string to decode.
Returns
-------
tuple
(string)
A tuple containing the decoded `name` in 'utf8', otherwise in 'latin1'.
If it fails it returns the original `name`.
◆ export()
def importOCA.export | ( | exportList, | |
filename | |||
) |
Export the OCA file with a given list of objects.
The objects must be edges or faces, in order to be processed
and exported.
Parameters
----------
exportList : list
List of document objects to export.
filename : str
Path to the new file.
Returns
-------
None
If `exportList` doesn't have shapes to export.
References pythonopen, and writepoint().
◆ getarc()
def importOCA.getarc | ( | data | ) |
Turn an OCA arc definition into a FreeCAD Part.Edge.
Parameters
----------
data : list
Different types of data.
Returns
-------
Part.Edge
An edge object from the points in `data`.
References getpoint().
Referenced by parse().
◆ getarea()
def importOCA.getarea | ( | data | ) |
Turn an OCA area definition into a FreeCAD Part.Wire.
Parameters
----------
data : list
Different types of data.
Returns
-------
Part.Wire
A wire object from the points in `data`.
References getpoint().
Referenced by parse().
◆ getline()
def importOCA.getline | ( | data | ) |
Turns an OCA line definition into a FreeCAD Part.Edge.
Parameters
----------
data : list
Different types of data.
Returns
-------
Part.Edge
An edge object from the points in `data`.
References getpoint().
Referenced by parse().
◆ getpoint()
def importOCA.getpoint | ( | data | ) |
◆ gettranslation()
def importOCA.gettranslation | ( | data | ) |
Retrieve a translation (move) vector from `data`.
Parameters
----------
data : list
Different types of data.
Returns
-------
Base::Vector3
A vector with X, Y, or Z displacement, or (0, 0, 0).
Referenced by parse().
◆ insert()
def importOCA.insert | ( | filename, | |
docname | |||
) |
Get an active document and parse.
If no document exist, it is created.
Parameters
----------
filename : str
The path to the filename to be opened.
docname : str
The name of the active App::Document if one exists, or
of the new one created.
Returns
-------
None
References parse().
◆ open()
def importOCA.open | ( | filename | ) |
Open filename and parse.
Parameters
----------
filename : str
The path to the filename to be opened.
Returns
-------
None
References parse().
◆ parse()
def importOCA.parse | ( | filename, | |
doc | |||
) |
Import an opened OCA file into the given document.
Parameters
----------
filename : str
The path to the OCA file.
doc : App::Document
A FreeCAD document to which the object is added.
Returns
-------
None
References createobject(), getarc(), getarea(), getline(), getpoint(), gettranslation(), and pythonopen.
◆ translate()
def importOCA.translate | ( | context, | |
txt | |||
) |
◆ writepoint()
def importOCA.writepoint | ( | vector | ) |
Write a FreeCAD.Vector in OCA format.
Parameters
----------
vector : Base::Vector3
A vector with three components.
Returns
-------
str
A string "P(X Y Z)" with the information from `vector`.
Referenced by export().
Variable Documentation
◆ params
importOCA.params = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft") |