
! script name: items.d/showparentitem
! topic: show parent item flag

!A
!A NAME:
!A
!A 	Show Parent Item Flag
!A
!A DESCRIPTION:
!A
!A 	This script shows the immediate parent and most senior parent
!A 	item flag associated with an entity.  This will allow you to
!A 	see the entity that the flagged geometry is part of.
!A
!B INSTRUCTIONS:
!B
!B 	PICK ENTITY: Pick the entity.  The script will show the immediate
!B 	and most senior parent of the entity.
!B
!# see also - htdocs/help.d/items.htm
!# see also - htdocs/help.d/property.htm

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

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
DIM Class$[256]
DIM A$[256]
DIM B$[256]

Start:!

Parent_color= 3
Item_color= 4


Pick_entity:!
Stat= SetInputFormat("n4","")
E1=PickEntity("PICK ENTITY")
IF ExitScript(Destination$) THEN Leave


Group1= ParentItemGroup(E1)
Group2= ItemGroup(E1)

Stat= PlotEntity(Group1,Parent_color)
Stat= PlotEntity(Group2,Item_color)
Stat= DeleteEntity(Group1)
Stat= DeleteEntity(Group2)


GOTO Start

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