Merge pull request #40 from jmwright/develop
Changed all embedded examples to use Helpers.show() instead of Part.show...
This commit is contained in:
commit
016ab83f41
|
@ -5,7 +5,7 @@
|
|||
# Ex026_Lego_Brick.py is highly recommended as a great example of what CadQuery
|
||||
# can do.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the box. These can be modified rather than changing the
|
||||
# object's code directly.
|
||||
|
@ -16,5 +16,5 @@ thickness = 1.0
|
|||
# Create a 3D box based on the dimension variables above
|
||||
result = cadquery.Workplane("XY").box(length, height, thickness)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the box. These can be modified rather than changing the
|
||||
# object's code directly.
|
||||
|
@ -11,5 +11,5 @@ thickness = 10.0
|
|||
# Create a 3D box based on the dimension variables above
|
||||
result = cadquery.Workplane("XY").box(length, height, thickness)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the box. These can be modified rather than changing the
|
||||
# object's code directly.
|
||||
|
@ -13,5 +13,5 @@ center_hole_dia = 22.0
|
|||
result = cadquery.Workplane("XY").box(length, height, thickness) \
|
||||
.faces(">Z").workplane().hole(center_hole_dia)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the box. These can be modified rather than changing the
|
||||
# object's code directly.
|
||||
|
@ -19,5 +19,5 @@ result = cadquery.Workplane("XY").box(length, height, thickness) \
|
|||
.rect(length - 8.0, height - 8.0, forConstruction=True) \
|
||||
.vertices().cboreHole(cbore_hole_diameter, cbore_diameter, cbore_depth)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the model. These can be modified rather than changing the
|
||||
# object's code directly.
|
||||
|
@ -14,5 +14,5 @@ result = cadquery.Workplane("front").circle(circle_radius) \
|
|||
.rect(rectangle_width, rectangle_length) \
|
||||
.extrude(thickness)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the model. These can be modified rather than changing the
|
||||
# object's code directly.
|
||||
|
@ -13,5 +13,5 @@ result = cadquery.Workplane("front").lineTo(width, 0) \
|
|||
.threePointArc((1.0, 1.5), (0.0, 1.0)) \
|
||||
.close().extrude(thickness)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the model. These can be modified rather than changing the
|
||||
# object's code directly.
|
||||
|
@ -18,5 +18,5 @@ result = result.center(-1.5, 1.5).circle(0.25) # New work center is ( 0.0,1.5)
|
|||
|
||||
result = result.extrude(thickness)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the model. These can be modified rather than changing the
|
||||
# object's code directly.
|
||||
|
@ -17,5 +17,5 @@ r = r.pushPoints([(1.5, 0), (0, 1.5), (-1.5, 0), (0, -1.5)])
|
|||
r = r.circle(hole_pattern_radius)
|
||||
result = r.extrude(thickness)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the model. These can be modified rather than changing the
|
||||
# object's code directly.
|
||||
|
@ -16,5 +16,5 @@ result = cadquery.Workplane("front").box(width, height, thickness) \
|
|||
.polygon(polygon_sides, polygon_dia) \
|
||||
.cutThruAll()
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Set up our Length, Height, Width, and thickness of the beam
|
||||
(L, H, W, t) = (100.0, 20.0, 20.0, 1.0)
|
||||
|
@ -21,5 +21,5 @@ pts = [
|
|||
# I-beam
|
||||
result = cadquery.Workplane("front").polyline(pts).mirrorY().extrude(L)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The workplane we want to create the spline on to extrude
|
||||
s = cadquery.Workplane("XY")
|
||||
|
@ -22,5 +22,5 @@ r = s.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(sPnts).close()
|
|||
# Extrude to turn the wire into a plate
|
||||
result = r.extrude(0.5)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# 1.0 is the distance, not coordinate
|
||||
r = cadquery.Workplane("front").hLine(1.0)
|
||||
|
@ -11,5 +11,5 @@ r = r.vLine(0.5).hLine(-0.25).vLine(-0.25).hLineTo(0.0)
|
|||
# Mirror the geometry and extrude
|
||||
result = r.mirrorY().extrude(0.25)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Make a basic prism
|
||||
result = cadquery.Workplane("front").box(2, 3, 0.5)
|
||||
|
@ -8,5 +8,5 @@ result = cadquery.Workplane("front").box(2, 3, 0.5)
|
|||
# Find the top-most face and make a hole
|
||||
result = result.faces(">Z").workplane().hole(0.5)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Make a basic prism
|
||||
result = cadquery.Workplane("front").box(3, 2, 0.5)
|
||||
|
@ -11,5 +11,5 @@ result = result.faces(">Z").vertices("<XY").workplane()
|
|||
# Cut the corner out
|
||||
result = result.circle(1.0).cutThruAll()
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Make a basic prism
|
||||
result = cadquery.Workplane("front").box(3, 2, 0.5)
|
||||
|
@ -11,5 +11,5 @@ result = result.faces("<X").workplane(offset=0.75)
|
|||
# Create a disc
|
||||
result = result.circle(1.0).extrude(0.5)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
from cadquery import Vector
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Create a rotated workplane and put holes in each corner of a rectangle on
|
||||
# that workplane, producing angled holes in the face
|
||||
result = cadquery.Workplane("front").box(4.0, 4.0, 0.25).faces(">Z") \
|
||||
.workplane() \
|
||||
.transformed(offset=Vector(0, -1.5, 1.0), rotate=Vector(60, 0, 0)) \
|
||||
.rect(1.5, 1.5, forConstruction=True).vertices().hole(0.25)
|
||||
.workplane() \
|
||||
.transformed(offset=(0, -1.5, 1.0), rotate=(60, 0, 0)) \
|
||||
.rect(1.5, 1.5, forConstruction=True).vertices().hole(0.25)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Create a block with holes in each corner of a rectangle on that workplane
|
||||
result = cadquery.Workplane("front").box(2, 2, 0.5).faces(">Z").workplane() \
|
||||
.rect(1.5, 1.5, forConstruction=True).vertices().hole(0.125)
|
||||
result = cadquery.Workplane("front").box(2, 2, 0.5)\
|
||||
.faces(">Z").workplane() \
|
||||
.rect(1.5, 1.5, forConstruction=True).vertices().hole(0.125)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Create a hollow box that's open on both ends with a thin wall
|
||||
result = cadquery.Workplane("front").box(2, 2, 2).faces("+Z").shell(0.05)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Create a lofted section between a rectangle and a circular section
|
||||
result = cadquery.Workplane("front").box(4.0, 4.0, 0.25).faces(">Z") \
|
||||
.circle(1.5).workplane(offset=3.0) \
|
||||
.rect(0.75, 0.5).loft(combine=True)
|
||||
.circle(1.5).workplane(offset=3.0) \
|
||||
.rect(0.75, 0.5).loft(combine=True)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Create a plate with 4 counter-sunk holes in it
|
||||
result = cadquery.Workplane(cadquery.Plane.XY()).box(4, 2, 0.5).faces(">Z") \
|
||||
.workplane().rect(3.5, 1.5, forConstruction=True)\
|
||||
.vertices().cskHole(0.125, 0.25, 82.0, depth=None)
|
||||
.workplane().rect(3.5, 1.5, forConstruction=True)\
|
||||
.vertices().cskHole(0.125, 0.25, 82.0, depth=None)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Create a plate with 4 rounded corners in the Z-axis
|
||||
result = cadquery.Workplane("XY").box(3, 3, 0.5).edges("|Z").fillet(0.125)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Create a simple block with a hole through it that we can split
|
||||
c = cadquery.Workplane("XY").box(1, 1, 1).faces(">Z").workplane() \
|
||||
|
@ -9,5 +9,5 @@ c = cadquery.Workplane("XY").box(1, 1, 1).faces(">Z").workplane() \
|
|||
# Cut the block in half sideways
|
||||
result = c.faces(">Y").workplane(-0.5).split(keepTop=True)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Set up the length, width, and thickness
|
||||
(L, w, t) = (20.0, 6.0, 3.0)
|
||||
|
@ -8,8 +8,8 @@ s = cadquery.Workplane("XY")
|
|||
|
||||
# Draw half the profile of the bottle and extrude it
|
||||
p = s.center(-L / 2.0, 0).vLine(w / 2.0) \
|
||||
.threePointArc((L / 2.0, w / 2.0 + t), (L, w / 2.0)).vLine(-w / 2.0) \
|
||||
.mirrorX().extrude(30.0, True)
|
||||
.threePointArc((L / 2.0, w / 2.0 + t), (L, w / 2.0)).vLine(-w / 2.0) \
|
||||
.mirrorX().extrude(30.0, True)
|
||||
|
||||
# Make the neck
|
||||
p.faces(">Z").workplane().circle(3.0).extrude(2.0, True)
|
||||
|
@ -17,5 +17,5 @@ p.faces(">Z").workplane().circle(3.0).extrude(2.0, True)
|
|||
# Make a shell
|
||||
result = p.faces(">Z").shell(0.3)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# Parameter definitions
|
||||
p_outerWidth = 100.0 # Outer width of box enclosure
|
||||
|
@ -80,5 +80,5 @@ if p_flipLid:
|
|||
# Return the combined result
|
||||
result = topOfLid.combineSolids(bottom)
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
# The dimensions of the model. These can be modified rather than changing the
|
||||
# shape's code directly.
|
||||
|
@ -19,5 +19,5 @@ result = cadquery.Workplane("XY").rect(rectangle_width, rectangle_length, False)
|
|||
# Revolve a donut with square walls
|
||||
#result = cadquery.Workplane("XY").rect(rectangle_width, rectangle_length, True).revolve(angle_degrees, (20, 0), (20, 10))
|
||||
|
||||
# Boiler plate code to render our solid in FreeCAD's GUI
|
||||
Part.show(result.toFreecad())
|
||||
# Render the solid
|
||||
show(result)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
# This script can create any regular rectangular Lego(TM) Brick
|
||||
import cadquery
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
#####
|
||||
# Inputs
|
||||
|
@ -52,4 +52,5 @@ elif wbumps > 1:
|
|||
else:
|
||||
tmp = s
|
||||
|
||||
Part.show(tmp.toFreecad())
|
||||
# Render the solid
|
||||
show(tmp)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# This example is meant to be used from within the CadQuery module of FreeCAD.
|
||||
import cadquery as cq
|
||||
import Part
|
||||
from Helpers import show
|
||||
|
||||
exploded = False # when true, moves the base away from the top so we see
|
||||
showTop = True # When true, the top is rendered.
|
||||
|
@ -84,6 +84,6 @@ cover = (base(coverThickness)
|
|||
|
||||
# Conditionally render the parts
|
||||
if showTop:
|
||||
Part.show(top.toFreecad())
|
||||
show(top)
|
||||
if showCover:
|
||||
Part.show(cover.toFreecad())
|
||||
show(cover)
|
||||
|
|
Loading…
Reference in New Issue
Block a user