diff --git a/doc/build/app.html b/doc/build/app.html new file mode 100644 index 00000000..b3a5767a --- /dev/null +++ b/doc/build/app.html @@ -0,0 +1,1894 @@ + + + + + + + + + + FlatCAM Application — Cirkuix 0.5 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

FlatCAM Application

+
+

App

+
+
+class FlatCAM.App
+

The main application class. The constructor starts the GUI.

+
+
+disable_plots(except_current=False)
+

Disables all plots with exception of the current object if specified.

+ +++ + + + + + + + + +
Parameters:except_current – Wether to skip the current object.
Rtype except_current:
 boolean
Returns:None
+
+ +
+
+file_chooser_action(on_success)
+

Opens the file chooser and runs on_success on a separate thread +upon completion of valid file choice.

+ +++ + + + + + +
Parameters:on_success (func) – A function to run upon completion of a valid file +selection. Takes 2 parameters: The app instance and the filename. +Note that it is run on a separate thread, therefore it must take the +appropriate precautions when accessing shared resources.
Returns:None
+
+ +
+
+file_chooser_save_action(on_success)
+

Opens the file chooser and runs on_success upon completion of valid file choice.

+ +++ + + + + + +
Parameters:on_success – A function to run upon selection of a filename. Takes 2 +parameters: The instance of the application (App) and the chosen filename. This +gets run immediately in the same thread.
Returns:None
+
+ +
+
+get_eval(widget_name)
+

Runs eval() on the on the text entry of name ‘widget_name’ +and returns the results.

+ +++ + + + + + +
Parameters:widget_name (str) – Name of Gtk.Entry
Returns:Depends on contents of the entry text.
+
+ +
+
+get_radio_value(radio_set)
+

Returns the radio_set[key] of the radiobutton +whose name is key is active.

+ +++ + + + + + +
Parameters:radio_set (dict) – A dictionary containing widget_name: value pairs.
Returns:radio_set[key]
+
+ +
+
+info(text)
+

Show text on the status bar. This method is thread safe.

+ +++ + + + + + +
Parameters:text (str) – Text to display.
Returns:None
+
+ +
+
+load_defaults()
+

Loads the aplication’s default settings from defaults.json into +self.defaults.

+ +++ + + + +
Returns:None
+
+ +
+
+new_object(kind, name, initialize)
+

Creates a new specalized FlatCAMObj and attaches it to the application, +this is, updates the GUI accordingly, any other records and plots it. +This method is thread-safe.

+ +++ + + + + + + + +
Parameters:
    +
  • kind (str) – The kind of object to create. One of ‘gerber’, +‘excellon’, ‘cncjob’ and ‘geometry’.
  • +
  • name (str) – Name for the object.
  • +
  • initialize (function) – Function to run after creation of the object +but before it is attached to the application. The function is +called with 2 parameters: the new object and the App instance.
  • +
+
Returns:

None

+
Return type:

None

+
+
+ +
+
+on_about(widget)
+

Opens the ‘About’ dialog box.

+ +++ + + + + + +
Parameters:widget – Ignored.
Returns:None
+
+ +
+
+on_activate_name(entry)
+

Hitting ‘Enter’ after changing the name of an item +updates the item dictionary and re-builds the item list.

+ +++ + + + + + +
Parameters:entry – The widget from which this was called.
Returns:None
+
+ +
+
+on_canvas_configure(widget, event)
+

Called whenever the canvas changes size. The axes are updated such +as to use the whole canvas.

+ +++ + + + + + +
Parameters:
    +
  • widget – Ignored.
  • +
  • event – Ignored.
  • +
+
Returns:

None

+
+
+ +
+
+on_cb_plot_toggled(widget)
+

Callback for toggling the “Plot” checkbox. Re-plots.

+ +++ + + + + + +
Parameters:widget – Ignored.
Returns:None
+
+ +
+
+on_clear_plots(widget)
+

Callback for toolbar button. Clears all plots.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_click_over_plot(event)
+

