tpaviot / pythonocc-core

Python package for 3D geometry CAD/BIM/CAM
GNU Lesser General Public License v3.0
1.38k stars 380 forks source link

When I use BRepPrimAPI_MakeTorus in pythonocc to make a Torus, but I can't get the result I want. #1001

Open VIC-LKH opened 3 years ago

VIC-LKH commented 3 years ago

hello, thank you for providing a very nice python interface to OpenCasCade. When I used the BRepPrimAPI_MakeTorus function in pythonocc to make a Torus, I encountered a problem. Here is my code:

from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeTorus
from OCC.Display.SimpleGui import init_display      
display, start_display, add_menu, add_function_to_menu = init_display()
from math import  pi

angle1 = -45
angle2 = 45
angle = 90
R1 = 5
R2 = 2

my_torus = BRepPrimAPI_MakeTorus(R1, R2, angle1/180*pi, angle2/180*pi, angle/180*pi).Shape()
display.DisplayShape(my_torus, update=True)
start_display()

When the torus was displayed on my screen, the result was different from what I want. The result of code execution was just like this: image

But what I want is just like this (the same as what has been described in Users' Guides in OpenCasCade Technology 7.5.0): image

The version of pythonocc I use is 7.5.1 and Python is 3.7.10. Is my understanding of Users' Guides wrong? or is there a bug in Pythonocc-7.5.1 code ? @tpaviot

tpaviot commented 3 years ago

Confirmed.

VIC-LKH commented 3 years ago

Ok, I see. Thank you @tpaviot

tpaviot commented 3 years ago

But I dont know why it fails

VIC-LKH commented 3 years ago

I might use this function in this way, but I don't know why it fails too. If it is hard to find this bug, I will use another way to achieve the result I want.

tpaviot commented 3 years ago

Hard to say if it's a pythonocc or occt issue

VIC-LKH commented 3 years ago

I have seen other people's OCCT result before and it seemed that OCCT worked well. But I don't konw the version of OCCT they used. It's not convenient for me to test it in OCCT directly now and I don't know whether OCCT-7.5.1 can work well with this example or not.

tpaviot commented 2 years ago

Same result wih occt7.5.3. I think this is an occt bug which should be reported upstream.