I’m getting an unexpected error while trying to call either of the methods Curve.OffsetMany or PolyCurve.OffsetMany in python
def rebuffer_polycurve(pc, offset=OFFSET_BUFFER):
# so this needs to 'over/under' offset to remove inconsequential features
# work in + and - directions
# + (outer curve): + then -. no edge cases here
# - (inner curve): - then +. offsetting inward can cause two conditions
# a: offset degenerates into multiple curves
# b: offset degenerates completely, and cannot yield a valid curve.
print(f"try: {pc}")
print(f"type: {type(pc)}, {type(offset)}")
try:
while (True):
try_pc_over_buffer = pc.OffsetMany(offset, True)
print(try_pc_over_buffer)
if len(try_pc_over_buffer) == 1:
pc_over_buffer = try_pc_over_buffer[0]
break
else:
offset -= 0.05*offset
print(f"pc_over_buffer: {pc_over_buffer}")
pc_under_buffer = Curve.OffsetMany(pc_over_buffer, -1*offset)[0]
print(f"pc_under_buffer:{pc_under_buffer}")
except Exception as e:
print(e)
pc_under_buffer = None
return pc_under_buffer
i’m trying to translate some code from DesignScript to python so i have some more control over what happens, but i’m getting a TypeError on the call
No method matches given arguments for OffsetMany: (<class ‘float’>, <class ‘bool’>)
my trace shows pc as PolyCurve and offset as float. I know the protogeometry library technically expects ‘double’ as an input. I thought maybe this is some weird CPython3 type issue, but normally i don’t have any issues with numeric types as arguments in python.
the fuget doesn’t show any info on OffsetMany so i’m sort of stumped. I tried casting it to System.Double but it doesn’t accept that either. maybe i’m missing something here?
thoughts?