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

The group BoundingBox bug caused by undoing after face.pushpull #798

Open
linying1991 opened this issue Jul 5, 2022 · 6 comments
Open

Comments

@linying1991
Copy link

Bug Reports

  1. SketchUp Version: 22.0.354
  2. OS Platform: Windows 11 - 21H2

Operation steps

Step 1: Operation of the code

Perform a face.pushpull on a face inside the group

group = Sketchup.active_model.selection.first
face = group.entities.find do |e|
  e.is_a?(Sketchup::Face)
end
Sketchup.active_model.start_operation '', true
face.pushpull(1000.mm)
Sketchup.active_model.commit_operation

Step 2: User's operation

User presses Ctrl + Z to undo

Result

QQ截图20220705102425

Try to solve with code

QQ截图20220705102738

But it doesn't work.

Try to solve manually

Double click into the group, exit, can solve

Conclusion

There is a bug with face.pushpull via ruby, hope it can be solved, thanks!

The above text is mainly translated by machine, so please understand if the expression is not smooth.

@thomthom
Copy link
Member

pushpull

I'm not able to reproduce this.

Is this happening on a particular model? If so, can you attach it please?

If it happen on a fresh model for you, can you test with no other extensions enabled? This could perhaps be an issue with an extension interfering with observers.

@linying1991
Copy link
Author

@thomthom The group needs to be formed in three dimensions in order to be reproducible, for example, I have used a box here

123

Snipaste_2022-07-27_00-02-11

@thomthom
Copy link
Member

Can you share complete snippet (or model) that reproduce this please?

@linying1991
Copy link
Author

@thomthom There are three steps in total, which I have written as code.

model = Sketchup.active_model
ents = model.active_entities
group = nil

# First step: create a box
model.start_operation "CreateBox", true
group = ents.add_group
rect_pts = [
	ORIGIN,
	Geom::Point3d.new(100.mm, 0, 0),
	Geom::Point3d.new(100.mm, 100.mm, 0),
	Geom::Point3d.new(0, 100.mm, 0),
]
face = group.entities.add_face(rect_pts)
face.pushpull(100.mm)
model.commit_operation

# Second step: pushpull face in group
model.start_operation "PushpullAFace", true
face = group.entities.find do |e|
  e.is_a?(Sketchup::Face)
end
face.pushpull(1000.mm)
model.commit_operation

# Third step: sketchup undo (or press ctrl + z)
Sketchup.undo
model.selection.clear
model.selection.add(group)

Result

QQ截图20220729084951

@DanRathbun
Copy link

@thomthom I confirm. I can see this also on 2021. The second step can be a manual pushpull inside the group open for edit.

It might be a core issue, ...

  • but invalidate_bounds does not work to fix it.
  • running Fix Problems does not find anything wrong
  • it doesn't matter which way is the winding order on the original face
  • it doesn't matter if the face & cube is draw up above the ground plane

However, saving the file and cycling through a new empty model, then upon reopening the bounding box is corrected.
Afterward, trying to get the funky bounding box on the same cube does not happen.

It also happens if only the group and face are created with code. The 1st and second pushpulls can be manual.
And the pushpulls can be along different axis. But it always the second pushpull that creates the funky bounding box.

Whilst the bounding box is incorrect, it's #bounds method returns the incorrect bounding box, whose dimensional methods return incorrect values, and #valid? returns true.

@sketchup
Copy link

sketchup bot commented Sep 9, 2022

Logged as: SKEXT-3511

@sketchup sketchup bot added the logged label Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants