hotkey to toggle Show pts

Next
 From:  co3Darts (CO3DPRINTS)
8119.1 
Looking through forums, I'm not able to find the script syntax to execute a toggle of the command "Show pts".

I wish to have a toggle on selected curve(s) or geometry that will toggle their points quickly.

"Show pts" when executed in the command line works but not in the hotkey editor and variations aren't work for me either.

y=script:moi.command.DoShowPoints();
y=script:moi.command.ShowPoints();
y=ShowPoints

Thanks in advance

Jason

Solved: y=ShowPoints

EDITED: 2 Oct 2016 by CO3DPRINTS

  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:  co3Darts (CO3DPRINTS)
8119.2 In reply to 8119.1 
In the same light. I can tell there is no core command in moi like ShowPoints for ShowSurfaces or ShowCurves. I use Maya most of the time and have mel scripts that toggle various geometry classes which I would like to have for curves and surfaces in Moi. Right now I have shortcut keys for this but it's not a toggle, it just turns them off

using this inline script
http://kyticka.webzdarma.cz/3d/moi/#HideCurves
http://kyticka.webzdarma.cz/3d/moi/#HideSurfaces

e.g. script:moi.geometryDatabase.getObjects().getCurves().setProperty( 'hidden', true );

How can I write a simple if else to turn hidden to false or true for the various geometry types so the script works as a toggle instead?

this script is else format
script:var dir = moi.view.lightDirection; if ( dir.x == 1 && dir.y == 1 && dir.z == -1 ) { dir.set(-0.5,1,0); } else { dir.set(1,1,-1); } moi.view.lightDirection = dir;

I'm trying to wrap my head around this to combine each. The 1st is a command with no var (variable) then I'm wondering if I can put the result of ('hidden', var(variable))

script:var dir = moi.geometryDatabase.getObjects().getCurves().setProperty ( 'hidden') ==! 1 then moi.geometryDatabase.getObjects().getCurves().setProperty ( 'hidden', false)

Something like above but I do not know how to get the correct syntax or test for if that is true or false and cast into the var variable?

This script is simple and just a if not check? Why is this not possible for geometry? I don't know javascript so I'm clueless

script:moi.view.showHiddenLines =! moi.view.showHiddenLines;

Thank you!

EDITED: 30 Mar 2019 by CO3DPRINTS

  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
8119.3 In reply to 8119.2 
Hi co3Darts,

re:
> This script is simple and just a if not check? Why is this not possible for geometry?
> I don't know javascript so I'm clueless
>
> script:moi.geometryDatabase.getObjects().getCurves().setProperty( 'hidden', true );

That script is set up to work on a list of objects which is what getCurves() returns. In order to do what you want you would need to access one individual curve out of the list so you can look at its hidden property.

Try this:

script: var crvs = moi.geometryDatabase.getObjects().getCurves(); if ( crvs.length > 0 ) crvs.setProperty( 'hidden', !crvs.item(0).hidden );

- 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:  co3Darts (CO3DPRINTS)
8119.4 
Thank you Michael! Much appreciated and for Geom it appears the .getBReps() grabs solids and surfaces?

script: var geom = moi.geometryDatabase.getObjects().getBReps(); if ( geom.length > 0 ) geom.setProperty( 'hidden', !geom.item(0).hidden );

I'm new but need to scripting for Moi3D but have used it off and on for several years. 3 years later it's working as I like :)

Jason
  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:  Michael Gibson
8119.5 In reply to 8119.4 
You're welcome Jason! And yep .getBReps() will indeed get solids and surfaces.

- 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
 

Reply to All Reply to All