UserObjectPick
Function UserObjectPick:HANDLE; VAR X,Y:REAL; ObHd:HANDLE; BEGIN GetPt(X,Y); ObHd:=PickObject(X,Y); UserObjectPick:=ObHd; END;
What it does
Allows you to select object with the onscreen cursor. Returns a handle to the
selected object.
Function TwoClickAngle(p1x,p1y,p2x,p2y:REAL):REAL; VAR axisVector:VECTOR; BEGIN axisVector[1]:=p2x-p1x; axisVector[2]:=p2y-p1y; axisVector[3]:=0; TwoClickAngle:=Vec2Ang(axisVector); END;
What it does
Returns the angle of the vector between two user defined points.
Procedure InteractiveRotate(ObHd:HANDLE;XRot,YRot,ZRot:REAL); VAR xC,yC,zC,xR:REAL; KCod:INTEGER; BEGIN Get3DCntr(ObHd,xC,yC,zC); KCod:=0; WHILE KCod <> 32 DO BEGIN REPEAT UNTIL KeyDown(KCod); IF KCod = 52 THEN Set3DRot(ObHd,0,-yRot,0,xC,yC,zC) ELSE IF KCod = 54 THEN Set3DRot(ObHd,0,yRot,0,xC,yC,zC) ELSE IF KCod = 50 THEN Set3DRot(ObHd,-xRot,0,0,xC,yC,zC) ELSE IF KCod = 56 THEN Set3DRot(ObHd,xRot,0,0,xC,yC,zC) ELSE IF KCod = 55 THEN Set3DRot(ObHd,0,0,-zRot,xC,yC,zC) ELSE IF KCod = 51 THEN Set3DRot(ObHd,0,0,zRot,xC,yC,zC); Redraw; END; ReDraw; END;
What it does
Allows you to interactively rotate the selected object. You must supply handle to object and rotation
increments for X,Y, and Z rotation.
Subroutine Notes
1) If you want to pass angle values in DMS format, they must be preprocessed by ValidAngString
to convert them to DD format before they are inserted into the parameter list.
2) The default keys for the subroutine are:
'4' key= -y rotation
'6' key= y rotation
'2' key= -x rotation
'8' key= x rotation
'3' key= -z rotation
'7' key= z rotation
Procedure InteractiveMove(ObHd:HANDLE;X,Y,Z:REAL); VAR xC,yC,zC,xR:REAL; KCod:INTEGER; BEGIN Get3DCntr(ObHd,xC,yC,zC); KCod:=0; WHILE KCod <> 32 DO BEGIN REPEAT UNTIL KeyDown(KCod); IF KCod = 52 THEN Move3DObj(ObHd,X,0,0) ELSE IF KCod = 54 THEN Move3DObj(ObHd,-X,0,0) ELSE IF KCod = 50 THEN Move3DObj(ObHd,0,Y,0) ELSE IF KCod = 56 THEN Move3DObj(ObHd,0,-Y,0) ELSE IF KCod = 55 THEN Move3DObj(ObHd,0,0,Z) ELSE IF KCod = 51 THEN Move3DObj(ObHd,0,0,-Z) Redraw; END; ReDraw; END;
What it does
Allows you to interactively 3D movement the selected object. You must supply a handle to the object and
X,Y, and Z distances to move.
Subroutine Notes
1) The default keys for the subroutine are:
'4' key= -y movement
'6' key= y movement
'2' key= -x movement
'8' key= x movement
'3' key= -z movement
'7' key= z movement