
! script name: items.d/plotbyitem
! topic: show entities in a given item flag

!A
!A NAME:
!A
!A 	Show by Item
!A
!A DESCRIPTION:
!A
!A 	This script shows all elements associated with a given item flag.
!A 	This will allow you to display every element that has a specific
!A 	item flag attached to it.  You can verify that you have attached
!A 	the item flags properly and to the correct entities.
!A
!# see also - htdocs/help.d/items.htm
!# see also - htdocs/help.d/property.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: show by item ")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM A$[256]
DIM B$[256]
DIM File$[256]
DIM File2$[256]

Start:!
Group= GrpOfUserItems
IF NOT GroupCount(Group) THEN
	Stat= DeleteEntity(Group)
	GOTO Leave
END IF
Stat=UserSelectBox("EXISTING ITEMS","Item selected",0,WsPropGroupSelect,Group)

Pick_prop:!
Stat=SetInputFormat("a99","")
Stat=GetValue("INPUT ID NAME",Name$)
IF (ExitScript(Destination$)) THEN Leave
IF Name$= "CANCEL" THEN Leave

Num1= NumericPrefix(Name$)
IF NOT Num1 THEN Pick_prop
Prop_ent= GroupElement(Group,Num1)
IF NOT ValidGeometry(Prop_ent) THEN Start
Id_number= UserDataType(Prop_ent)
ClearAll
PRINT Id_number
Stat=PlotAssocEnt(Prop_ent,Id_number)
Stat= DeleteEntity(Group)

GOTO Start

Leave:!
Stat= DeleteEntity(Group)
Stat=SetInputFormat("n4","")
LowerSelectBox
IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END