Callback for the mouse click event over the plot. This event is generated +by the Matplotlib backend and has been registered in self.__init__(). +For details, see: http://matplotlib.org/users/event_handling.html

+

Default actions are:

+
    +
  • Copy coordinates to clipboard. Ex.: (65.5473, -13.2679)
  • +
+ +++ + + + + + +
Parameters:event – Contains information about the event, like which button +was clicked, the pixel coordinates and the axes coordinates.
Returns:None
+
+ +
+
+on_closewindow(param)
+

Callback for closing the main window.

+ +++ + + + + + +
Parameters:param – Whatever is passed by the event. Ignore.
Returns:None
+
+ +
+
+on_cncjob_exportgcode(widget)
+

Called from button on CNCjob form to save the G-Code from the object.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_create_aligndrill(widget)
+

Creates alignment holes Excellon object. Creates mirror duplicates +of the specified holes around the specified axis.

+ +++ + + + + + +
Parameters:widget – Ignored.
Returns:None
+
+ +
+
+on_create_mirror(widget)
+

Creates a mirror image of an object to be used as a bottom layer.

+ +++ + + + + + +
Parameters:widget – Ignored.
Returns:None
+
+ +
+
+on_delete(widget)
+

Delete the currently selected FlatCAMObj.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called. Ignored.
Returns:None
+
+ +
+
+on_entry_eval_activate(widget)
+

Called when an entry is activated (eg. by hitting enter) if +set to do so. Its text is eval()’d and set to the returned value. +The current object is updated.

+ +++ + + + + + +
Parameters:widget
Returns:
+
+ +
+
+on_eval_update(widget)
+

Modifies the content of a Gtk.Entry by running +eval() on its contents and puting it back as a +string.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_excellon_tool_choose(widget)
+

Callback for button on Excellon form to open up a window for +selecting tools.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_file_new(param)
+

Callback for menu item File->New. Returns the application to its +startup state. This method is thread-safe.

+ +++ + + + + + +
Parameters:param – Whatever is passed by the event. Ignore.
Returns:None
+
+ +
+
+on_file_openproject(param)
+

Callback for menu item File->Open Project. Opens a file chooser and calls +self.open_project() after successful selection of a filename.

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_file_savedefaults(param)
+

Callback for menu item File->Save Defaults. Saves application default options +self.defaults to defaults.json.

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_file_saveproject(param)
+

Callback for menu item File->Save Project. Saves the project to +self.project_filename or calls self.on_file_saveprojectas() +if set to None. The project is saved by calling self.save_project().

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_file_saveprojectas(param)
+

Callback for menu item File->Save Project As... Opens a file +chooser and saves the project to the given file via +self.save_project().

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_file_saveprojectcopy(param)
+

Callback for menu item File->Save Project Copy... Opens a file +chooser and saves the project to the given file via +self.save_project. It does not update self.project_filename so +subsequent save requests are done on the previous known filename.

+ +++ + + + + + +
Parameters:param – Ignore.
Returns:None
+
+ +
+
+on_fileopenexcellon(param)
+

Callback for menu item File->Open Excellon. Defines a function that is then passed +to self.file_chooser_action(). It requests the creation of a FlatCAMExcellon object +and updates the progress bar throughout the process.

+ +++ + + + + + +
Parameters:param – Ignore
Returns:None
+
+ +
+
+on_fileopengcode(param)
+

Callback for menu item File->Open G-Code. Defines a function that is then passed +to self.file_chooser_action(). It requests the creation of a FlatCAMCNCjob object +and updates the progress bar throughout the process.

+ +++ + + + + + +
Parameters:param – Ignore
Returns:None
+
+ +
+
+on_fileopengerber(param)
+

Callback for menu item File->Open Gerber. Defines a function that is then passed +to self.file_chooser_action(). It requests the creation of a FlatCAMGerber object +and updates the progress bar throughout the process.

+ +++ + + + + + +
Parameters:param – Ignore
Returns:None
+
+ +
+
+on_filequit(param)
+

