
! script name: pksoliddraft.d/sectionviewdata
! solids: edit variables associated with section views

!A
!A NAME:
!A
!A 	Section Data
!A
!A DESCRIPTION:
!A
!A 	This script allows the variables associated with the section views
!A 	o be edited.
!A
!A
!A~ image location - images/hatchdata.gif
!A
!B INSTRUCTIONS:
!B
!B	HATCH PATTERN:
!B		Patterns 0-9 are single parallel lines spaced by the hatch
!B 		width. Line types vary from 0-9.
!B
!B		Patterns 10-19 are double lines, the second line is spaced
!B 		1/3 the hatch width from the first line.  The first line is
!B 		solid.  The line type, of the second line, varies from 0-9.
!B
!B		Patterns 20-29 are crosshatching patterns, two sets of lines
!B 		perpendicular to each other.  The line types vary from 0-9.
!B
!B
!C NOTES:
!C
!C	The following vatiables control the different options:
!C
!C
!C	Hidden line mode: 0    all lines are shown as solid.
!C			  1    hidden lines are not shown. 
!C			  2    hidden lines are drawn in the linetype and
!C			       color determined by the opengl settings.
!C
!C	Smooth edges mode: 0 Smooth on the solid model are included in the view.
!C			   1 Smooth edges are not included.
!C
!C
!C	Section hatch on: 0    section through solid is not hatched.
!C			  1    section through solid is hatched.
!C
!C	Label location: 1	Cutting plane labels are above the arrows.
!C			2	Labels are below the cutting plane line.
!C			3       Labels are to the right and left of the ends
!C				of the cutting plane line.
!C
!C	Section hatch pattern: Pattern # of section hatching.
!C
!C	Section hatch width: Parallel spacing of hatch lines.
!C
!C	Section hatch angle: Angle of hatch lines.
!C	
!C	Section hatch color: Color of hatch pattern.
!C
!C	Exterior line type: Line type assigned to section contours.
!C
!C	Cut plane line on: 0  Cutting plane line is not drawn
!C			   1  Cutting plane line with arrows is drawn.
!C
!C	Cut plane text scale: Text scale for cutting plane line.
!C
!C	Cut plane line type: Line type assigned to cutting plane line.
!C
!C	View orientation: 1  Section view oriented with cut plane line.
!C			  2  Section view is always placed horizontal.
!C			  3  Section view is always placed vertical.
!C

stat=ChangeLabelStr("ScriptNameStatus","Function: section view data ")

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

Units= CurrentUnits
IF Units= WsMetric THEN
        Hwidth= 6.25
ELSE
        Hwidth= 0.25
END IF
Make_section=1
Hatch_pattern= 1
Angle= 60
Hatch_pen= 19
Hidden_mode=2
Label_location=1
Smooth_edges= 1
Ext_ltype= 0
Text_scale= 3.0
Cut_plane_line_on= 1.0
Cut_plane_ltype= 8
View_orientation=1

Hidden_mode=NamedVarVal("Hidden line mode",WsPKSectionVars,Hidden_mode)
Smooth_edges=NamedVarVal("Smooth edges mode",WsPKSectionVars,Smooth_edges)
Label_location=NamedVarVal("Label location",WsPKSectionVars,Label_location)
Make_section=NamedVarVal("Section hatch on",WsPKSectionVars,Make_section)
Hatch_pattern=NamedVarVal("Section hatch pattern",WsPKSectionVars,Hatch_pattern)
Hwidth=NamedVarVal("Section hatch width",WsPKSectionVars,Hwidth)
Angle=NamedVarVal("Section hatch angle",WsPKSectionVars,Angle)
Hatch_pen=NamedVarVal("Section hatch color",WsPKSectionVars,Hatch_pen)
Ext_ltype=NamedVarVal("Exterior line type",WsPKSectionVars,Ext_ltype)
Text_scale=NamedVarVal("Cut plane text scale",WsPKSectionVars,Text_scale)
Cut_plane_line_on=NamedVarVal("Cut plane line on",WsPKSectionVars,Cut_plane_line_on)
Cut_plane_ltype=NamedVarVal("Cut plane line type",WsPKSectionVars,Cut_plane_ltype)
View_orientation=NamedVarVal("View orientation",WsPKSectionVars,View_orientation)

V1=CreateVariable("Hidden line mode",WsPKSectionVars,Hidden_mode)
V2=CreateVariable("Smooth edges mode",WsPKSectionVars,Smooth_edges)
V3=CreateVariable("Label location",WsPKSectionVars,Label_location)
V4=CreateVariable("Section hatch on",WsPKSectionVars,Make_section)
V5=CreateVariable("Section hatch pattern",WsPKSectionVars,Hatch_pattern)
V6=CreateVariable("Section hatch width",WsPKSectionVars,Hwidth)
V7=CreateVariable("Section hatch angle",WsPKSectionVars,Angle)
V8=CreateVariable("Section hatch color",WsPKSectionVars,Hatch_pen)
V9=CreateVariable("Exterior line type",WsPKSectionVars,Ext_ltype)
V10=CreateVariable("Cut plane line on",WsPKSectionVars,Cut_plane_line_on)
V11=CreateVariable("Cut plane text scale",WsPKSectionVars,Text_scale)
V12=CreateVariable("Cut plane line type",WsPKSectionVars,Cut_plane_ltype)
V13=CreateVariable("View orientation",WsPKSectionVars,View_orientation)


Start:!
Stat=UserSelectBox("SECTION VARIABLES","selected variable",WsPKSectionVars,WsVarSelect)
IF Stat=1 THEN Leave

Stat=SetInputFormat("a99","")
Stat=GetValue("NAME OF VARIABLE TO BE EDITED",Name$)
IF ExitScript(Destination$) THEN Leave
IF (Name$="CANCEL") THEN Leave

N=POS(Name$,"=")
IF (N>1) THEN
	Name$=Name$[1,N-1]
	Name$=TRIM$(Name$)
END IF

Edit_var=FindNamedVar(Name$,WsPKSectionVars)
IF (NOT ValidGeometry(Edit_var)) THEN Start

LowerSelectBox

SELECT NamedVarTyp(Edit_var)
CASE WsRealVar
	Stat=SetInputFormat("n4=","")
	A=GetVariableVal(Edit_var)
	Stat=SetEqualsValue(A)
	A=GetValue("INPUT "&Name$,Answer$)
	IF (ExitScript(Destination$)) THEN Leave
	Stat=PutVariableVal(Edit_var,A)

CASE WsStringVar
	Stat=SetInputFormat("a99=","")
	Stat=GetVariableStr(Edit_var,Answer$)
	Stat=SetEqualsValue(A,Answer$)
	A=GetValue("INPUT "&Name$,Answer$)
	IF (ExitScript(Destination$)) THEN Leave
	Stat=PutVariableStr(Edit_var,Answer$)

CASE WsGeometryVar
	E1=PickEntity("PICK GEOMETRY ELEMENT "&Name$)
	IF (ExitScript(Destination$)) THEN Leave
	Stat=PutVariablePtr(Edit_var,E1)

END SELECT

GOTO Start

Leave:!

LowerSelectBox

IF (NOT LEN(Destination$)) THEN
	 LOAD "pksoliddraft.d/sectionview"
ELSE
	 LOAD Destination$
END IF
END

