Skip to content

Commit

Permalink
Fixed super constructor calls
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Dec 21, 2022
1 parent eed41ff commit 361e886
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions python3/rhinoscript/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ def GetObject(message=None, filter=0, preselect=False, select=False, custom_filt

class CustomGetObject(Rhino.Input.Custom.GetObject):
def __init__(self, filter_function):
super().__init__()
self.m_filter_function = filter_function
def CustomGeometryFilter( self, rhino_object, geometry, component_index ):
rc = True
Expand Down Expand Up @@ -268,6 +269,7 @@ def CustomGeometryFilter( self, rhino_object, geometry, component_index ):

class __CustomGetObjectEx(Rhino.Input.Custom.GetObject):
def __init__(self, allowable_geometry):
super().__init__()
self.m_allowable = allowable_geometry
def CustomGeometryFilter(self, rhino_object, geometry, component_index):
for id in self.m_allowable:
Expand Down Expand Up @@ -406,6 +408,7 @@ def GetObjects(message=None, filter=0, group=True, preselect=False, select=False
objects = rhutil.coerceguidlist(objects)
class CustomGetObject(Rhino.Input.Custom.GetObject):
def __init__(self, filter_function):
super().__init__()
self.m_filter_function = filter_function
def CustomGeometryFilter( self, rhino_object, geometry, component_index ):
if objects and not rhino_object.Id in objects: return False
Expand Down
28 changes: 28 additions & 0 deletions tools/convert_py2to3.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,34 @@ def selection_fixes(item):
sf.replace("def __FilterHelper(filter):", "def __FilterHelper(input_filter):")
sf.replace("if filter &", "if input_filter &")

sf.replace(
"""
class CustomGetObject(Rhino.Input.Custom.GetObject):
def __init__(self, filter_function):
self.m_filter_function = filter_function
""".strip(),
"""
class CustomGetObject(Rhino.Input.Custom.GetObject):
def __init__(self, filter_function):
super().__init__()
self.m_filter_function = filter_function
""".strip(),
)

sf.replace(
"""
class __CustomGetObjectEx(Rhino.Input.Custom.GetObject):
def __init__(self, allowable_geometry):
self.m_allowable = allowable_geometry
""".strip(),
"""
class __CustomGetObjectEx(Rhino.Input.Custom.GetObject):
def __init__(self, allowable_geometry):
super().__init__()
self.m_allowable = allowable_geometry
""".strip(),
)


def surface_fixes(item):
"""Fix misc items in rhinoscript/surface.py"""
Expand Down

0 comments on commit 361e886

Please sign in to comment.