Callback for menu item File->Quit. Closes the application.

+ +++ + + + + + +
Parameters:param – Whatever is passed by the event. Ignore.
Returns:None
+
+ +
+
+on_generate_cncjob(widget)
+

Callback for button on geometry form to generate CNC job.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_generate_excellon_cncjob(widget)
+

Callback for button active/click on Excellon form to +create a CNC Job for the Excellon file.

+ +++ + + + + + +
Parameters:widget – Ignored
Returns:None
+
+ +
+
+on_generate_gerber_bounding_box(widget)
+

Callback for request from the Gerber form to generate a bounding box for the +geometry in the object. Creates a FlatCAMGeometry with the bounding box. +The box can have rounded corners if specified in the form.

+ +++ + + + + + +
Parameters:widget – Ignored.
Returns:None
+
+ +
+
+on_generate_isolation(widget)
+

Callback for button on Gerber form to create isolation routing geometry.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_generate_paintarea(widget)
+

Callback for button on geometry form. +Subscribes to the “Click on plot” event and continues +after the click. Finds the polygon containing +the clicked point and runs clear_poly() on it, resulting +in a new FlatCAMGeometry object.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_gerber_generate_cutout(widget)
+

Callback for button on Gerber form to create geometry with lines +for cutting off the board.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_gerber_generate_noncopper(widget)
+

Callback for button on Gerber form to create a geometry object +with polygons covering the area without copper or negative of the +Gerber.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_key_over_plot(event)
+

Callback for the key pressed event when the canvas is focused. Keyboard +shortcuts are handled here. So far, these are the shortcuts:

+ ++++ + + + + + + + + + + + + + + + + + + + +
KeyAction
‘1’Zoom-fit. Fits the axes limits to the data.
‘2’Zoom-out.
‘3’Zoom-in.
‘m’Toggle on-off the measuring tool.
+ +++ + + + + + +
Parameters:event – Ignored.
Returns:None
+
+ +
+
+on_mouse_move_over_plot(event)
+

Callback for the mouse motion event over the plot. This event is generated +by the Matplotlib backend and has been registered in self.__init__(). +For details, see: http://matplotlib.org/users/event_handling.html

+ +++ + + + + + +
Parameters:event – Contains information about the event.
Returns:None
+
+ +
+
+on_offset_object(widget)
+

Offsets the object’s geometry by the vector specified +in the form. Re-plots.

+ +++ + + + + + +
Parameters:widget – Ignored
Returns:None
+
+ +
+
+on_options_app2object(param)
+

Callback for Options->Transfer Options->App=>Object. Copies options +from application defaults to the currently selected object.

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_options_app2project(param)
+

Callback for Options->Transfer Options->App=>Project. Copies options +from application defaults to project defaults.

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_options_combo_change(widget)
+

Called when the combo box to choose between application defaults and +project option changes value. The corresponding variables are +copied to the UI.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called. Ignore.
Returns:None
+
+ +
+
+on_options_object2app(param)
+

Callback for Options->Transfer Options->Object=>App. Copies options +from the currently selected object to application defaults.

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_options_object2project(param)
+

Callback for Options->Transfer Options->Object=>Project. Copies options +from the currently selected object to project defaults.

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_options_project2app(param)
+

Callback for Options->Transfer Options->Project=>App. Copies options +from project defaults to application defaults.

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_options_project2object(param)
+

Callback for Options->Transfer Options->Project=>Object. Copies options +from project defaults to the currently selected object.

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_options_update(widget)
+

Called whenever a value in the options/defaults form changes. +All values are updated. Can be inhibited by setting self.options_update_ignore = True, +which may be necessary when updating the UI from code and not by the user.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called. Ignore.
Returns:None
+
+ +
+
+on_row_activated(widget, path, col)
+

Callback for selection activation (Enter or double-click) on the Project list. +Switches the notebook page to the object properties form. Calls +self.notebook.set_current_page(1).

