Got module working with embedded packages and cleaned up file headers.

This commit is contained in:
Jeremy Wright 2014-11-28 16:45:22 -05:00
parent 5cb1623711
commit 50844a2dd1
38 changed files with 173 additions and 561 deletions

View File

@ -1,22 +1,4 @@
#File: Ex001_Simple_Block.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex001_Simple_Block
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex001_Simple_Block)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more in-depth explanation of this example at http://parametricparts.com/docs/quickstart.html
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,21 +1,4 @@
#File: Ex002_Block_With_Bored_Center_Hole.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex002_Block_With_Bored_Center_Hole
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex002_Block_With_Bored_Center_Hole)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more in-depth explantion of this example at http://parametricparts.com/docs/quickstart.html
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,22 +1,4 @@
#File: Ex003_Pillow_Block_With_Counterbored_Holes.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex003_Pillow_Block_With_Counterbored_Holes
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex003_Pillow_Block_With_Counterbored_Holes)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more in-depth explanation of this example at http://parametricparts.com/docs/quickstart.html
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex004_Extruded_Cylindrical_Plate.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex004_Extruded_Cylindrical_Plate
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex004_Extruded_Cylindrical_Plate)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex005_Extruded_Lines_and_Arcs.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex005_Extruded_Lines_and_Arcs
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex005_Extruded_Lines_and_Arcs)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
#(Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex006_Moving_the_Current_Working_Point.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex006_Moving_the_Current_Working_Point
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex006_Moving_the_Current_Working_Point)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex007_Using_Point_Lists.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex007_Using_Point_Lists
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex007_Using_Point_Lists)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex008_Polygon_Creation.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex008_Polygon_Creation
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex008_Polygon_Creation)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex009_Polylines.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex009_Polylines
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex009_Polylines)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex010_Defining_an_Edge_with_a_Spline.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex010_Defining_an_Edge_with_a_Spline
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex010_Defining_an_Edge_with_a_Spline)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex011_Mirroring_Symmetric_Geometry.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex011_Mirroring_Symmetric_Geometry
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex011_Mirroring_Symmetric_Geometry)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex012_Creating_Workplanes_on_Faces.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex012_Creating_Workplanes_on_Faces
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex012_Creating_Workplanes_on_Faces)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex013_Locating_a_Workplane_on_a_Vertex.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex013_Locating_a_Workplane_on_a_Vertex
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex013_Locating_a_Workplane_on_a_Vertex)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex014_Offset_Workplanes.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex014_Offset_Workplanes
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex014_Offset_Workplanes)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex015_Rotated_Workplanes.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex015_Rotated_Workplanes
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex015_Rotated_Workplanes)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
from cadquery import Vector
import Part

View File

@ -1,23 +1,4 @@
#File: Ex016_Using_Construction_Geometry.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex016_Using_Construction_Geometry
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex016_Using_Construction_Geometry)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex017_Shelling_to_Create_Thin_Features.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex017_Shelling_to_Create_Thin_Features
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex017_Shelling_to_Create_Thin_Features)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex018_Making_Lofts.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex018_Making_Lofts
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex018_Making_Lofts)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex019_Counter_Sunk_Holes.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex019_Counter_Sunk_Holes
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex019_Counter_Sunk_Holes)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex020_Rounding_Corners_with_Fillets.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex020_Rounding_Corners_with_Fillets
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex020_Rounding_Corners_with_Fillets)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex021_Splitting_an_Object.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex021_Splitting_an_Object
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex021_Splitting_an_Object)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex022_Classic_OCC_Bottle.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex022_Classic_OCC_Bottle
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex022_Classic_OCC_Bottle)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex023_Parametric_Enclosure.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex023_Parametric_Enclosure
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex023_Parametric_Enclosure)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,23 +1,4 @@
#File: Ex024_Using_FreeCAD_Solids_as_CQ_Objects.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex024_Using_FreeCAD_Solids_as_CQ_Objects
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex024_Using_FreeCAD_Solids_as_CQ_Objects)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery, FreeCAD, Part
#Create a new document that we can draw our model on

View File

@ -1,23 +1,4 @@
#File: Ex025_Revolution.py
#To use this example file, you need to first follow the "Using CadQuery From Inside FreeCAD"
#instructions here: https://github.com/dcowden/cadquery#installing----using-cadquery-from-inside-freecad
#You run this example by typing the following in the FreeCAD python console, making sure to change
#the path to this example, and the name of the example appropriately.
#import sys
#sys.path.append('/home/user/Downloads/cadquery/examples/FreeCAD')
#import Ex025_Revolution
#If you need to reload the part after making a change, you can use the following lines within the FreeCAD console.
#reload(Ex025_Revolution)
#You'll need to delete the original shape that was created, and the new shape should be named sequentially
# (Shape001, etc).
#You can also tie these blocks of code to macros, buttons, and keybindings in FreeCAD for quicker access.
#You can get a more information on this example at
# http://parametricparts.com/docs/examples.html#an-extruded-prismatic-solid
#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part

