Comments (7)
@cactorium You could consider developing this as a plugin. https://github.com/CadQuery/cadquery-plugins
from cadquery.
Well, I ended up with this in case anyone wants to take a look/give feedback: https://github.com/cactorium/cadquery-plugins/blob/main/plugins/localselectors/localselectors.py I'll work on cleaning it up over the weekend and seeing if it could be added to cadquery-plugins
from cadquery.
Not planned, but you can relatively easily implement custom selectors. Some examples can be found here: https://github.com/michaelgale/cq-kit/blob/master/cqkit/cq_selectors.py
Also, based on your description I'm not sure that this would be optimal. Did you look into assemblies and constraints?
from cadquery.
Yeah I've thought about using constraints, but that seems more heavy-handed than necessary for my use case; I know exactly how each part needs to bolt onto the others so it's been really easy just to pass workplanes around instead of trying to set up constraints, my code basically boils down to something like:
class BaseStruct:
def __init__(self, w):
self.solid = ....
self.wp_face = ....
def StackableThing:
def __init__(self, w):
self.solid = ....
self.wp_face1 = ...
self.wp_face2 = ....
b = Base(cq.Workplane())
s1 = StackableThing(b.wp_face1)
s2 = StackableThing(b.wp_face2)
s3 = StackableThing(s2.wp_face2)
Thanks for the link! Would there be any interest in adding such a feature? I'd be willing to work on it, if not I'll probably write some rough selectors just to use for myself
from cadquery.
I still think that you are approaching it in a sub-optimal way. If you know exactly the desired locations, you can use static assemblies and specify the locations. NB: you can add sub-assemblies to an assembly and thus compose the relative locations. Alternatively, you can compose the locations themselves.
If you still want some use-case specific selectors, simply develop it as a separate project (like cq-kit).
from cadquery.
Thank you guys for the feedback, I'll write a plugin for it
from cadquery.
@cactorium if you really think you need this, IMO this would be the best way to approach such a functionality.
Selectors are not specific to cq.Workplane
(they are also used by cq.Shape
, cq.Sketch
and cq.Assembly
), so probably it is better to define a special method(s)/kw arg specifically for cq.Workplane
that would apply inverse location of the current workplane, do the selection, and than reapply the original location again to the selected objects. This way you would not need to modify all the existing selectors.
from cadquery.
Related Issues (20)
- DXF export for sketch
- Finding coplanar and concentric surfaces HOT 5
- Wrap features (`BRepFeat`) from OCP
- symmetric `thicken`
- Provide Interface to OCCT Messages
- Simple 'cut' of two a Box and a Sphere creates unusable object HOT 3
- Documentation: Assembly tutorial constraint solver result regression HOT 4
- seems parametricCuve()bug HOT 10
- Adding existing geometry into sketches? HOT 1
- Planar surface HOT 1
- Problem of center of mass when a cylinder is generated with a non-default direction HOT 1
- Assembly top level location ignored
- Selecting a face defined by Sketch on plane HOT 1
- Add docs about referencing subassemlies.
- Working with TDocStd_Document: Empty document when trying to use TDocStd_Application::Open wrapped by OCP HOT 1
- Can one limit the number of cores or threads to run in parallel? HOT 5
- Examples should have more explanations.
- Allow zero x or y spacing Workplane rarray
- How to calculate moment of inertia? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cadquery.