
! script name: lines.d/developcontours
! topic: construct line through two points

!A
!A NAME:
!A
!A 	Develop contours
!A
!A DESCRIPTION:
!A
!A	This funnction will develop or roll out the ruled surface 
!A	created by connecting two contours separated in z having equal elements.
!A
!A~ image location - images/developcontours.jpg
!B INSTRUCTIONS:
!B
!B	PICK FIRST CONTOUR: Pick the first contour.
!B
!B	PICK SECOND CONTOUR: Pick the second contour.
!B
!B      STEP DISTANCE: Approximation step distance.
!B
!B      PLACEMENT POINT: Location point of the developed curves.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: develop contours ")

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

Tol=NamedVarVal("3D Intersect Tol",Ws3DSystemVars,0.005)

ActivateUndo
stat= SetInputFormat("n4","")
Dist= 0.020
Tol= 0.0005



Pick_contours:!
Contour1=PickGroupEnt("PICK FIRST CONTOUR ")
IF (ExitScript(Destination$)) THEN Leave

Contour2=PickGroupEnt("PICK SECOND CONTOUR ")
IF (ExitScript(Destination$)) THEN Leave


stat= SetInputFormat("n4=","")
Stat= SetEqualsValue(Dist)
Dist=GetValue("STEP DISTANCE",Answer$)
IF (ExitScript(Destination$)) THEN Leave

Pick_point:Stat=SetInputFormat("n4","")
Pc=XyzInput("PLACEMENT POINT",WsXyzInput)
IF (ExitScript(Destination$)) THEN Leave
IF NOT ValidGeometry(Pc) THEN Pick_point

Group= DevelopContours(Pc,Contour1,Contour2,Dist,WsLeft)

Top_curve= GroupElement(Group,1)
Bot_curve= GroupElement(Group,2)

Rungs= GroupElement(Group,3)
Stat= NameEntity(Rungs,"rungs")
Stat= DeleteEntity(Group)
Stat= DeleteEntity(Pc)

Stat= AutoNumberCont(Top_curve)
Stat= AutoNumberCont(Bot_curve)

ActivateUndo
Stat= AdvanceUndoNumber("develop contours")
Stat= AddGroupToUndo(WsUBCreateMode,Top_curve,1,WsTrue)
Stat= AddGroupToUndo(WsUBCreateMode,Bot_curve,1,WsTrue)
Stat= AddGroupToUndo(WsUBCreateMode,Rungs,1,WsTrue)

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