
! script name: holes.d/holesatpts
! topic: create hole at point locations

!A
!A NAME:
!A
!A 	Holes at Point Locations
!A
!A DESCRIPTION:
!A
!A 	This script creates a hole at point locations.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT VIEW FOR SELECTION BOX: Pick the view to be used
!B 		for point selection.
!B
!B 	PICK FIRST CORNER OF PICK ZONE: Pick a corner of the box.
!B
!B 	PICK SECOND CORNER OF PICK ZONE: Pick the other corner of
!B 		the view box.
!B
!B 	NOTE: All points within the view box will have a hole
!B 		constructed at them.
!B
!B 	HOLE DIAMETER: Enter the diameter of the hole to be constructed.
!B
!B 	FINISH DEPTH: Enter the depth of the hole to be constructed.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: holes at point locations ")

DIM Answer$[256]
DIM Destination$[256]
DEG

ActivateUndo
Group_loop:!
Group=CreateGroup("TEMPGROUP")

Vnum=PickView("SELECT VIEW FOR SELECTION BOX")
IF (ExitScript(Destination$)) THEN Leave

Stat=PickBox(Group,Vnum,12)
IF (ExitScript(Destination$)) THEN Leave


Pt_group=PtsInGroup(Group,WsPickPoints)
Stat=DeleteEntity(Group)

Stat=SetInputFormat("n4=","")
Diar=NamedVarVal("hole diameter",WsPointVars,0.0)
Stat=SetRadiusEquals(Diar/2)

Dia=InputRadius("HOLE DIAMETER",WsDiaInput)
IF (ExitScript(Destination$)) THEN Leave
Diar=Dia

Vdia=CreateVariable("hole diameter",WsPointVars,Diar)

Depthr=NamedVarVal("hole depth",WsPointVars,0.0)
Stat=SetDepthEquals(Depthr)

Depth=InputDepth("FINISH DEPTH")
IF (ExitScript(Destination$)) THEN Leave
Depthr=Depth

Vdepth=CreateVariable("hole depth",WsPointVars,Depthr)

Hole_group= HolesAtPtGrp(Pt_group,dia,depth)
Stat= DeleteGroup(Pt_group)

ActivateUndo
Stat= AdvanceUndoNumber("holes")
Stat= AddGroupToUndo(WsUBCreateMode,Hole_group,0,WsFalse)

Stat= DeleteEntity(Hole_group)

GOTO Group_loop

Leave:!
Stat= DeleteEntity(Hole_group)
Stat= DeleteEntity(Pt_group)

IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
