i’m trying to extrude planar curves on bothsides, but ExtrudeCurveStraight has no bothsides options.
I’m wondering how can i do this , any help appreciated.
Thanks.
Call Main()
Sub Main()
Dim arrCrv, Dist, strCrv, arrPlane
Dim arrDir,arrPoint
arrCrv = Rhino.GetObjects("Select planar curves", 4, True, True)
If IsNull(arrCrv) Then Exit Sub
Dist = 20
For Each strCrv In arrCrv
If Rhino.IsCurvePlanar(strCrv) Then
arrPlane = Rhino.CurvePlane(strCrv)
arrDir = Rhino.VectorScale(arrPlane(3), Dist)
arrPoint = Rhino.PointAdd(arrPlane(0), arrDir)
Rhino.ExtrudeCurveStraight strCrv, arrPlane(0), arrPoint
End If
Next
End Sub
i made a python script for extruding multiple planar curves which has a bothSides option… for that one, i moved the curve to one side then extruded from there… here’s the script if you want to have a look at it:
(*note, if you actually use this script’s bothSides option, the entered distance will be for the overall thickness of the extrusion as opposed to half the distance as seen in rhino’s extrudeCurve)
Basically if you have your extrusion vector and magnitude, you can first move/copy the curve to be extruded in the opposite direction by that vector, then extrude it 2x the magnitude… --Mitch
Option Explicit
Call Main()
Sub Main()
Dim arrCrv, Dist, strCrv, strBaseCrv, arrPlane
Dim arrDir, arrMove, arrPoint
arrCrv = Rhino.GetObjects("Select planar curves", 4, True, True)
If IsNull(arrCrv) Then Exit Sub
Dist = 20
For Each strCrv In arrCrv
If Rhino.IsCurvePlanar(strCrv) Then
arrPlane = Rhino.CurvePlane(strCrv)
arrMove = Rhino.VectorScale(arrPlane(3), -Dist)
strBaseCrv = Rhino.CopyObject(strCrv, arrMove)
arrDir = Rhino.VectorScale(arrPlane(3), 2 * Dist)
arrPoint = Rhino.PointAdd(arrPlane(0), arrDir)
Rhino.ExtrudeCurveStraight strBaseCrv, arrPlane(0), arrPoint
Rhino.DeleteObject strBaseCrv
End If
Next
End Sub
probably no need to have a look at the python script… it’s pretty much the same thing that mitch showed in the language you’re familiar with (which i’m not… that rhinoscript isn’t available on mac)