Help with snap markers - max 2019

Hey guys, how are you?
I had a script that was written by a friend of mine, but it´s not working properly in max 2019. In fact it works, but it doesn’t show the snap markers when clicking the points in the viewport (http://prntscr.com/n6lnm0). The script moves an object in Z angle, using two reference points (similar to Autocad’s move command). Does anyone knows how to solve this? Below is the code:

(
snapmode.active = true
posSource = undefined
posTarget = undefined
pickedPoint = undefined
tool pickOnePoint
(
on mousePoint click_no do
(
if click_no == 1 then
(
pickedPoint = worldPoint
)
)
)
pick_result = startTool pickOnePoint numPoints:1
if pick_result != undefined and pick_result != #abort and pick_result != #escape then
(
posSource = pickedPoint
pick_result = startTool pickOnePoint numPoints:1
if pick_result != undefined and pick_result != #abort and pick_result != #escape then
(
posTarget = pickedPoint
)
)
moveValue = [0, 0, (posTarget.z - posSource.z)]
for obj in selection where not isGroupMember obj or isOpenGroupMember obj do move obj moveValue
)

Thanks in advance,

Jsrocha

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jsrocha's picture

Thanks Miauu, works just

Thanks Miauu, works just fine!
Cheers,

Jsrocha

miauu's picture

.

(	
	local posSource = undefined
	local posTarget = undefined
 
	local curSnapMode = snapMode.active
	local curSnapType = snapMode.type
	snapMode.active = true
	snapMode.type = #3D
 
	posSource = pickPoint snap:#3d 
	if classof posSource == point3 do
		posTarget = pickPoint snap:#3d rubberBand:posSource 
 
	snapMode.active = curSnapMode
	try(snapMode.type = curSnapType)catch()	
	if classof posSource == point3 and classof posTarget == point3 do
	(	
		moveValue = [0, 0, (posTarget.z - posSource.z)]
		for obj in selection where not isGroupMember obj or isOpenGroupMember obj do move obj moveValue
	)
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.