Skip to content

Commit

Permalink
Went through and updated the docs source to change FreeCAD and CQFM c…
Browse files Browse the repository at this point in the history
…ontent and references to PythonOCC and CQ-editor.
  • Loading branch information
jmwright committed Jan 17, 2019
1 parent b37d856 commit b99ac29
Show file tree
Hide file tree
Showing 18 changed files with 139 additions and 164 deletions.
2 changes: 1 addition & 1 deletion cadquery/README.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
***
Core CadQuery implementation.

No files should depend on or import FreeCAD , pythonOCC, or other CAD Kernel libraries!!!
No files should depend on or import PythonOCC, or other CAD Kernel libraries!!!
Dependencies should be on the classes provided by implementation packages, which in turn
can depend on CAD libraries.

Expand Down
Binary file modified doc/_static/quickstart/000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/_static/quickstart/001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/_static/quickstart/002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/_static/quickstart/003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/_static/quickstart/004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/_static/quickstart/005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 10 additions & 12 deletions doc/cqgi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@ script parameters, and then display the resulting objects visually to the user.

Today, three execution environments exist:

* `The CadQuery Freecad Module <https://github.com/jmwright/cadquery-freecad-module>`_, which runs scripts
inside of the FreeCAD IDE, and displays objects in the display window
* the cq-directive, which is used to execute scripts inside of sphinx-doc,
producing documented examples that include both a script and an SVG representation of the object that results
* `ParametricParts.com <https://www.parametricparts.com>`_, which provides a web-based way to prompt user input for
variables, and then display the result output in a web page.
* `CQ-editor <https://github.com/CadQuery/CQ-editor>`_, which runs scripts
inside of a CadQuery IDE, and displays objects in the display window and includes features like debugging.
* The cq-directive, which is used to execute scripts inside of sphinx-doc,
producing documented examples that include both a script and an SVG representation of the object that results.

The CQGI is distributed with cadquery, and standardizes the interface between execution environments and cadquery scripts.
The CQGI is distributed with CadQuery, and standardizes the interface between execution environments and CadQuery scripts.


The Script Side
Expand All @@ -31,11 +29,11 @@ The Script Side
CQGI compliant containers provide an execution environment for scripts. The environment includes:

* the cadquery library is automatically imported as 'cq'.
* the :py:meth:`cadquery.cqgi.ScriptCallback.build_object()` method is defined that should be used to export a shape to the execution environment
* the :py:meth:`cadquery.cqgi.ScriptCallback.show_object()` method is defined that should be used to export a shape to the execution environment
* the :py:meth:`cadquery.cqgi.ScriptCallBack.debug()` method is defined, which can be used by scripts to debug model output during execution.

Scripts must call build_output at least once. Invoking build_object more than once will send multiple objects to
the container. An error will occur if the script does not return an object using the build_object() method.
Scripts must call show_object at least once. Invoking show_object more than once will send multiple objects to
the container. An error will occur if the script does not return an object using the show_object() method.

This CQGI compliant script produces a cube with a circle on top, and displays a workplane as well as an intermediate circle as debug output::

Expand All @@ -47,7 +45,7 @@ This CQGI compliant script produces a cube with a circle on top, and displays a
circle=top_of_cube_plane.circle(0.5)
debug(circle, { 'color': 'red' } )

build_object( circle.extrude(1.0) )
show_object( circle.extrude(1.0) )

Note that importing cadquery is not required.
At the end of this script, one object will be displayed, in addition to a workplane, a point, and a circle
Expand Down Expand Up @@ -154,7 +152,7 @@ These are the most important Methods and classes of the CQGI
parse
CQModel.build
BuildResult
ScriptCallback.build_object
ScriptCallback.show_object

Complete CQGI api
-----------------
Expand Down
60 changes: 30 additions & 30 deletions doc/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Items introduced in the example are marked with a **!**

.. note::

You may want to work through these examples by pasting the text into a scratchpad on the live website.
You may want to work through these examples by pasting the text into a code editor in a CadQuery .
If you do, make sure to take these steps so that they work:

1. paste the content into the build() method, properly intented, and
Expand All @@ -24,7 +24,7 @@ Items introduced in the example are marked with a **!**

