V8: Toolbars and SVG

Hi guys, I am testing out making a toolbar in Rhino 8, and SVG’s aren’t the easiest thing to work with.
One way I found is to set up a 48x48 rectangle and put graphics in there (hatches and cures)
Then pop that in a layout that is 48x48 units and set the scaling to match that and then EXPORT the detail on the layout in 48x48 pixels with a corresponding dpi… Not user friendly but it works.

Are there other ways to do this faster in Rhino 8?

Oh, and PS! To make the viewcapture I had to Windows-PrintScreen and then open the image and crop out a portion since the toolbars disappear when I use the Scissor tool. Can Rhino 8 keep the toolbars open like Rhino 7 does when the Scissor tool is used?

GH2 has an icon editor command that does allow generating SVGs. There’s also the very rudimentary button editor in the toolbars system. That’s all we really have at the moment. You might want to try inkscape

How about using a floating viewport?

Thanks Martin, that’s easier than using a layout!

Setting the view to 480x480 pixels and then using 480 x 480 pixels for print and 6 mm as linewidth is a good combination. The linewidth can be sat on per object, layer or on SVG export.

And here is a small macro/script to speed up the process:

import rhinoscriptsyntax as rs
objs = rs.GetObjects("Objects for SVG export", rs.filter.curve + rs.filter.hatch, preselect=True)
if objs:
    rs.EnableRedraw(False)
    rs.Command("_NewFloatingViewport CopyActive Enter", False)
    rs.Command("_-ViewportProperties Size 480 480 Enter", False)
    rs.SelectObjects(objs)
    view = rs.CurrentView(view=None, return_name=False)
    rs.Command("_Zoom Selected",False)
    rs.UnselectAllObjects()
    rs.Redraw()
    rs.SelectObjects(objs)
    rs.Command("_Export")
    rs.Sleep(0)
    rs.CurrentView(view)
    rs.Command("_CloseViewport")
    rs.EnableRedraw(True)
2 Likes

Thanks, but I want to explore how I can do this from Rhino, where we should be able to do it from.

The rudimentary tool you mentioned is horrible WHEN you consider how great a 2D vector package Rhino actually is! We make 2D graphics from Rhino all the time, so let’s see if we can find a good way to utilize that, I think I am 90% on the way to that now.

And now with transparent hatches and gradients and all, I see no reason for you to reinvent the wheel.
But gradient hatches doesn’t seem to export well to SVG, they come back in as solid hatches:

Here is what the export looks like:

And here is what the imported graphic in the icon tool looks like:

I agree, we just haven’t taken this part on yet

When it’s done, feel free to add it to the PackManager. Plugin name idea: HoloDraw

G

Yeah, and I would expect you would find 100 other cooler/more important things to do first too. And I can’t wait for it so hopefully my fiddeling around can inspire you a bit.

PS! Even though I am not a huge fan of making scalable icons I must say that they scale well:

Can I set the icons for the toolbar to a fixed size? In case I want a quick access toolbar with larger icons?

Hehe, that’s not a bad idea, but I don’t intend to spend much time on an icon maker. That said, it works quite fine right now. Just updated the script above. (PS! What I have spent a lot of time on lately is a wms importer for importing maps, 3D terrain and aerial photos directly into rhino, epsg referenced and all. Pretty cool stuff, but that aint for sale)

Is there a way to dump all the stock SVGs for Rhino into a folder? I usually take a stock toolbar button and add an adornment to signify that it modified.

For example I have quick SetPts where I’m only setting the X, the XY, or XYZ.

image

Exporting them one by one is tedious at best.

Hi @stevebaer and @wim I am at a loss here… I am trying to make a brand new toolbar, but that isn’t intuitive.
So far I have only played with this, so apparently I made a new toolbar to the rhino rui.

Here is what I got:

1- To make a new toolbar I have to first make a new rui file, but I can’t do that from the toolbar tool, that has to be done from settings-toolbars “Create New Toolbar and Link” option.
But this doesn’t make a new toolbar, it only makes a new library.

2- So to make a new toolbar there I have to open the Toolbar tool and choose the new library, but that doesn’t have any buttons to show yet, so I can’t open it :expressionless:

3- To make a new button on that toolbar I have to have a command in that library, as I can’t make a new command there, but the library is new so there aren’t any commands.

So so far I have only been able to make an empty rui that I can’t choose to show as it has no icons.

Can you please look into this?

Edit: Oh… that has to be done in the new Macros tool…
This needs to be linked together better so we can quickly make a new macro when we make a new toolbar rui so we don’t have to jump through hoops to make a toolbar. V7 was swift and easy, v8 is clickety-search-click and difficult to remember how stuff is done.

