
! script name: rims.d/nonunfrmscale
! topic: different scale factors in XYZ

!A
!A NAME:
!A
!A 	Non Uniform - Duplicate
!A
!A DESCRIPTION:
!A
!A 	This script allows a group of elements to have a different scale
!A 	factor in X, Y, and Z.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT VIEW FOR SELECTION BOX: Pick
!B 		the view that elements are to be scaled in.
!B
!B 	X SCALE FACTOR: Enter the X scale factor.
!B
!B 	Y SCALE FACTOR: Enter the Y scale factor.
!B
!B 	Z SCALE FACTOR: Enter the Z scale factor.
!B
!B 	CENTER ABS X,Y,Z: Enter the X,Y,Z
!B 		coordinates of the point which is the center
!B 		of scaling.  NOTE: See XYZ INPUT OPTIONS.
!B
!C NOTES:
!C
!C 	Dimensions, Text, and Arrows cannot be non uniform scaled.  Circles,
!C 	Ellipses, Cubic splines are converted to NURBS for non uniform scaling.
!C 	Holes are scaled in XYZ position, however the diameter, depth, and
!C 	orientation are unchanged.  Cubic and Nurb Surfaces remain as Cubic
!C 	and Nurb Surfaces.  3D Solids are converted into Scaled Solid Entities
!C 	which are solids with non-uniform scaling parameters.
!C
!# see also - points.d/xyzinput.hlp

stat=ChangeLabelStr("ScriptNameStatus","Function: non uniform - duplicate ")



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

ActivateUndo
stat= SetInputFormat("n4","")
Active_workplane=0
Work=CurrentWorkplane
IF (ValidGeometry(Work)) THEN Active_workplane=1

StdWorkplane

Group=CreateGroup("TEMP")

Scale_copy=1 ! 1 will not delete original

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

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

stat= SetInputFormat("n4=","")
stat= SetEqualsValue(1.0)
Xscale= GetValue("X SCALE FACTOR",Answer$)
IF (ExitScript(Destination$)) THEN Leave

stat= SetEqualsValue(1.0)
Yscale= GetValue("Y SCALE FACTOR",Answer$)
IF (ExitScript(Destination$)) THEN Leave

stat= SetEqualsValue(1.0)
Zscale= GetValue("Z SCALE FACTOR",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Center= XyzInput("CENTER",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave

Scale_group:! 
G1=NonUnfrmScaleGrp(Group,center,Xscale,Yscale,Zscale)

ActivateUndo
Stat= AdvanceUndoNumber("scale")
Stat= AddGroupToUndo(WsUBCreateMode,G1,2,WsTrue)

IF (ValidGeometry(G1)) THEN
        Stat=Highlight(G1,WsHighlightPen,WsDirArrowOff)
END IF

Stat=DeleteEntity(G1)
Stat=DeleteEntity(Center)
IF Scale_copy THEN
        Stat=DeleteEntity(Group)
ELSE
	Stat= AddGroupToUndo(WsUBDeleteMode,Group,2,WsTrue)
        Stat=DeleteGroup(Group,1)
END IF

Leave:!
IF Active_workplane THEN
	Stat=SetWorkplane(Work)
ELSE
	StdWorkplane
END IF
stat= SetInputFormat("n4","")
Stat=DeleteEntity(Group)
Stat=DeleteEntity(G1)

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