.. note::

We strongly recommend installing FreeCAD, and the `cadquery-freecad-module <https://github.com/jmwright/cadquery-freecad-module>`_,
We strongly recommend installing `CQ-editor <https://github.com/CadQuery/CQ-editor>`_,
so that you can work along with these examples interactively. See :ref:`installation` for more info.

.. warning::
Expand All @@ -43,7 +43,7 @@ Just about the simplest possible example, a rectangular box
.. cq_plot::

result = cadquery.Workplane("front").box(2.0, 2.0, 0.5)
build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -74,7 +74,7 @@ of a working plane is at the center of the face. The default hole depth is thro
result = cq.Workplane("XY").box(length, height, thickness) \
.faces(">Z").workplane().hole(center_hole_dia)

build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -97,7 +97,7 @@ By default, rectangles and circles are centered around the previous working poin
.. cq_plot::

result = cq.Workplane("front").circle(2.0).rect(0.5, 0.75).extrude(0.5)
build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -123,7 +123,7 @@ closed curve.

result = cq.Workplane("front").lineTo(2.0, 0).lineTo(2.0, 1.0).threePointArc((1.0, 1.5),(0.0, 1.0))\
.close().extrude(0.25)
build_object(result)
show_object(result)


.. topic:: Api References
Expand Down Expand Up @@ -155,7 +155,7 @@ A new work plane center can be established at any point.
#the new center is specified relative to the previous center, not global coordinates!

result = result.extrude(0.25)
build_object(result)
show_object(result)


.. topic:: Api References
Expand Down Expand Up @@ -184,7 +184,7 @@ like :py:meth:`Workplane.circle` and :py:meth:`Workplane.rect`, will operate on
r = r.pushPoints( [ (1.5, 0),(0, 1.5),(-1.5, 0),(0, -1.5) ] ) # now four points are on the stack
r = r.circle( 0.25 ) # circle will operate on all four points
result = r.extrude(0.125 ) # make prism
build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -206,7 +206,7 @@ correct for small hole sizes.

result = cq.Workplane("front").box(3.0, 4.0, 0.25).pushPoints ( [ ( 0,0.75 ),(0, -0.75) ]) \
.polygon(6, 1.0).cutThruAll()
build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -238,7 +238,7 @@ This example uses a polyline to create one half of an i-beam shape, which is mir
(0,H/-2.0)
]
result = cq.Workplane("front").polyline(pts).mirrorY().extrude(L)
build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -272,7 +272,7 @@ needs a complex profile
]
r = s.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(sPnts).close()
result = r.extrude(0.5)
build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -297,7 +297,7 @@ introduce horizontal and vertical lines, which make for slightly easier coding.
r = cq.Workplane("front").hLine(1.0) # 1.0 is the distance, not coordinate
r = r.vLine(0.5).hLine(-0.25).vLine(-0.25).hLineTo(0.0) # hLineTo allows using xCoordinate not distance
result =r.mirrorY().extrude(0.25 ) # mirror the geometry and extrude
build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -356,7 +356,7 @@ Mirroring 3D Objects

result = result.union(mirXY_neg).union(mirXY_pos).union(mirZY_neg).union(mirZY_pos)

build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -391,7 +391,7 @@ Keep in mind that the origin of new workplanes are located at the center of a fa

result = cq.Workplane("front").box(2,3, 0.5) #make a basic prism
result = result.faces(">Z").workplane().hole(0.5) #find the top-most face and make a hole
build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -420,7 +420,7 @@ how deep the part is
result = cq.Workplane("front").box(3,2, 0.5) #make a basic prism
result = result.faces(">Z").vertices("<XY").workplane() #select the lower left vertex and make a workplane
result = result.circle(1.0).cutThruAll() #cut the corner out
build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -448,7 +448,7 @@ This example uses an offset workplane to make a compound object, which is perfec
result = cq.Workplane("front").box(3, 2, 0.5) #make a basic prism
result = result.faces("<X").workplane(offset=0.75) #workplane is offset from the object surface
result = result.circle(1.0).extrude(0.5) #disc
build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -470,7 +470,7 @@ You can create a rotated work plane by specifying angles of rotation relative to
result = cq.Workplane("front").box(4.0, 4.0, 0.25).faces(">Z").workplane() \
.transformed(offset=cq.Vector(0, -1.5, 1.0),rotate=cq.Vector(60, 0, 0)) \
.rect(1.5,1.5,forConstruction=True).vertices().hole(0.25)
build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -494,7 +494,7 @@ In the example below, a rectangle is drawn, and its vertices are used to locate

