LibreMecaDesign.core package

Submodules

core.container module

class core.container.MyClass(params)[source]

Bases: object

This handles multiple properties of a mechanical object such as :
  • geometry
  • materials
  • external forces
  • internal constrains

core.query module

Provide the base-level search class (layer 0) to fetch values from the database and store them into a class

example:a = search(‘S_ut > 500 MPa AND S_y < 400 MPa AND normalized OR temper | MED:S_y’) print(a.unique_result[‘S_ut’])
return:a list of relevant results. Each result is a dictionary containing the properties. If an optimization keyword was given, the object self.unique_result return the best matching result of the list.

Usage :

  • the syntax is similar to Google search
  • text parameters are fetched in all text properties (name, category, etc.)
  • to retrieve numeric values for properties, use a SQL syntax such as PROPERTY =<> value
  • give every value with its unit
  • if you want only one result, give an optimization keyword with the property to optimizelike : | KEYWORD : parameter.
class core.query.search(query_string)[source]

Handle the queries

build_request()[source]

Build the sqlite3 request with the terms

clean_query(queries)[source]

Shortcut to loop remove_unit element by element in the terms list or nested list

escape_optimization(query_string)[source]

Search for an optimization keyword and store the condition

optimize()[source]
prepare_query(query_string)[source]

Split a query string into keywords and interpretate boolean operators

Parameters:query_string – unformatted string
Returns:nested list of lists of terms to search alternatively
  • the top level list contains the OR arguments
  • the nested lists contain the AND argument
process_query()[source]

Fetch all the matching results

Returns:self.results property
Return type:a list of all matching results built into dictionaries where the key is the property symbol and the value comes from the database
remove_units(query_string)[source]

Replace multiples and units strings by numbers

text_request(term)[source]
value_request(term)[source]

core.utils module

Module contents