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

Error when finding the intersection between a new face made after a draft and the inner face of body [32857] #303

Open
dpasukhi opened this issue Jan 28, 2025 · 0 comments
Labels
0. New The issue was created, but not updated by maintainer. Waiting for updates labels and categories 1. Modeling Boolean operations, offsets, primitives, any conversion, brep builders and etc... 2. Bug Something isn't working 7. FreeCAD The issue related to FreeCAD project

Comments

@dpasukhi
Copy link
Member

Description

Possible fix:
https://tracker.dev.opencascade.org/view.php?id=32857

This is a bug reported by a FreeCAD community member: the downstream ticket is here:
FreeCAD/FreeCAD#5649

And a post describing an investigation in the issue is here:
https://forum.freecadweb.org/viewtopic.php?p=539132#p539132

Quoting from the discussion there:
[quote]
I compiled a debug version of OCCT 7.5.0 and the bug seems to be in finding the intersection between the new face made after the draft and the inner face of body, which gives the curve for one of the new edges. The new draft face is conical, whose surface is a "double cone" formed by extending the cone beyond it's tip. The inner cylindrical surface intersects this double cone at multiple places (mostly forming two disconnected curves except where the cylinder intersects the tip itself), and the portion that we want is often not found.

I put a break at .../occt/src/Draft/Draft_Modification_1.cxx:921, where the intersection happens. You may need to track down the exact iteration where the problem happens. Multiple "lines" (the intersection curves) are returned after i2s::Perform(...) and even when the draft works correctly (inner diameter >=40 right now), none of these "lines" are what we need. There is some "gluing" that happens after this which fixes the lines, but only in some cases. For now it is with inner diameter >= (distance between cone's axis and origin), but perhaps earlier the sign was inverted.
[/quote]

I've included a DRAW script below that reproduces the issue when the variable "inner rad" is less than the variable "pocket_center".

Expected Behavior

Actual Behavior

Sample Code or DRAW Tcl Script

# Script reproducing the problematic draft case in FreeCAD issue #2497
#Category: Modeling
#Title: OCCT Tutorial pocketed ring

pload MODELING VISUALIZATION

# Set basic dimensions. Problems appear when inner_rad < pocket_center.
dset height 10
dset inner_rad 39
dset outer_rad 50
dset pocket_center 40
dset pocket_rad 20
dset pocket_depth 5

# Construct base profile (the "my_ring")
puts "Constructing my_ring..."

circle c_inner 0 0 0 0 0 1 inner_rad
circle c_outer 0 0 0 0 0 1 outer_rad
mkedge e_inner c_inner
mkedge e_outer c_outer
wire w_inner e_inner
wire w_outer e_outer

plane p0
mkface my_ring_inner_base p0 w_inner
mkface my_ring_outer_base p0 w_outer

prism my_ring_inner my_ring_inner_base 0 0 height
prism my_ring_outer my_ring_outer_base 0 0 height

bcut my_ring my_ring_outer my_ring_inner

# Make the pocket
puts "Constructing pocket..."

circle pocket_base pocket_center 0 0 0 0 1 pocket_rad
mkedge pocket_base pocket_base
wire pocket_base pocket_base

mkface pocket_base p0 pocket_base

prism my_pocket pocket_base 0 0 pocket_depth

# Make the cut
puts "Making the cut"

bcut slotted_ring my_ring my_pocket

explode slotted_ring F

# Make the draft
puts "Drafting the face"

# Found face by trial and error: slotted_ring_3
# Perform the draft
depouille slotted_ring_with_draft slotted_ring 0 0 -1 slotted_ring_3 44 0 1 0 0 0 1

puts "Showing result..."

# Display result
vdisplay slotted_ring_with_draft
vfit

Operating System

Linux

Compiler

GCC

Bitness

64-bit

OCCT Version

latest

Additional Files

No response

@dpasukhi dpasukhi added 0. New The issue was created, but not updated by maintainer. Waiting for updates labels and categories 1. Modeling Boolean operations, offsets, primitives, any conversion, brep builders and etc... 2. Bug Something isn't working 7. FreeCAD The issue related to FreeCAD project labels Jan 28, 2025
@dpasukhi dpasukhi changed the title Error when finding the intersection between a new face made after a draft and the inner face of body Error when finding the intersection between a new face made after a draft and the inner face of body [32857] Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. New The issue was created, but not updated by maintainer. Waiting for updates labels and categories 1. Modeling Boolean operations, offsets, primitives, any conversion, brep builders and etc... 2. Bug Something isn't working 7. FreeCAD The issue related to FreeCAD project
Projects
Status: Todo
Development

No branches or pull requests

1 participant