And now I can’t quickly and safely copy a tool from one toolbar to another, since they are linked to libraries… ugh… they are only referenced.

Oh, and if I make a new toolbar in my new rui library then the dialog needs to update to show me that it is made. Now I have to close and open it again to see that I did it right. There is some oddity to the “toggle on and toggle off” options for the toolbars too.

I dragged the toolbar out of the container too and then the container disappeared, and is nowhere to be found again. That was a bit odd. But after that the “toggle on and toggle off” in Toolbars works better too.

And saving a linked file was difficult to find too… You have really scattered this stuff around haven’t you :smiley: It would be great if it could be put together in the Tools-Toolbars panel. I think there is room for both import, save, make new, make macro etc there.

Thanks for listening!

Yeah, the workflow is very inefficient and distributed amongst too many windows. And the windows are all modal, so you can’t have containers, toolbars, and macros open simultaneously.

This is the most insidious part of it. You drag something from a stock Rhino toolbar into your toolbar and get a reference, not a copy. Modifying it to create alternates overwrites the stock Rhino version, and makes the new toolbar you were going to share with your team worthless.

this is not the case, you should be able to right click in any toolbar and get the option to create a new toolbar, but it will add it to the existing default rui

Yes I see this too, as far as I can see this is listed here RH-70273 No access to new rui file
so I will add this thread

Yes just made a YT for this RH-73796 Editing a Duplicated button alters it’s ‘parent’

In short, the current system is not ready for prime time yet. Thanks for reporting @Holo and @EricM

1 Like

RH-73796 is fixed in the latest WIP

Hi guys, I put the toolbar stuff on the shelve together with testing V8, but now I needed to use some of my new tools and in fear of saving my changes I made a new toolbar to test things out with… here are my experience so far.

First of all this stuff needs to be centralized so we can add a toolbar rui, add a toolbar to it and add macros all in one place.

Creating

  • Make new toolbar rui file works OK, hard to find but OK enough.
  • Adding macros works better but should be a floating panel that doesn’t have to be closed for adding them to the toolbar.
  • Typing fullscreen rearranges the the GUI and hides floating toolbars, don’t use it.
    -Showing a now hidden toolbar suddenly adds it as a tab to the standard toolbar so you have to look for it. It should re appear where it was last.
  • Making an ellipse is buggy, it toggles on and off as I drag it to size and if I let go when it is toggled off then no ellipse is drawn.

IMO this needs to be addressed in good time before release so developers have the chance to update their plugins and for us advanced users (which is a lot) to be able to test V8 for you.

Saving
If I save the toolbar the toolbar after I created it and added a few buttons then it works fine.
BUT if I close Rhino and open it and add a new button and save and close and reopen then all the previous buttons are still lost… How can this still be an issue?
image
image

The buttons work but the svg’s are lost, so I can’t save my toolbars… I can only add stuff and hope that Rhino doesn’t mess it up. This means I can’t move them to other computers either.

@Gijs or @brian do you know when this will be addressed? Saving is top priority IMO.

Oh, and a rui is called a library some places but a toolbar other places. Making it a bit counter intuitive to use the commands macros, toolbar and libraries since the latter calls up render libraries.
Also if I add a toolbar to my rui in the Toolbars popup that the toolbars command calls up then it doesn’t refresh after the new toolbar is made, so I have to close it and open it again to see the changes.

And a last thing a toolbar gets it’s icon from the first macro that is added, it should not IMO.

1 Like

Hi @Holo thanks for your report.

RH-73631 Window Layouts fails to restore after Fullscreen

John has a lot on his plate, but it is on the list as RH-74605 RUI icons get deleted

RH-76210 Ellipse tool in Icon editor flickers

For a better icon creation experience, I’d recommend to try out the GH2 icon editor, which allows you use native Rhino drawing tools. To enable it, run G2 at least once and open up the panel GH Icon. In addition to lines you can also add symbols with command G2IconSymbol

I agree, I’ve asked John to put it high on his list.

RUI files are Libraries: a collection of Toolbars and Macros with related buttons. AFAIK they are now called libraries at all places:

yes, that one is on the list as RH-72463 Tools > Toolbar layout, adding a new toolbar to a library doesn’t refresh the toolbar list

You can change that in the third step when creating the toolbar…

… or after creation by right clicking on the toolbar’s icon > properties

Thanks for your reply Gijs!

Except where we make them: :slight_smile:

And yes I know I can change the icon, I just don’t think it should automatically inherit the icon from the first tool added.