Home > Plugin > RhinoScript | Cut solids

RhinoScript | Cut solids

1.*How to use Rhinoscript

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 Sub

Video Tutorial

An Example by nnnaaarrr:

I Modeling A bottle like this use this script:

bottle_cutsolid

Tags:
  1. No comments yet.
  1. No trackbacks yet.