Closed dcowden closed 5 years ago
To further the discussion on operations, with regard to #195
All thread operations would take parameters:
length
pitch
angle=0
thread's angular offsetstart_count=1
profile
the thread's "tooth" profile (eg: triangular, trapezoidal, sawtooth, ballscrew?, more?)radius
(likely more than one, depending on the way the profile is constructed)profile_sketch=None
a sketch of the tooth profile, would imply a pitch
, and all radius
parameters based on the wire's construction
also: profile should be an un-closed wire, so it may be used for internal & external threads alikeThese inputs would be abstracted via named standards (eg: M6
)
Useful thread operations would be:
Also, things to consider:
I would expect
s3.faces(op_id='hole')
to give all faces of the object that resulted from the cut operation
Perhaps more importantly,I would expect these two to return the same thing
s3.faces() ctx.find(op_id='hole').faces()
@dcowden Here is an deliberately more complex example, let's see if we all agree (NB: I am using cq1 syntax for building the model, the main focus is on what should the selectors do in such a situation):
from cadquery import *
box1 = Workplane('XY').box(1,1,1)
box1 = box.faces('>Z').circle(0.2).cutThruAll(id='cut1')
box2 = box1.faces('>Z').circle(0.4).cutThruAll(id='cut2')
So I'd expect box2.faces()
to return all (7 faces) of box2, but ctx.find(op_id='cut1').faces()
return 7 faces, out of which 1 is not returned by box2.faces()
.
For me it would also make sense to have ctx.find(op_id='cut1').created().faces()
(or maybe ctx.find(op_id='cut1',created=True).faces()
) return the one cylindrical face, and ctx.find(op_id='cut1').modified().faces()
return 2 (top and bottom) planar ones.
What do you think about this?
Yep! I'm in agreement with both. I'm not sure which selector syntax I like better yet. I definitely like id being the only parameter to find, because then the api of the result matches other selectors returned by operations.
@fragmuffin You had mentioned being able to build complex things like cars using the direct API. I don't want to pollute this issue too much, but I thought you might be interested in this simple car suspension with animations done in raw FreeCAD scripting. https://www.youtube.com/watch?v=LxvK6raH2Pg
@jmwright very nice, thanks for the link :) that's similar to what I'll be setting up, but a bit more robotic.
Adam Vermeer has done some simple assemblies using JSON in Jupyter Notebook. Have a look at the first message from June 20th here.
https://groups.google.com/d/msgid/cadquery/3090ee44-9e2b-40c7-befc-aed7c59a12aa%40googlegroups.com
He calls them "naive assemblies" since they don't use constraints between parts. It might still be interesting to you though.
Any news on this "Direct API" front?
@jmwright @zwn Sadly, no. Writing the direct API is a large task that I don't anticipate have the time to do all at once, and it doesn't lend itself to imcrental implementation.
The vision was initially for cw 2.0 to be OCC nased, with a direct API, and a stand alone GUI. This is simply too much for the resources available to us.
Since we have a nearly complete OCC branch, and it appears a gui might be quick to implement, I'm thinking it's best for 2.0 to release these alone.
After a lot of conversation yesterday, I want to validate that with all the core contributors, and then make a GitHub milestone and issues match that approach
This has been closed in favor of the CQ 2.0 implemention at https://github.com/cadquery/cadquery
CQ 2.0 should have a direct api in addition to a fluent api, for more programmatic use.