Share your Macros and Layouts


#1

probably some of you have created some nice macros already.
so maybe you would like to share them :slight_smile:

so let me start with a very very small one i created (just opened this thread to collect all those cool tools you created ;))

it works like the “pshift” plugin in lightwave … it extrudes a polygon selection with a value of 0 and switches back to selection mode.

cheers chris


#2

This script sets the pivot point to the last selected vertex. Just copy and paste it to a file. Make sure “#!perl” is the first line.

#!perl
my @verx = lxq(“query layerservice verts ? selected”);
my $idx = lxq(“query layerservice vert.index ? @verx[$#verx]”);
my @pos = lxq(“query layerservice vert.pos ? $idx”);
lx(“tool.set pivot.move on”);
lx(“tool.setAttr pivot.move posX $pos[0]”);
lx(“tool.setAttr pivot.move posY $pos[1]”);
lx(“tool.setAttr pivot.move posZ $pos[2]”);
lx(“tool.doApply”);
lx(“tool.set pivot.move off”);


#3

:applause:

Thanks!


#4

eric , can u tell me how to make this usefull script to work as a menu button plz?


#5
  • Put that script in a file called MovePivotToVertex.pl

  • Open the Form Editor from the System Menu

  • Find a form you want to put the button in; you’ll probably want to put it in the Main Menu, or one of the modo Tools sub-forms.

  • Right-click on (new control) and select Command from the menu

  • Enter this as the command definition, modified for where the file actually is on your machine. The @ symbol is used to run scripts:

    @C:\MovePivotToVertex.pl

You can click-pause-click on the new control’s row to give it a better label.

– Joe


#6

thanx eric for this script, actually it was one my requested scripts to c , i want to c that it’s ok, but need to have more function, like:
-if u select a vertex, the pivot will b this vertex
-if u select an edge, the pivot is the midle of the center of the edge
-if u select a polygon, the pivot is the center of the bouding box of this polygon
-if u apply it with no selection, the pivot is the center of the bounding box of the layer mesh


#7

Well, fine then:

http://www.tmproductions.com/LuxPublic/MovePivotToElement.zip

This one is a bit too big paste into the message body. Right click to save that to disk.

– Joe

EDIT: Fixed URL


#8

the link is not working
denied


#9

Stupid web server not letting you download .pl files from it…

I zipped it and fixed the link; try it now:

http://www.tmproductions.com/LuxPublic/MovePivotToElement.zip[/URL

– Joe


#10

Gentlemen,

I tried to post a reply to this thread a moment ago but the system locked up and I don’t know if it ever went thru.

Anyway, I cut and pasted the command into a .pl file and preceded the file name in the command with the @ symbol but when I ran the command I got a Run Script Implicit message box with the error message "Unknown Script ‘C:\Program…’

Any suggestions?

Brian


#11

Yeah, just put it in your main modo directory, and take off the absolute path just put in

@name of script


#12

oki, now the link is working, but once again, reporting:

-the edge mode is not working, if u select an edge and fire the pivot, it will not centre the pivot to it’s centre, the centre is going to the layer mesh bounding box.

suggestion :any possibility to make the pivot stick to the mesh, like if we define the 3rd corner of a rectangle as the pivot, and once we moved this vertex, the pivot is no more this vertex, now it’s in the original place, can we link the pivot translation to the new defined one, so always we can find it at the same defined place?


#13

Two possible reasons. First, the first line of the script MUST contain the line “#!perl”. No blank lines above it. Second, if the perl plugin has not loaded. Any plugin the extras directory should load automatially, but you can try it manually by hitting shift-P and adding it. it is called intrperl.lx.


#14

I’ve added a couple of new pie menus… they’re designed to keep you out of the viewport popup menu:

http://www.studio-orb.com/modo/viewport_shading.CFG
http://www.studio-orb.com/modo/viewport_wires.CFG

Add them by going into your Menus->File->Config Import-> (select the files, you can even select and imprt both at the same time!)

Then, in your Form Editor(F3), you’ll see two new forms at the bottom, and you can drag them into the Pie Menus category.

To assign them to keys, go to your Key Editor(F2), and pick Commands, then, in the pop-up menu, pick Popover Forms. You’ll see Pie Menus halfway down, expand it, then double click on the menu that you want to assign a key to.

(If you didn’t move the two menu configs into Pie Menus in the Forms Editor, shame on you, but they should still be listed at the bottom of the Popover Forms list in the Key Editor. I think that in modo configs, it’s a good habit to put things where they belong!)

I’ve added them to the Ctrl-` and the Ctrl-1 keys, respectively, and whew, they’re neato. No more three-level-deep picking of wireframe options…

enjoy!
-rob


#15

If there are spaces in the filename, wrap it in quotes or curly braces, like:

@"d:\Some Path\My Script.pl"

And the stuff Eric and Dion said.

– Joe


#16

i got a question on scripting toggle keys.( unless theres an easier way to do this. )

lets say that i want to make a single command that toggles wireframe on. and off.
the script would work something like

if wire “off”
then wire “on”

if wire “on”
then wire “off”

something like that. but i dont know any of the scripting languages to do this. so an example would rock how to make the if/then statements in either perl or xml, or whatever?


#17

lets say that i want to make a single command that toggles wireframe on. and off.
the script would work something like
Theres actually a script that comes with modo that does this. Its located in Modo\resrc\MSWireframeToggle.pl

Heres the script itself:

#perl
my $cages, $guides;
$wire = lxq(“viewport.3dView wireframe:?”);
if ($wire) {
$wire = 0;
}
else {
$wire = 2;
}
lx(“viewport.3dView wireframe:$wire”);


#18

Here are a couple of macros I find useful.

The first is for fixing symmetry. You select the half of your model that you don’t like and run the macro. The macro deletes the selected half and mirrors what’s left. Simple but quite useful. Of course if you have special vmaps on the selected half you don’t want to use this because it will kill them…
http://www.podagraph.com/scripts/modo/poda_mirrorHalf.lxm

The other is even simpler but I still use it often. It simply opens a Command History window.
http://www.podagraph.com/scripts/modo/poda_openHistoryWindow.lxm

You can run these by hitting F6 and selecting the file or you can assign it to a hotkey by opening the Key Editor (F2) and adding an @ followed by the script name including full path next to the Key of your choice. If you already ran a script once you can also just open the Command History Window and RMB on the script on the History tab. modo will present you with an option to Map To Key.

Hope someone finds these useful.


#19

Ok, I can figure out how to create a button but linking it to a file is not working. It looks like you use the c: for the PC, what do you use for the MAC?

command: @scriptName/MacintoshHD/ … / … ?

The mirror script looks very helpful!


#20

more like this:

@/Users/home/scriptName.pl