Forgot password?

Create an account!


« back

RhinoScript – pivots-gumballs info export


Please log in to write a message.

  • 10. patro (Jun 15, 2011 11.23):

    as you can notice from the image, the gumballs are activated on all objects.
    as you can see each gumball is aligned to the proper object, also after a polar array.
    what i need is to export to a txt the position of the gumballs, to import the gumballs position in 3ds max and align them to the as sat exported nurbs/polysurfaces from rhino and imported as nurbs obj in 3ds max.

    at time if you export from rhino and mostly from all other 3d software.. once you have the geometries imported into an other software the transformations info are lost. all pivots are aligned to the world.
    like in this image[...]
    as you can notice all pivots in 3ds max are aligned to the world... so that each objects while clones has different aligned pivots. this make each objects different from the other one.

    what we need is a script that can tell us the gumball position of every selected object in the scene.
    if i was not clear, let me know so to can try to explain with more examples.
    thank you

    pivots-gumballs info export
  • 9. Johannes (Jun 15, 2011 10.56):

    what do you mean with the gumball informations? gumball is a nice tool in rhino but...?
    do you need a plane/boundingbox/... of your object?


  • 8. patro (Jun 15, 2011 09.24):

    helo Johannes,
    thank you for the time and the help.
    the script isn't still working if i use
    the script popup every time an error, if i use only "start" no error popup
    any value of start () popup an error.

    this script is able to locate the centroid of on object, aka the center geometry point of the object. 3 coordinates locate just a point in the space.
    but thinking on it what i need is to know the alignment of the point in relation of the obeject, this can't be done with just a point.
    we need to have at last 4 points, 1 for the origin, one on x axis, one on y axis and one for x axis.

    that is why i'm asking for the gumball, since it's more like an object.
    thank you for the help, and please if you know how to print out the gumball let me know.

    thank you

  • 7. Johannes (Jun 15, 2011 08.50):

            Dim obj : obj = Rhino.GetObject("Select object")
            If IsNull(obj) Then Exit Sub

            Dim start: start = Rhino.SurfaceVolumeCentroid(obj)
            Dim coord: coord = start(0)
                    If IsArray(coord) Then
                    MsgBox "" & _
                            "X: " & CStr(coord(0)) & _
                            "Y: " & CStr(coord(1)) & _
                            "Z: " & CStr(coord(2))
            End If
  • 6. patro (Jun 14, 2011 13.34):

    now the error is located in line 9 char 16
    type not corresponding: 'start'

    any clue?

    thank you

  • 5. Johannes (Jun 14, 2011 12.53):

    you don't need the function rhino.pointcoordinate()...

            Dim coord : coord = start(0)
  • 4. patro (Jun 14, 2011 09.15):

    what is wrong here:

    ' GetObjCoords.rvb
    Option Explicit

    Sub Main()
    Dim obj : obj = Rhino.GetObject("Select object")
    If IsNull(obj) Then Exit Sub

    Dim start: start = Rhino.SurfaceVolumeCentroid(obj)
    Dim coord: coord = Rhino.PointCoordinate(start)

    If IsArray(coord) Then
    MsgBox "" & _
    "X: " & CStr(coord(0)) & _
    "Y: " & CStr(coord(1)) & _
    "Z: " & CStr(coord(2))
    End If

    End Sub

    Call Main

    if i run it.. rhino pop up an error in line 9 char 15

    please we need help, is there anyone that can point us on how to get the gumball position and alignment of a nurbs?

    thank you for the help

  • 3. patro (Jun 12, 2011 20.38):

    hello again and thank you for any help.
    as you can see i'm a noob on shino scripting... so i'l appreciate any help.
    this is the code for the name exporting, the guy that writed this is new to rhinoscripting... he did it after an hour of reading the manual.

    ' SaveAllObjsNamesToFile.rvb

    Option Explicit

    Sub SaveAllObjsNames()

    Dim objShell, objFSO, objFolder, objStream
    Dim strDesktop, strFile, strName, strMsg

    Set objShell = CreateObject("WScript.Shell")
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    strName = "AllObjsNames.txt"
    strDesktop = objShell.SpecialFolders("Desktop")
    strFile = strDeskTop & "\" & strName

    'On Error Resume Next
    Set objStream = objFSO.CreateTextFile(strFile, True)
    If Err Then
    MsgBox Err.Description
    Exit Sub
    End If

    ' Get all the objects in the document
    Dim arrAll
    arrAll = Rhino.AllObjects
    If Not IsArray(arrAll) Then
    Rhino.Print "No objects added to selection."
    Exit Sub
    End If

    ' Find all of the object names
    Dim arrNames(), nBound, i
    nBound = 0
    For i = 0 To UBound(arrAll)
    strName = Rhino.ObjectName(arrAll(i))
    If Not IsNull(strName) Then
    ReDim Preserve arrNames(nBound)
    arrNames(nBound) = strName
    nBound = nBound + 1
    End If

    ' Exit if no names found
    If nBound = 0 Then
    Rhino.Print "No objects added to selection."
    Exit Sub
    End If

    ' Cull the duplicate names
    Dim arrCulled
    arrCulled = Rhino.CullDuplicateStrings(arrNames)

    ' Sort the list alphabetically
    Dim arrSorted
    arrSorted = Rhino.Sort(arrCulled) 'Error =>SortStrings

    ' Format the names to file
    Dim n
    For n = 0 To UBound(arrSorted)
    objStream.WriteLine arrSorted(n)
    Set objStream = Nothing

    strMsg = "A file named " & Chr(34) & strName & Chr(34) & VbCrLf
    strMsg = strMsg & "has been saved to your desktop."
    MsgBox strMsg, 64, "Rhinoceros"

    End Sub

    ' Rhino.AddStartUpScript Rhino.LastLoadedScriptFile
    ' Rhino.AddAlias "SaveAllObjsNames", "_-RunScript (SaveAllObjsNames)"

    ' Run it!
    Call SaveAllObjsNames

  • 2. Johannes (Jun 12, 2011 20.26):

    you have to edit the script which export the names... and you need to know how it should look like... there is a function to read and write a txt file in rhino ... you can read alsmost every information of a nurbs surface in rhinoscript. go to 'help' 'plugins' 'rhinoscript' and take a look on 'object methods',...


    ps: if you have a script and some further questions... upload the code and feel free to ask ;)

  • 1. patro (Jun 11, 2011 15.46):

    hello, i'm new to rhinoscript hope in someone helps.

    where to start, i project in rhinoceros and i never thought about the pivots positions and alignment of a nurbs, or of a series.
    well i use to export my nurbs to import them for a better visualization in 3ds max.
    max offers a lot of tool, one is the possibility to istance all similar nurbs object in a single step, so to increase rendering speed and manipulation.

    through the gumball plugin i'm able to visualize the pivot in rhinoceros, how it is oriented on the geometry, to edit it so to can align it like i want.
    if i create a polar array, each gumballs are aligned correctly to each nurbs and not to the world.

    the problem is that once i export the polysurfaces or nurbs, all transformations info are lost. i like to export as acis sat, it's the best connection way to 3ds max.

    well all pivots in max on the imported nurbs obj are resetted and aligned to the world. this limit the ability to edit and transform the nurbs.

    i'm looking for a way to export the names of the nurbs in a txt, and the related gumballs positions and alignment in rhino info.
    we have just a script that was written by a max coder for rhino, that can export the names of the nurbs to a txt, also we have another script that is able in 3ds max, to load the info stored in the txt and align the pivots to the just imported nurbs.
    one of the most interesting use is for istancing correctly the imported nurbs.

    any one have an idea on how to do this, if this is possible?

    thank you for any help.


Why are these buttons gray?