You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// test to see if we can successfully get back nothing with an undefined object
o6 = undef;
assert( obj_accessor(o6, "string", default="default") == "default" );
...but no indication WHY. It may have been a consistency thing (all values callable via obj_accessor(), even when there's no actual object), or a precursor based on default values, but I can't imagine this being used in either of these ways.
revert this behavior - it is already disabled from within issue-9
make sure nothing else depends on this behavior within 507
remove this behavior
The text was updated successfully, but these errors were encountered:
Ah. Found at least one case where that's used directly:
function arm_length(arm) = sum([ strut_length(arm_strut1(arm), default=0), strut_length(arm_strut2(arm), default=0) ]);
(from 507common's arm.scad).
In this case, there is no easy way to know if the Arm object has strut1 and strut2 defined when calculating the full arm length. So it leverages the "empty object" behavior here as a shortcut and depends on the default argument to be returned, if the Arm strut2 attribute isn't set to a Strut object.
Practically speaking, estimating the correction time within 507 would be difficult. I'm going to re-implement this behavior .... somehow? ... and leave this issue open until this can be confidently purged.
https://github.com/jon-gilbert/openscad_objects/blob/main/object_common_functions.scad#L781-L783
It's not clear under what conditions an undefined
id
here would be supportable.There is a specific test for this case:
https://github.com/jon-gilbert/openscad_objects/blob/main/tests/test_03_object.scad#L194-L196
...but no indication WHY. It may have been a consistency thing (all values callable via obj_accessor(), even when there's no actual object), or a precursor based on default values, but I can't imagine this being used in either of these ways.
The text was updated successfully, but these errors were encountered: