'////////////////////////////////////////////////////////////////////////////// ' ' Conic_helical_pocket.vbs ' CamBam vbscript ' by AMDlloydsp, with credits to 10 Bulls for the idea from "Boingy" ' and added features requested by GraphicsMan ' ' based upon "conic helix.vbs". This routine differs by using a target ' depth and depth increment, and does one complete circuit at the starting ' and ending depths, in order to finish the contour. ' dim turns as single dim top_diameter as single dim bottom_diameter as single dim depth_increment as single dim strAnswer as string dim direction as single dim smooth as single dim target_depth as single dim test_string as string function MakeConicHelix as polyline dim start as single = 0 ' in radians dim finish as single = turns*2*pi '30*pi ' in radians dim steps as single = turns*smooth ' number of steps dim radius as single = top_diameter/2 dim startz as single = 0 dim endz as single = -1*depth_increment*turns dim radius_step as single = (bottom_diameter-top_diameter)/(steps*2) dim x as single = 0 dim y as single = 0 dim z as single = startz dim th as single = start dim dt as single = (finish-start)/steps*direction dim dz as single = (endz-startz)/steps '// Get the drawing ready to draw dim p as Polyline = new Polyline ' start by doing one full turn without any depth increment for i as short = 0 to smooth-1 x = radius * math.cos(th) y = radius * math.sin(th) p.Add(x,y,z) th = th + dt next i ' now make loops with depth increment per loop for i as short = 0 to steps-1 if z+dz < target_depth z=target_depth else z = z + dz end if x = radius * math.cos(th) y = radius * math.sin(th) p.Add(x,y,z) radius=radius+radius_step th = th + dt if z=target_depth then exit for next i ' finally, make one loop at depth to finish out the bottom for i as short = 0 to smooth-1 x = radius * math.cos(th) y = radius * math.sin(th) p.Add(x,y,z) th = th + dt next i MakeConicHelix = p end function sub main top_diameter=val(Inputbox ("Spitzen Durchmesser? ")) bottom_diameter=val(Inputbox ("Boden Durchmesser? (muss kleiner als der Spitzendurchmesser sein oder gleich um einen Zylinder zu erzeugen)? ")) depth_loop: target_depth=val(Inputbox("Zieltiefe (muss ein negativer Wert sein)")) if target_depth>=0 goto depth_loop end if depth_increment=Math.Abs(val(Inputbox ("Tiefen Zustellung"))) turns=Math.Abs(target_depth/depth_increment) direction=val(Inputbox("Richtung der Umdrehung-- -1=Gegen Uhrzeigersinn, 1= im Uhrzeigersinn")) direction=direction*-1 smooth=val(Inputbox("Weichzeichnungsfaktor(Anzahl der Segmente pro Umdrehung) 100 ist ein guter Mittelwert.")) 'test_string=string.format("Top={0}, Bottom={1}, Target={2}, Incr={3}, turns={4}",top_diameter,bottom_diameter,target_depth,depth_increment,turns) 'MsgBox(test_string) dim p as polyline = MakeConicHelix() doc.add(p) end sub