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

Setting referenced based class attributes #93

Open
capfish opened this issue Nov 1, 2021 · 3 comments
Open

Setting referenced based class attributes #93

capfish opened this issue Nov 1, 2021 · 3 comments

Comments

@capfish
Copy link

capfish commented Nov 1, 2021

Expected Behavior

I am unable to set the ShapeFix_Wireframe mode to remove small edges via its attribute ModeDropSmallEdges Relatedly, I am also unable to change any of the modes (i.e. FixSolidMode, FixFreeFaceMode, etc) in ShapeFix_Shape

>>> from OCCT.Exchange.Basic import ExchangeBasic
>>> from OCCT.ShapeFix import ShapeFix_Wireframe
>>> my_part = ExchangeBasic.read_step('path/to/my/step.step')
>>> wireframe_fixer = ShapeFix_Wireframe(my_part)
>>> wireframe_fixer.ModeDropSmallEdges = True
>>> wireframe_fixer.ModeDropSmallEdges()
True

Current Behavior

>>> from OCCT.Exchange.Basic import ExchangeBasic
>>> from OCCT.ShapeFix import ShapeFix_Wireframe
>>> my_part = ExchangeBasic.read_step('path/to/my/step.step')
>>> wireframe_fixer = ShapeFix_Wireframe(my_part)
>>> wireframe_fixer.ModeDropSmallEdges = True
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'OCCT.ShapeFix.ShapeFix_Wireframe' object attribute 'ModeDropSmallEdges' is read-only
>>> wireframe_fixer.ModeDropSmallEdges()
False

Possible Solution

This seems to be because those attributes are passed by reference in the C++ libraries, I'm not strong in pybind-fu so I'm not sure what would have to be changed, but I'm willing to try if you point me in the right direction!

Context

I have been having issues with the capping plane feature and I was pointed to these shape healing tools on the OpenCascade forums They work alright, but it is clear that I have some small disconnected edges that need removed and I'm unable to set the attribute.

Your Environment

  • Version used: 7.5.2
  • Operating System and version (desktop or mobile): Windows 10, Debian Stretch
@russelmann
Copy link

I guess you intend to use method MergeSmallEdges, note that it has argument theModeDrop which you can set true as a workaround.

@capfish
Copy link
Author

capfish commented Feb 9, 2022

Oh interesting I completely missed that. I was intending to run FixSmallEdges, do you know if running MergeSmallEdges with theModeDrop=True followed by FixSmallEdges with ModeDropSmallEdges set to False is equivalent to just running FixSmallEdges with ModeDropSmallEdges set to False?

@russelmann
Copy link

Seems that the workaround won't help using method FixSmallEdges. In case you don't need to call it on a compound, you should be fine calling CheckSmallEdges and MergeSmallEdges instead. You can check the implementation of FixSmallEdges here , line 408. Lines 421-462 show an involved specific behavior for compounds with a recursive call which is problematic. However if you use any other topology is should suffice to only reimplement lines 463-466 in Python.

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

No branches or pull requests

2 participants