+ +++ + + + + + +
Parameters:
    +
  • widget – Ignored.
  • +
  • path – Ignored.
  • +
  • col – Ignored.
  • +
+
Returns:

None

+
+
+ +
+
+on_scale_object(widget)
+

Callback for request to change an objects geometry scale. The object +is re-scaled and replotted.

+ +++ + + + + + +
Parameters:widget – Ignored.
Returns:None
+
+ +
+
+on_toggle_pointbox(widget)
+

Callback for radio selection change between point and box in the +Double-sided PCB tool. Updates the UI accordingly.

+ +++ + + + + + +
Parameters:widget – Ignored.
Returns:None
+
+ +
+
+on_toggle_units(widget)
+

Callback for the Units radio-button change in the Options tab. +Changes the application’s default units or the current project’s units. +If changing the project’s units, the change propagates to all of +the objects in the project.

+ +++ + + + + + +
Parameters:widget – Ignored.
Returns:None
+
+ +
+
+on_toolbar_replot(widget)
+

Callback for toolbar button. Re-plots all objects.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called.
Returns:None
+
+ +
+
+on_tools_doublesided(param)
+

Callback for menu item Tools->Double Sided PCB Tool. Launches the +tool placing its UI in the “Tool” tab in the notebook.

+ +++ + + + + + +
Parameters:param – Ignored.
Returns:None
+
+ +
+
+on_update_plot(widget)
+

Callback for button on form for all kinds of objects. +Re-plots the current object only.

+ +++ + + + + + +
Parameters:widget – The widget from which this was called. Ignored.
Returns:None
+
+ +
+
+on_zoom_fit(event)
+

Callback for zoom-out request. This can be either from the corresponding +toolbar button or the ‘1’ key when the canvas is focused. Calls self.adjust_axes() +with axes limits from the geometry bounds of all objects.

+ +++ + + + + + +
Parameters:event – Ignored.
Returns:None
+
+ +
+
+on_zoom_in(event)
+

Callback for zoom-in request. This can be either from the corresponding +toolbar button or the ‘3’ key when the canvas is focused. Calls self.zoom().

+ +++ + + + + + +
Parameters:event – Ignored.
Returns:None
+
+ +
+
+on_zoom_out(event)
+

Callback for zoom-out request. This can be either from the corresponding +toolbar button or the ‘2’ key when the canvas is focused. Calls self.zoom().

+ +++ + + + + + +
Parameters:event – Ignored.
Returns:None
+
+ +
+
+open_project(filename)
+

Loads a project from the specified file.

+ +++ + + + + + +
Parameters:filename (str) – Name of the file from which to load.
Returns:None
+
+ +
+
+options2form()
+

Sets the ‘Project Options’ or ‘Application Defaults’ form with values from +self.options or self.defaults.

+ +++ + + + + + +
Returns:None
Return type:None
+
+ +
+
+plot_all()
+

Re-generates all plots from all objects.

+ +++ + + + +
Returns:None
+
+ +
+
+populate_objects_combo(combo)
+

Populates a Gtk.Comboboxtext with the list of the object in the project.

+ +++ + + + + + +
Parameters:combo (str or Gtk.ComboBoxText) – Name or instance of the comboboxtext.
Returns:None
+
+ +
+
+read_form()
+

Reads the options form into self.defaults/self.options.

+ +++ + + + + + +
Returns:None
Return type:None
+
+ +
+
+read_form_item(name, dest)
+

Reads the value of a form item in the defaults/options form and +saves it to the corresponding dictionary.

+ +++ + + + + + +
Parameters:
    +
  • name (str) – Name of the form item. A key in self.defaults or +self.options.
  • +
  • dest (dict) – Dictionary to which to save the value.
  • +
+
Returns:

None

+
+
+ +
+
+save_project(filename)
+

Saves the current project to the specified file.

+ +++ + + + + + +
Parameters:filename (str) – Name of the file in which to save.
Returns:None
+
+ +
+
+set_form_item(name, value)
+

