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

Workplane() resets currently selected objects #149

Open
adam-urbanczyk opened this issue Jun 13, 2019 · 5 comments
Open

Workplane() resets currently selected objects #149

adam-urbanczyk opened this issue Jun 13, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@adam-urbanczyk
Copy link
Member

The following code does not work

import cadquery as cq
result = cq.Workplane("XY").rect(10.0,10.0).extrude(10).faces("<Y")\
    .workplane().vertices('<XZ').circle(1).extrude(10)

I think it should -- it is quite clear what the intent if the user is here. This is also related to #24

@Jojain
Copy link
Contributor

Jojain commented Jan 25, 2022

We agree that the expected behaviour would be equal to this :

import cadquery as cq
result = cq.Workplane("XY").rect(10.0,10.0).extrude(10).faces("<Y")\
    .workplane().end(1).vertices('<XZ').circle(1).extrude(10)

I have been bothered several time by this and while the end method solves the problem, it's super unnatural and definitely not novice friendly.

If this is still expected to be solved I will try to bring a PR

EDIT : Looking at the source code for workplane since it expects faces or wires on the stack shouldn't we just pass the objects of the parent obj to the child ?

# make the new workplane
plane = Plane(offsetCenter, xDir, normal)
s = self.__class__(plane)
s.parent = self
s.objects = self.objects # we would just add this ?
s.ctx = self.ctx

Of course I need to make sure it doesn't make the tests fail but it seems it would be what's expected ?

@adam-urbanczyk
Copy link
Member Author

I think, that's it indeed.

@adam-urbanczyk adam-urbanczyk added the enhancement New feature or request label Jan 26, 2022
@adam-urbanczyk
Copy link
Member Author

Or maybe:

s.objects = self.objects[:]

@Jojain
Copy link
Contributor

Jojain commented Jan 26, 2022

I have tried my solution, it breaks some tests, I have quickly looked, some tests could be rewritten, some need a bit more investigation why they break.

@adam-urbanczyk
Copy link
Member Author

Feel free to open a WIP PR and we can take a look together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants