wovo / psml

Python library for OpenSCAD
Boost Software License 1.0
5 stars 1 forks source link

Why define circles by radius instead of diameter? #1

Closed ipsod closed 4 years ago

ipsod commented 4 years ago

When dealing with mechanical parts, it's easier (possible) to measure diameter. You don't really see blueprints with radius specified - it's always diameter. So, why use radius in this program that's mostly used to make mechanical drawings?

ipsod commented 4 years ago

https://github.com/wovo/psml/compare/master...ipsod:patch-1

wovo commented 4 years ago

personally, I never use diameter. that probably identifies me as not a mechanical person 🙂

let me think abut a solution. adding two named parameters is easy, and it would force the caller to be explicit: circle( d = 5 ) or circle( r = 2.5 ).

The problem would be when a cyclinder is specified by a vector instead of by individual parameters:

s = vector( 10, 20 ) c = cylinder( s )

So either

s = vector( 10, d = 20 ) s = vector( 10, r =20 )

I tend to the last option. Do you have a preference?

Wouter van Ooijen

0638150444 - HL15 4.060


From: ipsod notifications@github.com Sent: Monday, March 2, 2020 7:23 PM To: wovo/psml psml@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [wovo/psml] Why define circles by radius instead of diameter? (#1)

When dealing with mechanical parts, it's easier (possible) to measure diameter. You don't really see blueprints with radius specified - it's always diameter. So, why use radius in this program that's mostly used to make mechanical drawings?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/wovo/psml/issues/1?email_source=notifications&email_token=ACE643BMVTPSPVD5JJYQXN3RFP2RFA5CNFSM4K7Z5YEKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IRY7O6A, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACE643FMROLOYLMGSAP73L3RFP2RFANCNFSM4K7Z5YEA.

ipsod commented 4 years ago

I like the last option best. I like explicitness and {diameter}/2 is considerably harder to understand at a glance than d={diameter}. It could default to radius, like OpenSCAD does.

wovo commented 4 years ago

Circle etc. now have two parameters, radius and diameters, and you must provide one (but not both), adn it must be a named parameter.

For the cases where a vector is used to supply values it is still the radius. Maybe I'll find something for that, or I'll keep it that way, or I'll remove the option to supply a vector. I need more thinking time for that.

The examples still all use radius, I'll change that later.