Forgot password?

Create an account!


« back

RhinoScript – ObjectsbyName Problem...


Please log in to write a message.

  • 2. alexius (Nov 13, 2009 16.35):

    Never mind, I realized what the problem is...:P It just goes out of range at the edges of the grid, so I had to compensate by lowering the range:P

  • 1. alexius (Nov 13, 2009 13.59):

    Hellow guys, I have the following problem:

    First I create a number a points, which I individually name and then use some of those points to generate a tile system.

    Now my problem is, in order to draw the polylines between the points, I need to refer to the Points by their IDs and not by their name, which in order to do, I try to retrieve using the Rhino.ObjectsbyName call... Now the problem is that this apparently works for all the points, which Y=0, but it returns a "type mismath error" for all the rest of the points... Now the strange thing, despite the error returned, it actually DOES select the correct points AND DOES draw the polyline as it should. But I still get the error:S

    Option Explicit
    'A Script by Alexandros Cannas 2009-2010.
    'It generates the Cairo Tiling on a grid which can be defined through the Variables.

    Call Main
    Sub Main
            Dim dX : dX=10
            Dim dY : dY=dX
            Dim intX, intY          :       intX    =       0               :       intY    =       0
            Dim arrPoints
            Dim ptGrids             :       ptGrids =       25
            Dim strObjectID, strNewName
            Dim arrALL
            Call Rhino.EnableRedraw(False)
            'Clears all contents
            arrALL  =       Rhino.AllObjects
            If IsArray(arrALL) Then
                    Call Rhino.DeleteObjects(arrALL)
            End If
            'Generate a Grid an name its Points it according to X_Y  steps 
            Do Until intY=ptGrids+1
                    For intX=0 To (ptGrids) Step 1.0
                            If IsNull(arrPoints) Then Exit Sub
                            strObjectID = Rhino.AddPoint(arrPoints)
                            strNewName = intX & "_" & intY
                            Call Rhino.ObjectName(strObjectID, strNewName)
                            'Call Rhino.Print ("Point Created:"& arrPoints(0)&","& arrPoints(1))

            'Generate Cairo Tiling on the Grid
            Dim arrPT, arrPTS
            Dim ptNameA, ptNameB
            Dim arrID1, arrID2, arrID3, arrID4, arrID5, arrID6
            Dim strID1, strID2, strID3, strID4, strID5, strID6
            Dim X, Y : X=0: Y=0
            Dim i
            For Y=0 To ptGrids Step 8.0
                    For X=2 To ptGrids Step 8.0
                            arrID1  = Rhino.ObjectsByName(X & "_" & Y)
                            strID1  = arrID1(0)
                            arrID2  = Rhino.ObjectsByName(X+1 & "_" & Y)
                            strID2  = arrID2(0)
                            arrID3  = Rhino.ObjectsByName(X+2 & "_" & Y)
                            strID3  = arrID3(0)
                            arrID4  = Rhino.ObjectsByName(X+3 & "_" & Y+2)
                            strID4  = arrID4(0)
                            arrID5  = Rhino.ObjectsByName(X+1 & "_" & Y+3)
                            strID5  = arrID5(0)
                            arrID6  = Rhino.ObjectsByName(X-1 & "_" & Y+2)
                            strID6  = arrID6(0)
                            arrPTS =  Array(Rhino.PointCoordinates(strID1),Rhino.PointCoordinates(strID2),Rhino.PointCoordinates(strID3),Rhino.PointCoordinates(strID4),Rhino.PointCoordinates(strID5),Rhino.PointCoordinates(strID6),Rhino.PointCoordinates(strID1))
                            If IsArray(arrPTS) Then
                                    Call Rhino.AddPolyLine(arrPTS)
                            End If
            Call Rhino.EnableRedraw(True)
    End Sub


Why are these buttons gray?