Comments (3)
Just a thought about this.
I think you could mitigate the concern around existing personal THREAD_TABLEs by using the len() function.
I havent looked at your code directly yet, but I presume you have a public API that is essentially parsing user input and then sending that to a private worker function to do the work on the thread params.
If true, then it seems like it would be pretty easy to extend your internal table to include the # starts column, and then when you go to pass that information back to the private function you first check if the number of starts is provided for that thread profile, else you default to 1. and possible kick off a warning.
pseudo code concept:
table = [ A, B, C, D ];
search for thread C profile.
profile = C // [ name, ..... , ... , ... , num starts ] or [ name, ..... , ... , ... ] if num starts is not specified.
num_starts = 1; // quick assignment to default value
if( len( profile ) == max_profile_len )
{
num_starts = profile[x];
}
private_function( ......... )
from threadlib.
I'd have to look into that. What makes life a bit nasty is that OpenSCAD apparently allows only a single statement inside a function. As far as I understand, you cannot lookup first, then decide.
The current code is this:
function thread_specs(designator, table=THREAD_TABLE) =
/* Returns thread specs of thread-type 'designator' as a vector of
[pitch, Rrotation, Dsupport, section_profile] */
table[search([designator], table, num_returns_per_match=1,
index_col_num=0)[0]][1];
from threadlib.
I have not looked at the code, so I'm not sure this would work for functions ( Recall them not being very friendly .
I have seen either extenttion blocks at the end as well as version information. The version information is more future proof. It's too late to do that since you already have a structure, but - if you add the version as the last parameter, and you make it obvious ( v1 ), entry without it is assumed v1/v0.
There are two slippery slopes:
- It makes it too easy to pile on features, that maybe should not be there ( lets just make a new version )
- You may endue with "Dead Info" fields. unused in most cases, but you still need to deal with it.
Thinking about that last one - maybe the "version block" can contain some type of "structure" that describes the blocks ( thread+multi ) - but again, this is an increase in complexity.
from threadlib.
Related Issues (20)
- struggling to get a G1/2 nut fit on a G1/2 bolt HOT 2
- Explanation of [pitch, Rrotation, Dsupport, section_profile] HOT 4
- Missing UIS Threads
- link in readme HOT 5
- DesignOfThreadlib example HOT 1
- Refactor nut to allow hex nut HOT 1
- Duplicates in THREAD_TABLE.scad HOT 2
- PCO-1881 for PET bottle threads not producing workable result HOT 3
- How do I make a 1/4" lag screw? HOT 1
- Tool to create thread specs?? HOT 1
- Error creating a thread?/ HOT 1
- M10 0.9 and 1.0 Pitch for 3D printer bowden tubing coupler? HOT 1
- Can't open library 'thread_profile.scad'. HOT 3
- Improved Profile illustration
- M12 nut and M12 bolt do not fit HOT 12
- Example M4 profile in DesignOfThreadlib.md gives unexpected results (winding order) HOT 1
- recursion detected HOT 4
- With my own thread table definition, the mesh is not closed. HOT 1
- Tolerances / Tension if 3D printed
- ignoring unknown module "nut" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from threadlib.