
! script name: featureitems.d/planaritem
! topic: planaritem

!A
!A NAME:
!A
!A 	Planar Item
!A
!A DESCRIPTION:
!A
!A
!B INSTRUCTIONS:
!B
!B 	FIRST POINT ABS X,Y,Z: Enter the X,Y,Z coordinates for the first
!B 		point that will be used to determine the plane.
!B 		NOTE: See XYZ INPUT OPTIONS.
!B
!B 	SECOND POINT ABS X,Y,Z: Enter the X,Y,Z coordinates for the second
!B 		point that will be used to determine the plane.
!B
!B 	THIRD POINT ABS X,Y,Z: Enter the X,Y,Z coordinates for the third point
!B 		that will be used to determine the plane.
!B
!C NOTES:
!C
!C 	The three points picked must be unique.
!C
!C
!# see also - points.d/xyzinput.hlp

Stat=ChangeLabelStr("ScriptNameStatus","Function: planar item ")

DIM Answer$[1024],Destination$[1024]
DIM Class_dir$[1024],Filename$[1024]
DIM Name$[1024],Face_name$[1024]
DEG

DeActivateUndo
Plane_loop:!

Stat=SetInputFormat("a99","")
Stat=GetValue("DIRECTIONAL PLANE NAME",Face_name$)
IF ExitScript(Destination$) THEN Leave

Stat=SetInputFormat("n4","")

P1=XyzInput("FIRST POINT",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

P2=XyzInput("SECOND POINT",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

P3=XyzInput("THIRD POINT",WsXyzInput)
IF ExitScript(Destination$) THEN Leave

Plane1=ThreePointPlane(P1,P2,P3)

Stat=DeleteEntity(P1)
Stat=DeleteEntity(P2)
Stat=DeleteEntity(P3)

Class_dir$="/usr/weber/database/properties/PlaneProperty/"
Filename$="/usr/weber/database/properties/PlaneProperty/FacePlane"

Id_number=GetExtUserValue(Filename$,"Class id number:")
Stat=GetExtUserString(Filename$,"Name:",Name$)
P1= ReadUserData(Id_number,Name$,Filename$)
Prop_ent= ResolveDupUserProp(P1)
Stat=AssocUserData(Plane1,Prop_ent,Id_number)

Class_dir$="/usr/weber/database/properties/PlanarItems/"
Filename$="/usr/weber/database/properties/PlanarItems/Face"

Id_number= NextItemNumber
Prop_ent= ReadUserData(Id_number,Face_name$,Filename$)
Stat=AssocUserData(Plane1,Prop_ent,Id_number)

Leave:!
Stat=DeleteEntity(P1)
Stat=DeleteEntity(P2)
Stat=DeleteEntity(P3)
IF NOT LEN(Destination$) THEN
	LOAD "typecontrol"
ELSE
	LOAD Destination$
END IF
END
