SketchUp / api-issue-tracker

Public issue tracker for the SketchUp and LayOut's APIs
https://developer.sketchup.com/
39 stars 10 forks source link

Warn when setting gluing or cut openign without first enabling gluing #543

Open Eneroth3 opened 3 years ago

Eneroth3 commented 3 years ago

Continuing from #256, Behavior#snapto= and Behavior#cuts_opening= should warn if used when gluing ("is2d?") is false.

DanRathbun commented 3 years ago

I still feel better docs and aliasing the "is2d" methods as "gluable" would prevent most confusion, without the "noise" of console warnings.

Eneroth3 commented 3 years ago

The warning would only show up for incorrect usage where raise really is more idiomatic. Raising would however risk breaking existing code that expects a silent failure from these two methods. If you first set is2d/gluable to true before setting a property that depends on it, you will not see any warnings.

DanRathbun commented 3 years ago

But then what if you wish to switch off gluing, but leave the type of gluing set ? No warning is issued.

I see this a "nanny-API" and unnecessary.

Proper documentation is the key. But a combo setter method could be added that also sets is2d true, such as:

cdef.set_gluing(snap_to_type)