Extrude curves in RhinoScript Editor

I’m putting together a script and what I want to do is the following.

This will be part of a script that imports DXF drawings from a folder, joins the lines, creates a group, extrudes a distance and hides everything on the screen. It repeats all this for all DXF files in a selected folder.

Choosing the folder is the only intervention made by the user.

For the part of importing the DXF files from a folder, I’ll use the code I found “BatchImportGen.rvb”
So after the imported file I have a set of lines and circles in a drawing on the main XY plane.

First select all the lines. I used Rhino.AllObjects. Done
Join all the lines. I used Rhino.JoinCurves. Done
Group all the lines giving them names. I used Rhino.AddGroup and Rhino.AddObjectsToGroup. Done
Then Extrude this group. I’m trying but I’m not getting it. Pending
The extrude is the “_ExtrudeCrv” that extrudes flat curves at a given distance.
The problem is that the option to select everything on the screen “Rhino.AllObjects” returns an “Array” and the commands “Rhino.ExtrudeCurveStraight” or “Rhino.ExtrudeCurve” or “Rhino.ExtrudeCurveNormal” need to receive a “String”.
I have a set of lines that when joined together form a “Polyline” and then a “Group” and I don’t know how to collect the “String” of this “Group”.
I want an automatic command that does not require user intervention.
I need help.

My code is like this now:

Option Explicit
'Script written by
'Script copyrighted by
'Script version Monday, 07 October 2024 18:35:00

Call Main()

Sub Main()

Dim objFile
Dim eName
Dim strOpen
Dim strFilename
Dim strLayername
Dim arrLCO
Dim blnFound
Dim arrObjects
Dim strObject
Dim strGroup
Dim groupName
strGroup = Rhino.AllObjects(1)
' group
groupName = "group_c"
'allGroupName_L = Rhino.GroupNames()
Rhino.JoinCurves strGroup, True

strGroup = Rhino.AllObjects(1)

Rhino.AddGroup(groupName)

Rhino.AddObjectsToGroup strGroup, groupName

strGroup = Rhino.AllObjects(1)

Rhino.ObjectName strGroup, groupName

strGroup = Rhino.AllObjects(1)

strGroup = Rhino.GetObject False, 1

Rhino.ExtrudeCurveStraight groupName, Array(0, 0, 0), Array(0, 10, 10)

'Rhino.HideObjects strGroup

End Sub

Many things here…

First, AllObjects gets every object in the file, including locked and hidden objects and those on locked or off layers. I think you want NormalObjects instead, which gets only visible, selectable objects.

Second, you might consider using Rhino.ExtrudeCurvesStraight which takes two points to determine the extrusion height. All the Rhinoscript extrusion methods are single-curve only. That means you need to create a loop and loop through the array(list) of curves and extrude them one by one. See the Rhinoscript help under “Looping” to see how that works. You will need loops for many things.

Third, if you are wanting to extrude “solid”, you might want to check that the curves that are the result of JoinCurves are actually closed. (Rhino.IsCurveClosed) You need a loop for this too. Then you will need Rhino.CapPlanarHoles (also in the loop) to close the extrusions.

1 Like

I was already imagining that I would have to make a loop to extrude all the items in the “Array” one by one.
I just thought there was a simpler method to do this.
Thanks for the tip.