
! script name: parasolids.d/convertgeom
! solids: convert a parasolids model into synergy geometry

!A
!A NAME:
!A
!A 	Convert All Edges/Faces
!A
!A DESCRIPTION:
!A
!A	Depending on its calling parameters this script will
!A	convert the model geometry in parasolids into separate
!a	synergy geometry.
!A
!B INSTRUCTIONS:
!B
!B	This script may convert all edges or all faces or both.
!B
!B	If faces are selected it will create a synergy surface group
!B	with the normal vectors oriented toward the exterior of the 
!B	solid model.
!B
!# see also - htdocs/help.d/parasolids.htm


stat=ChangeLabelStr("ScriptNameStatus","Function: convert all edges ")

DIM Destination$[256]
DIM Answer$[256]
DIM Name$[256]

ActivateUndo
IF ARGC<2 THEN
 Convert_type=WsPKConvertAll
ELSE
 Convert_type= VAL(ARGV(1))
 IF NOT((Convert_type=1) OR (Convert_type=2)) THEN Convert_type=WsPKConvertAll
END IF


Group= WPKConvertGeometry(Convert_type)
SELECT Convert_type
CASE 0
	Name$= "Parasolids Geometry"
CASE 1
	Name$= "Parasolids Edges"
CASE 2
	Name$= "Parasolids Faces"
	Stat= ChangeGroupType(Group,WsSurfaceGroup)
CASE ELSE
	Name$= "Parasolids Geometry"
END SELECT
Stat= ChangeGrpName(Group,Name$)
Stat= PlotEntity(Group)

ActivateUndo
Stat= AdvanceUndoNumber("convert parasolids")
Stat= AddGroupToUndo(WsUBCreateMode,Group,WsTrue,WsFalse)




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