For many projects I now consider code to be the superior tool for CAD work.

However...

As they say, one of the hardest problems in programming is giving names to things. Quite often I find myself trying to think of a name for a variable like thickness_of_the_piece_that_goes_down_the_side_of_that_weird_angled_cutout_of_the_connector_minus_some_tiny_offset_for_clearance

@jhol If in doubt use single letter variable names.

Actually in this situation, my "tiny offset for clearance" is usually called dr (delta-radius) and the various "thicknesses" get called t1, t2, t3 in order. "t" is a general purpose border/spacer. Same with "w" for widths, "l" for lengths, x,y,z for coordinate positions, etc.

@jhol ...and then you should definitely use functions (of both parameters and shapes) to do stuff. Those can be given more descriptive names. The holy grail here is probably some pure functional programming notation for CAD.

Follow

@sjb Currently all my variables are globals (does it support module locals?).

Even if it did, I often need to borrow values from unrelated parts of the design structure.

It would be cool if it had some form of namespacing, where you can access any variable at any level of the design, but more local variables can be expressed more concisely.

@jhol It's actually the one time I really appreciate the C++ scoping of class member variables. My object has loads of variables, all methods of it (producing various related parts) have access to the same variables. Plus you can have constructors (e.g. parameterised by standard screw thread type).

Sign in to participate in the conversation
Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!