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