Lasernotch Eggcrate Script 2004

From scripting
Revision as of 07:13, 22 April 2017 by Nickpisca (talk | contribs) (Created page with "right|thumb|300px|Lasernotching Setup. right|thumb|300px|Lasernotching Complete. Image:LASERNOTCHIMAGE03.png|...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Lasernotching Setup.
Lasernotching Complete.
Lasernotching Close-Up.
Manually laid onto the CPlane.

This code was written in 2004 for Rhino 3 SRC by Nick Pisca. The process allows for the notching of flat or curved (even double-curved) NURBS Surfaces. This script does not trim the surfaces or lay them flat, for these processes are often better performed by a user to ensure correct splitting directionality.


Process:

First, create NURBS surfaces to be notched. Run this code:

Dim Length002, strobjects3
Length002 = Rhino.Getreal("What the hell is your material thickness????", 0.0625)
Rhino.addlayer"Top_Pieces001", RGB (207,229,156)
Rhino.addlayer"Bottom_Pcs001", RGB (61,66,87)
Rhino.currentlayer("Top_Pieces001")
strobjects3 = Rhino.GetObjects("Pick your top curves Dummkopf", 8 + 16)
Rhino.Selectobjects strobjects3
Rhino.command("-properties _visible=yes object layer Top_pieces001 enter enter")
Rhino.Invertselectedobjects
Rhino.currentlayer("Bottom_Pcs001")
Rhino.command("-properties _visible=yes object layer Bottom_pcs001 enter enter")
Rhino.command("selnone")
Rhino.command("selsrf")
'013      copyright 2004 Nicholas Pisca -- Lasercut notching program.  
Rhino.command("intersect")
Dim strobjects4, strobject4, dbllengths4, arrpoints4, arrpoint4
strobjects4 = Rhino.objectsbytype(4, vbTrue)
For Each strobject4 In strobjects4
'018
dbllengths4 = Rhino.curvelength(strobject4) / 2 
arrpoints4 = Rhino.dividecurvelength(strobject4,dbllengths4)
For Each arrpoint4 In arrpoints4
Rhino.addpoint arrpoint4
'023
Next
Next
Rhino.command("selnone")
Rhino.command("selcrv")
'028
Rhino.command("split selpt enter")
'
Rhino.addlayer"kcas", RGB (24,87,222)
Rhino.currentlayer("kcas")
Dim arrobjects5, arrobject5
'033
arrobjects5 = Rhino.objectsbytype(4, vbTrue)
For Each arrobject5 In arrobjects5
'036
Rhino.Selectobject arrobject5
Rhino.command("pipe _cap=yes _thick=no d " & Length002 & " enter enter")
Rhino.Selectobject arrobject5
Rhino.command("hide")

Next
Rhino.command("show")

Dim strobjects9, strobject9
strobjects9 = Rhino.objectsbytype(4, vbTrue)
For Each strobject9 In strobjects9  
If Rhino.polycurvecount(strobject9) = 5 Then
Rhino.deleteobject strobject9
End If
Next


Post-Processing

This macro just produces the trimming objects. Select the cutting tubes and "Split" them against one direction of surfaces to-be-notched. Do the same for the opposing direction. Delete the split surface remnants, and voila! Notched Surfaces.


Lasercutting Preparation

Use a command like "DupBorder" to extract the outside edges for lasercutting. If you have 3D surfaces, you can unroll the newly split surface first, then use "DupBorder" on the CPlane to make the split surfaces. Exciting.