|
|
my very first iso-surface (and second macro) :-)
the thread is a single iso-surface, bold heads and nuts are CSG.
shown:
M3 x 25
M6 x 50
M10 x 30
M16 x 50
M64 x 150
#macro thread_macro( thrOD, totalLen, solidLen, thrSpoed )
// thrOD : outer diameter, before "cutting" the thread.
// totalLen: result: <0,0,0> to <0,0,-totalLen>
// solidLen: <0,0,0> to <0,0,-solidLen> is not threaded.
// thrSpoed: displacement per revolution (spoed) (=25.4/tpi)
#declare thrAngle = 60; // (degrees)
#declare chamOut = 0.05; // chamfer outside (part of threadDepts)
#declare thrRad = 0.5*thrOD;
#declare thrs = 1/thrSpoed;
#declare thrDepts = 0.5*thrSpoed/tan(radians(thrAngle)*0.5);
isosurface {
function{ max(
sqrt(pow(x,2)+pow(y,2))-thrRad + // cilinder
max( min(thrDepts*max(chamOut, // chamfered threads
abs(mod(2+z*thrs*2+atan2(x,y)/pi,2)-1)), // threads
max((z-solidLen)*0.25, 0)), // = sollid part
thrDepts+z-totalLen) // = chamfered end
,2*thrOD-sqrt(pow(x,2)+pow(y,2)+
pow(totalLen+thrOD*1.965-z,2)) )}// = dimple in end
max_gradient 2.0
accuracy thrOD/1000
contained_by{box{<-thrRad,-thrRad,0>,<thrRad,thrRad,totalLen>}}
scale <1,1,-1>
}
#end
jaap.
Post a reply to this message
Attachments:
Download 'parts3.png' (158 KB)
Preview of image 'parts3.png'
|
|