Shortcut for renaming
All  1-20

Next
 From:  TOM (SIRTOM)
10510.1 
Hi,

Is there ascript to assign a shorcut to rename an object ?

Select object > Hotkey > Assign name

TOM
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10510.2 In reply to 10510.1 
Hi Tom, yes put in this on the shortcut key:

script: /* Edit object name */ var pp = moi.ui.propertiesPanel; if (pp.show && pp.numSelectedObjects > 0) { pp.editName(); }

Then when you press that key it should pop up the edit name dialog same as if you had clicked on the name line in the properties panel.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Iwan (OZX)
10510.3 In reply to 10510.2 
Hi Michael,
And for the name of a style, what is the script?

Iwan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10510.4 In reply to 10510.3 
Hi Iwan,

re:
> And for the name of a style, what is the script?

Do you mean for editing the name of an existing style or for adding a new one?

If it's for editing an existing one how would the script know which style you want to edit?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Iwan (OZX)
10510.5 In reply to 10510.4 
I have this one to add a new style :
script: /* Open Add new style dialog */ var gd = moi.geometryDatabase; gd.styleEditorOpened(); var dialog = moi.ui.createDialog( 'EditStyleDialog.htm?titleid=Add style dialog title&index=-1', '', moi.ui.mainWindow ); if ( dialog.window.doModal() != -1 ) { var styles = gd.getObjectStyles(); if ( styles.length > 0 ) moi.ui.propertiesPanel.editStyleIndex( styles.length - 1 ); } gd.styleEditorClosed();

I want to change the name of the style I already have or add a new one at the same time. Exactly like the script you just posted for object name.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10510.6 In reply to 10510.5 
Hi Iwan, do you mean you want to edit the style name for the style assigned to the current selected object, same as when you right click on the style line of the properties panel?

Try this:

script: /* Edit style of selected object */ var styleindex = moi.ui.propertiesPanel.styleIndex; var dialog = moi.ui.createDialog( 'EditStyleDialog.htm?index=' + styleindex ); dialog.window.doModal();


- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Iwan (OZX)
10510.7 In reply to 10510.6 
Hi Michael, it's perfect! Thank you very much.

Iwan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Iwan (OZX)
10510.8 In reply to 10510.7 
After a few tries:
The script edits the name and colour, but does not create a new style if I need it. So I don't need the same thing as right-clicking on the style line in the properties panel.

But... when I right-click on the object name to open the dialog, I can edit the name of the selected object, not the name of all objects that have that name. So I can create a new name.

So right clicking on the object name and right clicking on the style name do not have the same effect on editing or creating.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  TOM (SIRTOM)
10510.9 
Michael, thats great and thank you very much !!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10510.10 In reply to 10510.8 
Hi Iwan, sorry I'm not fully following what you're asking for. Do you mean you want a script with different behavior than that one I posted earlier?

If so you'll need to explain the behavior you want in more detail. Like how should the script determine if you want to make a new style instead of editing the name of an existing one?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Iwan (OZX)
10510.11 In reply to 10510.10 
With this script for the object names :
script: /* Edit object name */ var pp = moi.ui.propertiesPanel; if (pp.show && pp.numSelectedObjects > 0) { pp.editName(); }

If I select all objects with the same name: I change the name of all objects.
If I select an object (or a surface) : I give it a new name.

With the script for the object styles :
script: /* Edit style of selected object */ var styleindex = moi.ui.propertiesPanel.styleIndex; var dialog = moi.ui.createDialog( 'EditStyleDialog.htm?index=' + styleindex ); dialog.window.doModal();

If I select all the objects of the same style: I change the name of the style (and its colour).
If I select an object : I change the name of the style (and its colour).

I would like to have :

I select all the objects of the same style: I change the name of the style (and its colour).
I select an object (or a surface): I change the colour - or I create a new style if I change the name.

So a script for object styles with the same behavior as for object names.

Iwan

EDITED: 16 Nov 2021 by OZX

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10510.12 In reply to 10510.11 
Hi Iwan,

re:
> I select all the objects of the same style: I change the name of the style (and its colour).
> I select an object (or a surface): I change the colour - or I create a new style if I change the name.

What should happen if there is only one object assigned to a style? In that situation when the object is selected both of these cases will be true.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Iwan (OZX)
10510.13 In reply to 10510.12 
> What should happen if there is only one object assigned to a style? In that situation when the object is selected both of these cases will be true.

Yes. For the script on objects names, this is also the case.

Iwan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10510.14 In reply to 10510.13 
Hi Iwan, so it's a little more complex to set up a script for that behavior because it needs a customized dialog to do it. It's not just triggering the same behavior as a mouse click currently does like the other scripts.

But I'll see about setting it up for you.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Iwan (OZX)
10510.15 In reply to 10510.14 
Ok, I understand. Thank you very much.

Iwan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10510.16 In reply to 10510.15 
Hi Iwan, here's an attempt for an "edit or create" style shortcut.

Copy the attached file EditOrCreateStyleDialog.htm into the appdata commands folder.

On Windows you can find the Moi appdata folder by typing Win+R to bring up the Windows "Run" dialog and then type in:
%AppData%\Moi\commands

On Mac from a Finder window, go to the menu and pick Go > "Go to folder" and type in:
~/Library/Application Support/Moi/commands


Then set up a shortcut key for opening up the dialog and for the shortcut key put in:
script: /* Edit or create style */ var dlg = moi.ui.createDialog( 'moi://commands/EditOrCreateStyleDialog.htm' ); dlg.window.doModal();

- Michael

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Iwan (OZX)
10510.17 In reply to 10510.16 
Hi Michael,
Thank you very much, I will give it a try.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Iwan (OZX)
10510.18 In reply to 10510.17 
Hi Michael, it works very well. I have one last request.

1) I select an object, I run the command and I put it in a "red" style.
2) I select another object, I run the command and I also put it in a "red" style.
Is it possible to put the second one in the same "red" style as the previous one?
And to update the colour if it is modified?

This is the case for the manipulation of object names.
With this script :
script: /* Edit object name */ var pp = moi.ui.propertiesPanel; if (pp.show && pp.numSelectedObjects > 0) { pp.editName(); }

1) I select an object (or surface), run the script and name it "01".
2) I select another object, I run the script and name it "01" too.
I do not have in the name hierarchy twice the name "01", but my two objects "01" are in the same place.

Thanks very much,

Iwan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
10510.19 In reply to 10510.18 
Hi Iwan,

re:
> Is it possible to put the second one in the same "red" style as the previous one?
> And to update the colour if it is modified?

Please try with this updated version attached here.

- Michael

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Iwan (OZX)
10510.20 In reply to 10510.19 
Hi Michael,


It works very well. It's great. It will make my work much faster. I often have a lot of materials (styles) to assign to my 3D.

Thank you very much,

Iwan
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-20