Sets a form item ‘name’ in the GUI with the given ‘value’. The syntax of +form names in the GUI is <kind>_app_<name>, where kind is one of: rb (radio button), +cb (check button), entry_eval or entry_text (entry), combo (combo box). name is +whatever name it’s been given. For self.defaults, name is a key in the dictionary.

+ +++ + + + + + +
Parameters:
    +
  • name (str) – Name of the form field.
  • +
  • value (Depends on field kind.) – The value to set the form field to.
  • +
+
Returns:

None

+
+
+ +
+
+set_progress_bar(percentage, text='')
+

Sets the application’s progress bar to a given frac_digits and text.

+ +++ + + + + + +
Parameters:
    +
  • percentage (float) – The frac_digits (0.0-1.0) of the progress.
  • +
  • text (str) – Text to display on the progress bar.
  • +
+
Returns:

None

+
+
+ +
+
+setup_component_editor()
+

Initial configuration of the component editor. Creates +a page titled “Selection” on the notebook on the left +side of the main window.

+ +++ + + + +
Returns:None
+
+ +
+
+setup_obj_classes()
+

Sets up application specifics on the FlatCAMObj class.

+ +++ + + + +
Returns:None
+
+ +
+
+versionCheck(*args)
+

Checks for the latest version of the program. Alerts the +user if theirs is outdated. This method is meant to be run +in a saeparate thread.

+ +++ + + + +
Returns:None
+
+ +
+ +
+
+

PlotCanvas

+
+
+class FlatCAM.PlotCanvas(container)
+

Class handling the plotting area in the application.

+
+
+adjust_axes(xmin, ymin, xmax, ymax)
+

Adjusts all axes while maintaining the use of the whole canvas +and an aspect ratio to 1:1 between x and y axes. The parameters are an original +request that will be modified to fit these restrictions.

+ +++ + + + + + +
Parameters:
    +
  • xmin (float) – Requested minimum value for the X axis.
  • +
  • ymin (float) – Requested minimum value for the Y axis.
  • +
  • xmax (float) – Requested maximum value for the X axis.
  • +
  • ymax (float) – Requested maximum value for the Y axis.
  • +
+
Returns:

None

+
+
+ +
+
+auto_adjust_axes(*args)
+

Calls adjust_axes() using the extents of the base axes.

+

:rtype : None +:return: None

+
+ +
+
+clear()
+

Clears axes and figure.

+ +++ + + + +
Returns:None
+
+ +
+
+connect(event_name, callback)
+

Attach an event handler to the canvas through the native GTK interface.

+ +++ + + + + + +
Parameters:
    +
  • event_name (str) – Name of the event
  • +
  • callback (function) – Function to call
  • +
+
Returns:

Nothing

+
+
+ +
+
+mpl_connect(event_name, callback)
+

Attach an event handler to the canvas through the Matplotlib interface.

+ +++ + + + + + + + +
Parameters:
    +
  • event_name (str) – Name of the event
  • +
  • callback (func) – Function to call
  • +
+
Returns:

Connection id

+
Return type:

int

+
+
+ +
+
+mpl_disconnect(cid)
+

Disconnect callback with the give id. +:param cid: Callback id. +:return: None

+
+ +
+
+new_axes(name)
+

Creates and returns an Axes object attached to this object’s Figure.

+ +++ + + + + + + + +
Parameters:name – Unique label for the axes.
Returns:Axes attached to the figure.
Return type:Axes
+
+ +
+
+on_key_down(event)
+
+++ + + + + + +
Parameters:event
Returns:
+
+ +
+
+on_key_up(event)
+
+++ + + + + + +
Parameters:event
Returns:
+
+ +
+
+on_mouse_move(event)
+

Mouse movement event hadler.

+ +++ + + + + + +
Parameters:event – Contains information about the event.
Returns:None
+
+ +
+
+on_scroll(canvas, event)
+

Scroll event handler.

