Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import FreeCAD, Part, math
- from FreeCAD import Base
- from __future__ import division # allows floating point division from integers
- import sys
- import os
- try:
- path = os.path.dirname(__file__)
- i = sys.path.index(path)
- except:
- sys.path.append(path)
- #all measurements are in mm until unit conversion is added
- #extrusion_profile 20mm, 25mm, 1"
- extrusion_profile = 20
- #how tall is the gap between the two bottom frame rectangles?
- frame_rectangle_spacing = 30
- #size_type ["extrusion length", "build area", "bounding box"]
- size_type = "extrusion length"
- extrusion_x_length = 300
- extrusion_y_length = 420
- extrusion_diagonal_length = 340
- #build_x_length, build_y_width, build_z_height (build area)
- #outside_x_length, outside_y_width, outsize_z_height (bounding box)
- #x_rail_type ["makerslide", "smooth rod"]
- x_rail_type = "smooth rod"
- x_rod_diameter = 8
- x_rod_spacing = 50
- #x_rod_orientation ["horizontal","vertical"]
- x_rod_orientation = "horizontal"
- #y_rail_type ["makerslide", "smooth rod"]
- y_rail_type = "smooth rod"
- y_rod_diameter = 8
- y_rod_spacing = 100
- #z_rail_type ["makerslide", "smooth rod"]
- z_rail_type = "smooth rod"
- z_rod_diameter = 8
- z_screw_diameter = 8
- #distance from z smooth rod to z threaded rod
- z_rod_spacing = 30
- #["NEMA14", "NEMA17", "NEMA23"]
- #TODO: implement motor module for dimensions, etc
- x_motor_size = "NEMA17"
- y_motor_size = "NEMA17"
- z_motor_size = "NEMA17"
- x_pulley_teeth_count = 36
- x_pulley_teeth_spacing = 2
- x_pulley_pitch_diameter = 72/math.pi
- y_pulley_teeth_count = 36
- y_pulley_teeth_spacing = 2
- y_pulley_pitch_diameter = 72/math.pi
- #should we limit parts to 100mmx100mm build area?
- small_printer = True
- #bushing_type ["printed","IGUS [part#]"LM8UU",etc]
- #y_carriage_height, y_carriage_width, y_carriage_depth
- #x_bearing_type, y_bearing_type ["608ZZ"]
- #build_platform_height, build_platform_width, build_platform_depth
- #absolute minimum thickness of any printed part, this is usually a constraint of the printing method to be used
- thick_min = 1
- #minimum vertical (the layered direction) thickness of any printed part
- thick_min_vertical = 2
- #minimum thickness of a part under compression, such as the edge of bolt holes
- thick_compress = 3
- #typical thickness of printed parts, for flat plates and such
- thick_typical = 4.25
- #TODO: better system for organizing these
- hole_spacing_narrow = 10
- hole_spacing_medium = 20
- hole_spacing_wide = 30
- import partsrc.LowerVertexMiddle
- Part.show(partsrc.LowerVertexMiddle.LowerVertexMiddle())
- ---------- partsrc/__init__.py
- (empty file)
- ---------- partsrc/LowerVertexMiddle.py
- from __future__ import division # allows floating point division from integers
- from FreeCAD import Part
- import math
- def LowerVertexMiddle(
- extrusion_profile = 20,
- frame_rectangle_spacing = 30,
- thick_typical = 4.25
- ):
- #how big are the structural bolts?
- #TODO: replace with use of bolt module after it's written
- bolt_hole_diameter = 5.5
- bolt_head_diameter = 10
- #should there be a visible hole for easy access to the "hidden" bolt?
- accessible_hole = 1
- #should we draw the extrusions for visualization purposes?
- render_extrusions = 0
- #connect the two X extrusions
- box = Part.makeBox(frame_rectangle_spacing+extrusion_profile*2,thick_typical,extrusion_profile)
- box.translate(Base.Vector(0,-thick_typical,0))
- vertex = box
- cylinder = Part.makeCylinder(bolt_hole_diameter/2,thick_typical)
- cylinder.rotate(Base.Vector(0,0,0),Base.Vector(1,0,0),90)
- cylinder.translate(Base.Vector(extrusion_profile/2,0,extrusion_profile/2))
- vertex = vertex.cut(cylinder)
- cylinder.translate(Base.Vector(frame_rectangle_spacing+extrusion_profile,0,0))
- vertex = vertex.cut(cylinder)
- #mount to the top of the top Y extrusion
- box = Part.makeBox(thick_typical,40+extrusion_profile,extrusion_profile)
- box.translate(Base.Vector(-thick_typical,-thick_typical,0))
- vertex = vertex.fuse(box)
- cylinder = Part.makeCylinder(bolt_hole_diameter/2,thick_typical)
- cylinder.rotate(Base.Vector(0,0,0),Base.Vector(0,1,0),-90)
- cylinder.translate(Base.Vector(0,40+extrusion_profile/2-thick_typical,extrusion_profile/2))
- vertex = vertex.cut(cylinder)
- #mount to the top of the diagonal extrusion
- #TODO: cleaner calculation of length of this part to avoid trimming
- box = Part.makeBox(extrusion_profile+40,thick_typical,extrusion_profile)
- box.translate(Base.Vector(-extrusion_profile-15,-thick_typical,0))
- #fill the space below the diagonal extrusion
- box2 = Part.makeBox(extrusion_profile+5,extrusion_profile,extrusion_profile)
- box2.translate(Base.Vector(-15,0,0))
- box = box.fuse(box2)
- cylinder = Part.makeCylinder(bolt_hole_diameter/2,thick_typical)
- cylinder.rotate(Base.Vector(0,0,0),Base.Vector(1,0,0),90)
- cylinder.translate(Base.Vector(-15-extrusion_profile/2,0,extrusion_profile/2))
- box = box.cut(cylinder)
- box.rotate(Base.Vector(0,extrusion_profile,0),Base.Vector(0,0,1),-30)
- vertex = vertex.fuse(box)
- if(accessible_hole):
- cylinder = Part.makeCylinder(bolt_hole_diameter/2,extrusion_profile+60)
- else:
- cylinder = Part.makeCylinder(bolt_hole_diameter/2,extrusion_profile+5)
- cylinder2 = Part.makeCylinder(bolt_head_diameter/2,extrusion_profile+5-thick_typical)
- cylinder2.translate(Base.Vector(0,0,thick_typical))
- cylinder = cylinder.fuse(cylinder2)
- cylinder.rotate(Base.Vector(0,0,0),Base.Vector(0,1,0),90)
- cylinder.translate(Base.Vector(-15,0,0))
- cylinder.translate(Base.Vector(0,extrusion_profile/2,extrusion_profile/2))
- cylinder.rotate(Base.Vector(0,extrusion_profile,0),Base.Vector(0,0,1),-30)
- vertex = vertex.cut(cylinder)
- box = Part.makeBox(extrusion_profile,extrusion_profile,extrusion_profile)
- vertex = vertex.cut(box)
- #TODO: eliminate this trim by cleaning above
- box = Part.makeBox(40,10,extrusion_profile)
- box.translate(Base.Vector(-thick_typical-5,-10-thick_typical,0))
- vertex = vertex.cut(box)
- return vertex
- if __name__ == "__main__":
- Part.show(LowerVertexMiddle())
Add Comment
Please, Sign In to add comment