cadquery icon indicating copy to clipboard operation
cadquery copied to clipboard

Please add more examples

Open nesdnuma opened this issue 3 years ago • 11 comments

Hello,

Please add more examples, especially examples dealing with construction of multiple objects through a for loop.

Thank you.

nesdnuma avatar Apr 27 '22 09:04 nesdnuma

What do you mean with multiple objects?

In case of assemblies, you can do it in the following way:

import cadquery as cq

beam = [120,80,3000];

beams= cq.Assembly()

def f_beams(b_offset):
   
    beams.add(cq.Workplane("XY").box(beam[0],beam[1],beam[2]),loc=cq.Location(cq.Vector(0,b_offset*500,0)))

for a in range(0,9): 
    f_beams(a)
  
show_object(beams)

Additionally, you should read the cadquery concepts

https://cadquery.readthedocs.io/en/latest/primer.html#

tommy3001 avatar Apr 28 '22 09:04 tommy3001

I've read the concepts but I think some additional simple examples but dealing with more modules and situations would help beginners.

nesdnuma avatar Apr 28 '22 13:04 nesdnuma

@nesdnuma could you provide a list of a few modules/situations you would have found useful ? I'm afraid a lot of us who know it well are 'nose-blind' to what things are obvious and which ones are not at this point. It would go a long way if you could list the concepts/functions that were confusing as a beginner.

dcowden avatar Apr 28 '22 14:04 dcowden

Actually it's hard to tell, I am too much of a beginner, also with Python. I am bumping on new issues all the time. The ideal situation would be a code example for each module/function described in the API but I understand this would be a lot of work. I'll try to give some examples myself as soon as I have something of interest.

nesdnuma avatar Apr 28 '22 17:04 nesdnuma

An example including sweep() would be nice.

nesdnuma avatar May 03 '22 20:05 nesdnuma

Also, examples of the various arc methods: Workplane.threePointArc Workplane.sagittaArc Workplane.radiusArc Workplane.tangentArcPoint

nesdnuma avatar May 13 '22 15:05 nesdnuma

Examples with Workplane.wire(), Workplane.wires(), Workplane.parametricCurve()...

nesdnuma avatar May 17 '22 08:05 nesdnuma

In the meantime you can check the tests.

adam-urbanczyk avatar May 17 '22 18:05 adam-urbanczyk

In the meantime you can check the tests.

Which tests???

nesdnuma avatar May 19 '22 14:05 nesdnuma

@nesdnuma Here.

Probably the best way to go about it is to search CadQuery's GitHub repo for the topic and then click on any test entries that come up. For instance, if you search revolve there is an entry under test_cadquery.py in the results that says testRevolveCylinder. You can click to go to that line of code and look at how revolve was used.

jmwright avatar May 19 '22 15:05 jmwright

Interesting! Thank you @jmwright !

nesdnuma avatar May 19 '22 16:05 nesdnuma