AM, PDMS PML

AM PDMS EDGPACKET - EQUI MOVE

agape93 2021. 5. 20. 23:26

AM PDMS EDGPACKET - EQUI MOVE

 

-- form
	member .equipos is array
	member .moveitem is dbref
	
define method .pickmove()
	$p >>> Click From Position
	!this.equipos = array()
	!packet = object EDGPACKET()
	!packet.definePosition('Pick position ESC to Finish')
	!packet.key = 'POS3D'
	!packet.type = 'POS3D'
	!packet.description = 'Pick Positioning'
	!packet.priority = 1
	!packet.remove = false
	!packet.action = '!!equimove.setmove(!this.return[1])'
	!packet.action = '!!equimove.endmove()'
	!!edgcntrl.add(!packet)
	!!edgposcntrl.setpic(7)
	!!edgposcntrl.setpicktype(7)
endmethod

define method .setmove(!pickdata is edgpositiondata)
	!pickitem = !pickdata.item
	!pickpos = !pickdata.position
	!pickpos = !pickpos.wrt(world)
	!this.equipos.append(!pickpos)
	
	if !this.equipos.size().eq(1) then
		$p >>> Click To Position
		!this.moveitem = !pickitem
	elseif !this.equipos.size().eq(2) then
		$p >>> Press ESC
	else
		!this.equipos[2].delete()
		!this.equipos.compress()
		$p >>> Press ESC
	endif
	
	aid clear text all
	do !p index !this.equipos
		aid text '$!p' at $!this.equipos[$!p]
	enddo
endmethod

define .endmove()
	aid clear text all
	!tempsn = !this.equipos.size()
	if !tempsn.eq(2) then
		--
	else
		$p >>> reselect
		return
	endif
	
	if !this.moveitem.owner.type.neq('EQUI') then
		$p >>> reselect item
		return
	endif
	
	$!this.moveitem.owner
	!xmove = !this.equipos[2].east - !this.equipos[1].east
	!ymove = !this.equipos[2].north - !this.equipos[1].north
	!zmove = !this.equipos[2].up - !this.equipos[1].up
	
	!movedir = !this.equipos[1].direction(!this.equipos[2])
	by x $!xmove
	by y $!ymove
	by z $!zmove
	$p >>> x,y,z move end~~~
endmethod