+ +++ + + + + + +
Parameters:
    +
  • canvas – The widget generating the event. Ignored.
  • +
  • event – Event object containing the event information.
  • +
+
Returns:

None

+
+
+ +
+
+zoom(factor, center=None)
+

Zooms the plot by factor around a given +center point. Takes care of re-drawing.

+ +++ + + + + + +
Parameters:
    +
  • factor (float) – Number by which to scale the plot.
  • +
  • center (list) – Coordinates [x, y] of the point around which to scale the plot.
  • +
+
Returns:

None

+
+
+ +
+ +
+
+

ObjectCollection

+
+
+class FlatCAM.ObjectCollection
+
+
+append(obj, active=False)
+

Add a FlatCAMObj the the collection. This method is thread-safe.

+ +++ + + + + + +
Parameters:
    +
  • obj (FlatCAMObj) – FlatCAMObj to append
  • +
  • active (bool) – If it is to become the active object after appending
  • +
+
Returns:

None

+
+
+ +
+
+change_name(old_name, new_name)
+

Changes the name of FlatCAMObj named old_name to new_name.

+ +++ + + + + + + + +
Parameters:
    +
  • old_name (str) – Name of the object to change.
  • +
  • new_name (str) – New name.
  • +
+
Returns:

True if name change succeeded, False otherwise. Will fail +if no object with old_name is found.

+
Return type:

bool

+
+
+ +
+
+get_bounds()
+

Finds coordinates bounding all objects in the collection.

+ +++ + + + + + +
Returns:[xmin, ymin, xmax, ymax]
Return type:list
+
+ +
+
+get_by_name(name)
+

Fetches the FlatCAMObj with the given name.

+ +++ + + + + + + + +
Parameters:name (str) – The name of the object.
Returns:The requested object or None if no such object.
Return type:FlatCAMObj or None
+
+ +
+
+get_list()
+

Returns a list with all FlatCAMObj.

+ +++ + + + + + +
Returns:List with all FlatCAMObj.
Return type:list
+
+ +
+
+get_names()
+

Gets a list of the names of all objects in the collection.

+ +++ + + + + + +
Returns:List of names.
Return type:list
+
+ +
+
+on_list_selection_change(selection)
+

Callback for change in selection on the objects’ list. +Instructs the new selection to build the UI for its options.

+ +++ + + + + + +
Parameters:selection – Ignored.
Returns:None
+
+ +
+
+on_row_activated(*args)
+

Does nothing right now. +:param args: Ignored. +:return: None

+
+ +
+
+set_active(name)
+

Sets an object as the active object in the program. Same +as set_list_selection().

+ +++ + + + + + +
Parameters:name (str) – Name of the object.
Returns:None
+
+ +
+
+set_list_selection(name)
+

Sets which object should be selected in the list.

+ +++ + + + + + + + +
Parameters:name – Name of the object.
Rtype name:str
Returns:None
+
+ +
+ +
+
+

Measurement

+
+
+class FlatCAM.Measurement(container, plotcanvas, update=None)
+
+ +
+
+ + +
+ +
+
+ +
+ +
+ + + + \ No newline at end of file diff --git a/doc/build/devman.html b/doc/build/devman.html new file mode 100644 index 00000000..35a8adca --- /dev/null +++ b/doc/build/devman.html @@ -0,0 +1,231 @@ + + + + + + + + + + FlatCAM Developer Manual — Cirkuix 0.5 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

FlatCAM Developer Manual

+
+

Options

+

There are Application Defaults, Project Options and Object Options in FlatCAM.

+

Application Defaults are stored in app.defaults. This gets populated (updated) from the defaults.json file upon startup. These can be edited from the Options tab, where each widget calls app.on_options_update() if a change is detected. This function iterates over the keys of app.defaults and reads the GUI elements whose name is type + "_app_" key. Therefore, for an option to be recognized, it must be added to defaults.json in the first place. When saving, done in app.on_file_savedefaults(), the file is updated, not overwritten.

+

