Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding existing geometry into sketches? #1588

Open
l29ah opened this issue May 14, 2024 · 1 comment
Open

Adding existing geometry into sketches? #1588

l29ah opened this issue May 14, 2024 · 1 comment
Labels
question Further information is requested

Comments

@l29ah
Copy link
Contributor

l29ah commented May 14, 2024

I want to make holes spaced out all around the edge of my part. It's easy to put holes along existing vertices, but i'm not sure how to split up the lines to get more vertices. I've made a Wire in my Workplane and figured distribute() would be appropriate to do it, but seems like it's only accessible inside a Sketch. Meanwhile in a Sketch i don't have access to any external geometry it seems, even with tag() and select(). How can i do it? So far my attempts look like:

import cadquery as cq

shit = cq.Workplane('XY').box(5, 5, 5)
shitfaced = shit.faces('>Z').edges().toPending().offset2D(-0.5, forConstruction=True).tag('loh')
#ok = shitfaced.positions() #project()#sketch().select('loh').distribute(10)
@l29ah l29ah added the question Further information is requested label May 14, 2024
@adam-urbanczyk
Copy link
Member

The Sketch API has to be updated to enable such things. I think currently the easiest method would be:

import cadquery as cq

base = cq.Workplane().box(5, 5, 5)
f = base.faces('>Z').edges().toPending().offset2D(-0.5, forConstruction=True).val()

locs = f.positions((1/8)*i for i in range(8))

#import numpy as np
#locs = f.positions(np.linspace(0,1,8,endpoint=False))

result = base.pushPoints(locs).circle(0.4).cutBlind(-1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants