FlatCAM Objects

FlatCAMObj

class FlatCAM.FlatCAMObj(name)

Base type of objects handled in FlatCAM. These become interactive in the GUI, can be plotted, and their options can be modified by the user in their respective forms.

build_ui()

Sets up the UI/form for this object.

Returns:None
Return type:None
deserialize(obj_dict)

Re-builds an object from its serialized version.

Parameters:obj_dict (dict) – Dictionary representing a FlatCAMObj
Returns:None
plot()

Plot this object (Extend this method to implement the actual plotting). Axes get created, appended to canvas and cleared before plotting. Call this in descendants before doing the plotting.

Returns:Whether to continue plotting or not depending on the “plot” option.
Return type:bool
read_form()

Reads form into self.options.

Returns:None
Return type:None
read_form_item(option)

Reads the specified option from the UI form into self.options.

Parameters:option (str) – Name of the option.
Returns:None
serialize()

Returns a representation of the object as a dictionary so it can be later exported as JSON. Override this method.

Returns:Dictionary representing the object
Return type:dict
set_form_item(option)

Copies the specified option to the UI form.

Parameters:option (str) – Name of the option (Key in self.options).
Returns:None
setup_axes(figure)

1) Creates axes if they don’t exist. 2) Clears axes. 3) Attaches them to figure if not part of the figure. 4) Sets transparent background. 5) Sets 1:1 scale aspect ratio.

Parameters:figure (matplotlib.figure.Figure) – A Matplotlib.Figure on which to add/configure axes.
Returns:None
Return type:None
to_form()

Copies options to the UI form.

Returns:None

FlatCAMGerber

class FlatCAM.FlatCAMGerber(name)

Represents Gerber code.

convert_units(units)

Converts the units of the object by scaling dimensions in all geometry and options.

Parameters:units (str) – Units to which to convert the object: “IN” or “MM”.
Returns:None
Return type:None

FlatCAMExcellon

class FlatCAM.FlatCAMExcellon(name)

Represents Excellon/Drill code.

FlatCAMCNCjob

class FlatCAM.FlatCAMCNCjob(name, units='in', kind='generic', z_move=0.1, feedrate=3.0, z_cut=-0.002, tooldia=0.0)

Represents G-Code.

FlatCAMGeometry

class FlatCAM.FlatCAMGeometry(name)

Geometric object not associated with a specific format.

offset(vect)

Offsets all geometry by a given vector/

Parameters:vect (tuple) – (x, y) vector by which to offset the object’s geometry.
Returns:None
Return type:None
plot()

Plots the object into its axes. If None, of if the axes are not part of the app’s figure, it fetches new ones.

Returns:None
scale(factor)

Scales all geometry by a given factor.

Parameters:factor (float) – Factor by which to scale the object’s geometry/
Returns:None
Return type:None