Project Options inherit all options from Application Defaults upon startup. They can be changed thereafter from the UI or by opening a project, which contain previously saved Project Options. These are store in app.options and can be written and read from the Options tab in the same way as with Application defaults.

+

Object Options for each object are inherited from Project Options upon creation of each new object. They can be modified independently from the Project’s options thereafter through the UI, where the widget containing the option is identified by name: type + kind + "_" + option. They are stored in object.options. They are saved along the Project options when saving the project.

+

The syntax of UI widget names contain a type, which identifies what type of widget it is and how its value is supposed to be fetched, and a kind, which refer to what kind of FlatCAM Object it is for.

+
+
+

Serialization

+

Serialization refers to converting objects into a form that can be saved in a text file and recontructing objects from a text file.

+

Saving and loading projects require serialization. These are done in App.save_project(filename) and App.open_project(filename).

+

Serialization in FlatCAM takes 2 forms. The first is calling objects’ to_dict() method, which is inherited from Geometry.to_dict():

+
def to_dict(self):
+    """
+    Returns a respresentation of the object as a dictionary.
+    Attributes to include are listed in ``self.ser_attrs``.
+
+    :return: A dictionary-encoded copy of the object.
+    :rtype: dict
+    """
+    d = {}
+    for attr in self.ser_attrs:
+        d[attr] = getattr(self, attr)
+    return d
+
+
+

This creates a dictionary with attributes specified in the object’s ser_attrs list. If these are not in a serialized form, they will be processed later by the function to_dict():

+
def to_dict(geo):
+    """
+    Makes a Shapely geometry object into serializeable form.
+
+    :param geo: Shapely geometry.
+    :type geo: BaseGeometry
+    :return: Dictionary with serializable form if ``geo`` was
+        BaseGeometry, otherwise returns ``geo``.
+    """
+    if isinstance(geo, BaseGeometry):
+        return {
+            "__class__": "Shply",
+            "__inst__": sdumps(geo)
+        }
+    return geo
+
+
+

This is used in json.dump(d, f, default=to_dict) and is applied to objects that json encounters to be in a non-serialized form.

+
+
+

Geometry Processing

+
+
+ + +
+ +
+
+ +
+ +
+ + + + \ No newline at end of file diff --git a/doc/build/flatcamobj.html b/doc/build/flatcamobj.html new file mode 100644 index 00000000..9cf0151a --- /dev/null +++ b/doc/build/flatcamobj.html @@ -0,0 +1,451 @@ + + + + + + + + + + FlatCAM Objects — Cirkuix 0.5 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+ +
+

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
+
+ +
+ +
+
+ + +
+ +
+
+ +
+ +
+ + + + \ No newline at end of file diff --git a/share/bug16.png b/share/bug16.png new file mode 100644 index 00000000..ba62ffd9 Binary files /dev/null and b/share/bug16.png differ diff --git a/share/clear_plot16.png b/share/clear_plot16.png new file mode 100644 index 00000000..4f77d00c Binary files /dev/null and b/share/clear_plot16.png differ diff --git a/share/cnc16.png b/share/cnc16.png new file mode 100644 index 00000000..ee0fb0aa Binary files /dev/null and b/share/cnc16.png differ diff --git a/share/drill16.png b/share/drill16.png new file mode 100644 index 00000000..d7091621 Binary files /dev/null and b/share/drill16.png differ diff --git a/share/geometry16.png b/share/geometry16.png new file mode 100644 index 00000000..c7845323 Binary files /dev/null and b/share/geometry16.png differ diff --git a/share/project16.png b/share/project16.png new file mode 100644 index 00000000..f5129e47 Binary files /dev/null and b/share/project16.png differ diff --git a/share/replot16.png b/share/replot16.png new file mode 100644 index 00000000..7ca80920 Binary files /dev/null and b/share/replot16.png differ diff --git a/share/warning.png b/share/warning.png new file mode 100644 index 00000000..10f094a7 Binary files /dev/null and b/share/warning.png differ