View File

@ -1,3 +0,0 @@
class CadQueryGui():
def __workbench__(self):
pass

Binary file not shown.

View File

@ -1,3 +1,6 @@
"""Adds all of the commands that are used for the menus of the CadQuery module"""
# (c) 2014 Jeremy Wright LGPL v3
import tempfile
import FreeCAD, FreeCADGui
from PySide import QtGui
@ -34,8 +37,8 @@ class CadQueryCloseScript:
#We need this so we can load the file into it
cqCodePane = mw.findChild(QtGui.QPlainTextEdit, "cqCodePane")
reply = QtGui.QMessageBox.question(cqCodePane, "QMessageBox.question()", "Save script before closing?", QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No | QtGui.QMessageBox.Cancel)
reply = QtGui.QMessageBox.question(cqCodePane, "QMessageBox.question()", "Save script before closing?",
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No | QtGui.QMessageBox.Cancel)
if reply == QtGui.QMessageBox.Cancel:
return

View File

@ -1,3 +1,6 @@
"""Adds the ability to save a script file to the CadQuery module"""
# (c) 2014 Jeremy Wright LGPL v3
import FreeCAD, FreeCADGui
from PySide import QtGui

View File

@ -1,3 +1,6 @@
"""Adds the ability to open files from disk to the CadQuery FreeCAD module"""
# (c) 2014 Jeremy Wright LGPL v3
import os, FreeCAD, FreeCADGui
from PySide import QtGui

View File

@ -1 +1 @@
__author__ = 'jwright'

View File

@ -1,2 +1,5 @@
# FreeCAD init script of the CadQuery module
# (c) 2001 Juergen Riegel LGPL
"""FreeCAD init script of the CadQuery module"""
# (c) 2014 Jeremy Wright LGPL v3
#TODO: The FreeCAD devs like to put as much init code as possible in here so that the module can be used without the
#TODO: GUI if desired

View File

