Editing Python Solution to Dimension Tracking

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
This is about half written, if interested email '''[[User:Russ_hensel]]'''  And since written it has been substantially expanded and revised.  I will return to this documentation soon, I hope.
 
 
 
 
 
 
= The Problem =
 
= The Problem =
  
Line 11: Line 7:
 
* Design decisions.
 
* 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]]
+
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 =
 
= A Python Solution =
Line 54: Line 51:
 
** AngleConverter  
 
** AngleConverter  
  
== PartInfo ==
+
=== ===
 
 
Of course a part does not have a dimension it has many dimensions.  So PartInfo is a collection of Part Dimensions all of which can be manipulated as a unit.  There are methods to:
 
 
 
* Support naming of PartInfos ( say "My Gear # 3 " ).
 
* Add a dimension ( or a set of dimensions ).
 
* Access dimensions or there values one by one or as a unit.
 
* Print out all the part dimensions in any particular set of units.
 
 
 
== PartStack ==
 
 
 
This is a collection of PartInfo items, the idea is that this represents several parts that are stacked up to be 3D printed as a unit.  Perhaps more detail later.
 
 
 
 
 
= Use =
 
 
 
I am still working this out but here is an approach:
 
 
 
*In an empty file import the code above ( now cad.py )
 
*Write a function to generate a PartInfo object.  I call my first one something like my_standards_factory:
 
 
 
<pre>
 
# ---------------------------------------------
 
def standards_42_factory():
 
    """
 
    this holds standards
 
    """
 
    a_part                  = cad.PartInfo( "Cad Standards #42 "  )
 
    a_part.freecad_name    = "standards_42"
 
 
 
 
 
    a_part.create_part_dimension(  "washer_thick",      dim_type = "linear", radial = False, value = .1  )
 
    a_part.create_part_dimension(  "gear_clear",        dim_type = "linear", radial = False, value = .2    )
 
    a_part.create_part_dimension(  "gear_thick",        dim_type = "linear", radial = True , value = 4.5      )
 
    a_part.create_part_dimension(  "plate_thick",        dim_type = "linear", radial = False, value = 2.0      )
 
    ....... more
 
</pre>
 
 
 
* and use it:
 
 
 
<pre>
 
    my_standards    = standards_42_factory()
 
    my_standards.print_part()
 
</pre>
 
 
 
The print is just to verify the factory.
 
 
 
Then  ....... more coming .....
 
 
 
 
 
 
 
 
 
 
 
 
 
  
 +
== ==
  
  
  
 
[[Category:FreeCad]] [[Category:Python]]
 
[[Category:FreeCad]] [[Category:Python]]

Please note that all contributions to OpenCircuits may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see OpenCircuits:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)