result = cq.Workplane("front").box(2, 2, 0.5).faces(">Z").workplane() \
.rect(1.5, 1.5, forConstruction=True).vertices().hole(0.125 )
build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -518,7 +518,7 @@ are removed, and then the inside of the solid is 'hollowed out' to make the shel
.. cq_plot::

result = cq.Workplane("front").box(2, 2, 2).faces("+Z").shell(0.05)
build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -541,7 +541,7 @@ and a circular section.
result = cq.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)

build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -566,7 +566,7 @@ Similar to :py:meth:`Workplane.hole` , these functions operate on a list of poin
result = cq.Workplane(cq.Plane.XY()).box(4,2, 0.5).faces(">Z").workplane().rect(3.5, 1.5, forConstruction=True)\
.vertices().cboreHole(0.125, 0.25, 0.125, depth=None)

build_object(result)
show_object(result)

.. topic:: Api References

Expand All @@ -592,7 +592,7 @@ Here we fillet all of the edges of a simple plate.
.. cq_plot::

result = cq.Workplane("XY" ).box(3, 3, 0.5).edges("|Z").fillet(0.125)
build_object(result)
show_object(result)
.. topic:: Api References

Expand All @@ -619,7 +619,7 @@ with just a few lines of code.
.rect(length-padding,height-padding,forConstruction=True) \
.vertices().cboreHole(2.4, 4.4, 2.1)

build_object(result)
show_object(result)


Splitting an Object
Expand All @@ -633,7 +633,7 @@ You can split an object using a workplane, and retain either or both halves

#now cut it in half sideways
result = c.faces(">Y").workplane(-0.5).split(keepTop=True)
build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -675,7 +675,7 @@ ones at 13 lines, but that's very short compared to the pythonOCC version, which

#make a shell
result = p.faces(">Z").shell(0.3)
build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -774,7 +774,7 @@ A Parametric Enclosure
#return the combined result
result =topOfLid.combineSolids(bottom)

build_object(result)
show_object(result)

.. topic:: Api References

Expand Down Expand Up @@ -859,7 +859,7 @@ regarding the underside of the brick.
tmp = s

# Render the solid
build_object(tmp)
show_object(tmp)


Braille Example
Expand All @@ -873,7 +873,7 @@ Braille Example


# text_lines is a list of text lines.
# FreeCAD in braille (converted with braille-converter:
# Braille (converted with braille-converter:
# https://github.com/jpaugh/braille-converter.git).
text_lines = ['⠠ ⠋ ⠗ ⠑ ⠑ ⠠ ⠉ ⠠ ⠁ ⠠ ⠙']
# See http://www.tiresias.org/research/reports/braille_cell.htm for examples
Expand Down Expand Up @@ -1043,7 +1043,7 @@ Braille Example
if base_thickness < get_cylinder_radius(_cell_geometry):
raise ValueError('Base thickness should be at least {}'.format(dot_height))

build_object(make_embossed_plate(text_lines, _cell_geometry))
show_object(make_embossed_plate(text_lines, _cell_geometry))

Panel With Various Connector Holes
-----------------------------------
Expand Down Expand Up @@ -1093,4 +1093,4 @@ Panel With Various Connector Holes
result = result.workplane(offset=1, centerOption='CenterOfBoundBox').center(-173,-30-idx*h_sep).moveTo(-2.9176,-5.3).threePointArc((-6.05,0),(-2.9176,5.3)).lineTo(2.9176,5.3).threePointArc((6.05,0),(2.9176,-5.3)).close().cutThruAll()

# Render the solid
build_object(result)
show_object(result)
Loading

0 comments on commit b99ac29

Please sign in to comment.