@ -1,11 +1,13 @@
# CadQuery gui init module
# (c) 2001 Juergen Riegel LGPL
"""CadQuery GUI init module for FreeCAD
This adds a workbench with a scripting editor to FreeCAD's GUI."""
# (c) 2014 Jeremy Wright LGPL v3
import FreeCAD
import FreeCADGui
from Gui.Command import *
class CadQueryWorkbench (Workbench):
"""CadQuery workbench object"""
"""CadQuery workbench for FreeCAD"""
MenuText = "CadQuery"
ToolTip = "CadQuery workbench"
Icon = ":/icons/CQ_Logo.svg"
@ -16,21 +18,31 @@ class CadQueryWorkbench (Workbench):
def Initialize(self):
import os
#Need to set this for PyQode
os.environ['QT_API'] = 'pyside'
import logging
logging.basicConfig(filename='/home/jwright/Downloads/log.txt', level=logging.DEBUG)
#sys.path.append('./Libs/cadquery.zip')
#sys.path.append('./Libs/pyqode.zip')
#If we need a CQ menu, this would be the way to add it
#Turn off logging for now
import logging
logging.basicConfig(filename='C:\Users\Jeremy\Documents\log.txt', level=logging.DEBUG)
#We have our own CQ menu that's added when the user chooses our workbench
commands = ['CadQueryOpenScript', 'CadQuerySaveScript', 'CadQuerySaveAsScript', 'CadQueryExecuteScript',
'CadQueryCloseScript']
self.appendMenu('CadQuery', commands)
def Activated(self):
import os, sys
from PySide import QtGui, QtCore
import module_locator
#Set up so that we can import from our embedded packages
module_base_path = module_locator.module_path()
libs_path = os.path.join(module_base_path, 'Libs')
libs_path = os.path.join(libs_path, 'libs.zip')
sys.path.insert(0, libs_path)
import cadquery
from PySide import QtGui
import sys
from pyqode.python.widgets import PyCodeEdit
msg = QtGui.QApplication.translate(
"cqCodeWidget",
@ -44,37 +56,6 @@ class CadQueryWorkbench (Workbench):
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintMessage(msg)
from PySide import QtGui
from PySide import QtCore
FreeCAD.addImportType("CadQuery Script (*.py)", "Gui.ImportCQ")
FreeCAD.addExportType("CadQuery Script (*.py)", "Gui.ExportCQ")
try:
import cadquery
except ImportError:
msg = QtGui.QApplication.translate(
"cqCodeWidget",
"The cadquery library is not installed, please install it before using this workbench.\r\n"
"Linux and MacOS Users: 'pip install --upgrade cadquery'\r\n"
"Windows Users: 'Not sure yet.\r\n",
None,
QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintError(msg)
# import os, sys, inspect
# cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0], "Libs/libraries.zip")))
# if cmd_subfolder not in sys.path:
# sys.path.append(cmd_subfolder)
import sys
sys.path.insert(0, '/home/jwright/Documents/Projects/CadQuery/cadquery-freecad-module/CadQuery/Libs/libraries.zip')
#sys.path.append('/home/jwright/Documents/Projects/CadQuery/cadquery-freecad-module/CadQuery/Libs/libraries.zip')
from pyqode.qt import QtWidgets
from pyqode.python.backend import server
from pyqode.python.widgets import PyCodeEdit
from pyqode.python.widgets import code_edit
#Make sure that we enforce a specific version (2.7) of the Python interpreter
ver = hex(sys.hexversion)
interpreter = "python%s.%s" % (ver[2], ver[4]) # => 'python2.7'
@ -110,14 +91,14 @@ class CadQueryWorkbench (Workbench):
mw.addDockWidget(QtCore.Qt.LeftDockWidgetArea, cqCodeWidget)
#Set up the text area for our CQ code
codePane = PyCodeEdit(server_script=server.__file__, interpreter=interpreter, args=['-s', '/home/jwright/Documents/Projects/CadQuery/cadquery-freecad-module/CadQuery/Libs/libraries.zip'])
server_path = os.path.join(module_base_path, 'cq_server.py')
codePane = PyCodeEdit(server_script=server_path, interpreter=interpreter, args=['-s', libs_path])
codePane.setObjectName("cqCodePane")
#Add the text area to our dock widget
cqCodeWidget.setWidget(codePane)
def Deactivated(self):
from PySide import QtGui
from Gui import ExportCQ
#Put the UI back the way we found it

View File

@ -1,15 +1,42 @@
from qidle.system import embed_package_into_zip
"""
Test if the zip file is working.
import jedi
import pep8
import pyqode
import pyqode.core
import pyqode.python
import pyqode.qt
import qidle
import frosted
import pies
import cadquery
Usage:
embed_package_into_zip([jedi, pep8, pyqode.core, pyqode.python, pyqode.qt, qidle, frosted, pies, cadquery],
zip_path='/home/jwright/Documents/Projects/CadQuery/cadquery-freecad-module/CadQuery/Tools/libraries.zip')
- python test_zip_file.py gen
- python test_zip_file.py
"""
import sys
import os
ZIP = os.path.join(os.getcwd(), 'libs.zip')
if len(sys.argv) == 2 and sys.argv[1] == 'gen':
#--- gen zip file
import jedi, pep8, pyqode, pyqode.core, pyqode.python, pyqode.qt, qidle, frosted, pies, cadquery
from qidle.system import embed_package_into_zip
embed_package_into_zip([jedi, pep8, pyqode, pyqode.core, pyqode.python,
pyqode.qt, cadquery, frosted, pies], ZIP)
else:
# remove all pyqode path from sys.path (to make sure the package are
# imported from the zip archive)
for pth in list(sys.path):
if 'pyqode' in pth:
print('removing %s' % pth)
sys.path.remove(pth)
# importing a pyqode module should fail
fail = False
try:
from pyqode.core.api import code_edit
except ImportError:
fail = True
assert fail is True
# mount zip file
sys.path.insert(0, ZIP)
print(sys.path)
# test it!
from pyqode.core.api import code_edit
print(code_edit.__file__)
assert ZIP in code_edit.__file__

View File

@ -1 +1,6 @@
__author__ = 'jwright'
__author__ = "Jeremy Wright (jmwright)"
__copyright__ = "Copyright 2014, Innovations Technology Solutions"
__license__ = "LGPL v3"
__version__ = "0.1"
__maintainer__ = "Jeremy Wright"
__status__ = "Beta"

50
CadQuery/cq_server.py Normal file
View File

@ -0,0 +1,50 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Main server script for a pyqode.python backend. You can directly use this
script in your application if it fits your needs or use it as a starting point
for writing your own server.
::
usage: server.py [-h] [-s [SYSPATH [SYSPATH ...]]] port
positional arguments:
port the local tcp port to use to run the server
optional arguments:
-h, --help show this help message and exit
-s [SYSPATH [SYSPATH ...]], --syspath [SYSPATH [SYSPATH ...]]
"""
import argparse
import sys
if __name__ == '__main__':
"""
Server process' entry point
"""
# setup argument parser and parse command line args
parser = argparse.ArgumentParser()
parser.add_argument("port", help="the local tcp port to use to run "
"the server")
parser.add_argument('-s', '--syspath', nargs='*')
args = parser.parse_args()
# add user paths to sys.path
if args.syspath:
for path in args.syspath:
print('append path %s to sys.path\n' % path)
sys.path.append(path)
from pyqode.core import backend
from pyqode.python.backend.workers import JediCompletionProvider
# setup completion providers
backend.CodeCompletionWorker.providers.append(JediCompletionProvider())
backend.CodeCompletionWorker.providers.append(
backend.DocumentWordsProvider())
# starts the server
backend.serve_forever(args)

View File

@ -0,0 +1,11 @@
import os, sys
def we_are_frozen():
# All of the modules are built-in to the interpreter, e.g., by py2exe
return hasattr(sys, "frozen")
def module_path():
encoding = sys.getfilesystemencoding()
if we_are_frozen():
return os.path.dirname(unicode(sys.executable, encoding))
return os.path.dirname(unicode(__file__, encoding))