[Closed] PickObject in a Scripted Plug-in mouse Tool Clause
I have a scripted Plug-in to create a manipulator (it can be a helper or an object) that I want to create with the mouse ‘mousePoint’ event at a position depending on an scene object (that I need to pick on creation).
For example, in the center of an existing object, or at the start of a spline, or…
How can I make the ‘pickObject’ command work in the ‘mousePoint’ event? Is there another way to do it?
What about
tool test numPoints:2
(
on mousePoint clickNo do
print (intersectRayScene (mapScreenToWorldRay mouse.pos)) #noMap
)
startTool test
maybe :
on mousePoint click do
(
objs = boxPickNode (box2 (viewPoint.x-1) (viewPoint.y-1) 3 3) crossing:on
)
When ‘Auto Window/Crossing by Direction’ is active, this always returns empty array for me.
maybe… but there is no ray-intersection with anything different than mesh-geometry
I like it better, too. There’s maxOps.setSelectionType to set the Auto window/crossing mode together with the direction, and you can get the current state with
getINISetting (getMAXIniFile()) #Performance #AutoCross
getINISetting (getMAXIniFile()) #Performance #AutoCrossDir
I only tested in max 9 and max 2018 with couple of boxes in scene, returns empty array in both no matter if I click on edge or anywhere else on any box. When turned off, it worked, no idea what else might differ.
Thanks a lot both! I didn’t thought/knew about that.
As I need to pick shapes, I have to go through ‘boxPickNode’
I’m under Max2014. It allways works except for “maxOps.setSelectionType true 0”, meaning ‘Auto Window/Crossing by Direction’ is active with selection right to left. With selection left to right (true 1) it works. And with ‘Auto Window/Crossing by Direction’ disabled too.
Thanks again!
i confirm. with “maxOps.setSelectionType true 0” it doesn’t work. It’s a bug, and it has to be reported
I’m retaking this plugin, now creating a SimpleObject based on a SplineShape.
New Question:
In the ‘mouse tool create’, is it possible to force the nodeTM (the node transform) to be always the identity even though the user clicks in a Front or Left view?
I have tried assigning the nodeTM and assigning the ‘(refs.dependentNodes this)[1].transform’ but can’t get it work.
Any advice?
Never mind…
I’ve made a prototype SimpleObject plugin for Horizontal Signing Lines geometry creation.
You can download the code from:
http://www.proin3d.org/pathscripts/DOWNLOAD/HSigning/H_Signing_V100.ms
numFaces = mesh.numFaces;
extrudeFace mesh #{1..numFaces} thickness 100.0 dir:[0,0,1];
numVerts = mesh.numVerts;
meshop.moveVert mesh #{1..numVerts} [0,0,-thickness]
in most mesh and poly methods you can use #all instead of #{1…numFaces} (#{1…numVerts})
(also you can use #selection where you need only selected sub objects)
Yes, thanks. I forgot it. It’s been a while I don’t code in maxscript and in fact this plugin is just a prototype to write it in C# (at least deep mesh calculations).