Difference between revisions of "Python Solution to Dimension Tracking"

From OpenCircuits
Jump to navigation Jump to search
Line 9: Line 9:
 
You more or less need some notes to keep track of this stuff.  Some of this may be paper sketches, paper notes, and digital documents ( many may choose spreadsheets ).  I find spreadsheets to be very error prone so I looked for a python solution.  The very simple version of this is shown in:  [[FreeCad Gear Box]]  This has now evolved, and this document will describe the solution.  For the actual code contact: [[User:Russ_hensel]]  
 
You more or less need some notes to keep track of this stuff.  Some of this may be paper sketches, paper notes, and digital documents ( many may choose spreadsheets ).  I find spreadsheets to be very error prone so I looked for a python solution.  The very simple version of this is shown in:  [[FreeCad Gear Box]]  This has now evolved, and this document will describe the solution.  For the actual code contact: [[User:Russ_hensel]]  
  
 +
 +
= A Python Solution =
 +
 +
My Python solution consists of a set of interacting classes:
 +
 +
== PartDimension ==
 +
This class holds a single dimension.  Of course you can just go:  a_dimention = 22.  What is wrong with that?  This dimension has a name and a value.  What it does not have is units or a type that may help distinguish between pure numbers ( teethe on a gear ), angles, and linear dimensions.  Also I have upgraded the class so that it does easy unit conversions and is easy to print.
 +
 +
Here is what you might get when you print a PartDimension
 +
 +
<pre>
 +
 +
print a_dimension
 +
 +
output:
 +
 +
          bolt_sep            ( mm ) = 25.0
 +
</pre>
 +
 +
=== ===
 +
 +
== ==
  
  
  
 
[[Category:FreeCad]] [[Category:Python]]
 
[[Category:FreeCad]] [[Category:Python]]

Revision as of 09:33, 17 February 2017

The Problem

To make FreeCad work you often need to enter values of various dimensions. There does not seem to be a method internal to FreeCad ( and probably there should not be ). These dimensions come from various sources:

  • Spec. sheets.
  • Measurements
  • Calculations
  • Design decisions.

You more or less need some notes to keep track of this stuff. Some of this may be paper sketches, paper notes, and digital documents ( many may choose spreadsheets ). I find spreadsheets to be very error prone so I looked for a python solution. The very simple version of this is shown in: FreeCad Gear Box This has now evolved, and this document will describe the solution. For the actual code contact: User:Russ_hensel


A Python Solution

My Python solution consists of a set of interacting classes:

PartDimension

This class holds a single dimension. Of course you can just go: a_dimention = 22. What is wrong with that? This dimension has a name and a value. What it does not have is units or a type that may help distinguish between pure numbers ( teethe on a gear ), angles, and linear dimensions. Also I have upgraded the class so that it does easy unit conversions and is easy to print.

Here is what you might get when you print a PartDimension


print a_dimension

output:

          bolt_sep            ( mm ) = 25.0