Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Change html on browser to modify toolbar

Alkis_KaraolisAlkis_Karaolis Member Posts: 9 PRO
Hi Onshape. I am new to the software and prefer all the commands to be visible in the toolbar, as opposed to some having a drop down list. I have a 4k screen so length of the bar is not an issue.

Since the toolbar is actually html, i made a chrome extension to change it (the html code) on the browser before rendering. To begin with, i tried to swap the word "Sketch" in the toolbar with the word "Drawing". 

The extension worked with every website other than Onshape. So every website that has the word Sketch renders into Drawing. If i manually edit the rendered html i can manipulate the toolbar and even assign icons on custom features.

My example script is bellow

var elements = document.getElementsByTagName('*');

for (var i = 0; i < elements.length; i++) {
var element = elements[i];

for (var j = 0; j < element.childNodes.length; j++) {
    var node = element.childNodes[j];

    if (node.nodeType === 3) {
        var text = node.nodeValue;
        var replacedText = text.replace(/[word or phrase to replace here]/gi, '[new word or phrase]');

        if (replacedText !== text) {
            element.replaceChild(document.createTextNode(replacedText), node);
        }
    }
}
}

I understand that this is post you might not want to answer but it would really make my modelling faster to have a customised toolbar.

So my question is, what do you do from your side that overrides chrome extensions?  Can i change the html code somehow?

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 2,402
    Hi @Alkis_Karaolis -welcome to Onshape!

    You can already customize your toolbar without trying to hack our code  :D  - right-click the toolbar and select "customize toolbar". Then drag an icon group into the dialog box which will then let you drag individual items to anywhere on the toolbar. Unfortunately, this does not work in drawings.

    You can also assign icons to custom features without hacking too (although it must be coded into the feature by the author).

    The reason you can't change the word "sketch" is because it is part of a localization string - it gets rendered on the fly depending upon which language you select.

    Neil Cooke, Director of Technical Marketing, Onshape Inc.
  • Alkis_KaraolisAlkis_Karaolis Member Posts: 9 PRO
    Hi Neil
    This is good, but i want all commands as separate icons. For example Thicken has an icon but Enclose is only available in the drop down menu from the arrow next to Thicken.
    Can i have Enclose as a separate icon without having to go into the drop down?

    Kind regards
    Alkis
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 2,402
    edited September 9
    Yes, follow the instructions above. Although I said "icon group" what I meant was icon drop-down.
    Neil Cooke, Director of Technical Marketing, Onshape Inc.
  • owen_sparksowen_sparks Member, Developers Posts: 2,387 PRO
    edited September 9

    Can i have Enclose as a separate icon without having to go into the drop down?
    Sure  :)
    If you right click on the menu and select customize you can then drag the stacked default off the menu, and then re-insert the individual icons where you wish:-

    Hope that helps,
    Owen S.
    Production Engineer
    HWM-Water Ltd
  • Alkis_KaraolisAlkis_Karaolis Member Posts: 9 PRO
    Thanks!!! i got this to work. I first had to remove the grouped icons (in drop downs) and then add them one by one. 
  • owen_sparksowen_sparks Member, Developers Posts: 2,387 PRO
    :+1:
    Owen S.
    Production Engineer
    HWM-Water Ltd
Sign In or Register to comment.