
! script name: vdelete.d/unlinkdepndncy
! var_topic: Sample - unlink dependent variational records

!A
!A NAME:
!A
!A      UNLINK DEPENDENT VARIATIONAL RECORDS
!A
!A DESCRIPTION:
!A
!A 	This script will unlink dependent variational records.
!A
!B INSTRUCTIONS:
!B
!B	Unlinks record geometry and deletes the variational record.
!B
!B 	CAUTION: THIS IS A DANGEROUS FUNCTION. USE AT YOUR OWN RISK.
!B
!C NOTE:
!C
!C 	This is an unsupported sample script.
!C
!# see also - htdocs/help.d/vdminfo.htm

stat=ChangeLabelStr("ScriptNameStatus","Function: unlink dependent record")
DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]
Generation=1
Global_color=3
Local_color=4
Highlight_color=2
Dependency_color=3

DeActivateUndo
Pick_record:!
stat= SetInputFormat("n4","")
E1=PickEntity("PICK ENTITY")
IF (ExitScript(Destination$)) THEN Leave
IF (NOT ValidGeometry(E1)) THEN Pick_record

Stat= ReadEntityName(E1,Name$)
Stat= ShowDependency(Name$,Generation,Dependency_color)
Stat= PlotEntity(E1,Highlight_color)

stat= SetInputFormat("a1",",Y,N,")
Stat=GetValue("DO YOU WANT TO PROCEED ? Yes or No",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$= "N" THEN Pick_record

Stat= UnLinkDpndntRec(Name$,1,0)
Stat= RemoveDupUserProps

GOTO Pick_record

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