RhinoScript | Cut solids
->
2. Cut solids script by Sac3
[VIA] Sac3
Option Explicit
'2008.12.10
'Script by sac3@rhinos.co.kr
CutSolid
Sub CutSolid ()
Dim arrObjects, arrPoints, arrVector1, arrVector2, arrBD, strCut
arrObjects = Rhino.GetObjects ("Select Solids to Cut",8+16,vbTrue,vbTrue)
If IsNull(arrObjects) Then Exit Sub
arrPoints = Rhino.GetPoints (True, False , "Pick 3 Points",, 3 )
If IsNull(arrPoints) Then Exit Sub
If UBound(arrPoints) <2 Then Exit Sub
Rhino.EnableRedraw False
arrVector1= Rhino.VectorCreate (arrPoints(0), arrPoints(1) )
arrVector2= Rhino.VectorCreate (arrPoints(0), arrPoints(2) )
strCut = Rhino.AddCutPlane (arrObjects, arrPoints(0), arrPoints(1) , arrVector2)
arrBD = Rhino.BooleanDifference (arrObjects, Array(strCut) )
If IsArray(arrBD) Then
Rhino.ShrinkTrimmedSurface arrBD(0)
Rhino.SelectObjects arrBD
Else
Rhino.DeleteObject strCut
Rhino.Print "Failed to Cut"
End If
Rhino.EnableRedraw True
End SubVideo Tutorial
An Example by nnnaaarrr:
I Modeling A bottle like this use this script:
