I am still not having success!! I have now stripped the scripts to the bare bones.
Here are the scripts:
Firstly the parameters are: h; lg; BrktDst; swan; d; old_diff - these are all length parameters. The last one is var, to ensure that GLOB_MODPAR_NAME works and is a text parameter.
Set the metric initial values as follows, for example: h=1600; lg=1200; BrktDst=50; swan=300; d=50; old_diff and var are calculated and would normally be hidden parameters.
The Master script is as follows:
r=d/2
v=22.5
ang=v/2
cosv=COS(v)
sinv=SIN(v)
tanv=TAN(v)
k=swan-(r+BrktDst)
!IF var="lg" THEN
!PARAMETERS old_diff=h-lg
!ENDIF
!IF var="h" THEN
!lg=h-old_diff
!ENDIF
The parameters script is as follows, along the lines described by archiben, earlier:
VALUES "var" GLOB_MODPAR_NAME
VALUES "lg" RANGE (0,h-k*tanv-2*d)
!! establish the difference between the two
old_diff=h-lg !! set difference regardless of "lg" changing or not!
IF var="lg" THEN
old_diff=h-lg
ENDIF
!! redefine "lg" if "h" changes as described before
IF var="h" THEN
lg=h-old_diff
PARAMETERS lg=lg
ENDIF
The 3D script is as follows:
unID=1
HOTSPOT 0,0,0,unID,h,1+256: unID=unID+1
HOTSPOT 0,0,-h,unID,h,3: unID=unID+1
HOTSPOT 0,0,h,unID,h,2+128: unID=unID+1
HOTSPOT 0,0,0,unID,lg,1+128: unID=unID+1
HOTSPOT 0,0,-lg,unID,lg,3: unID=unID+1
HOTSPOT 0,0,lg,unID,lg,2: unID=unID+1
LIN_ 0,0,lg,0,0,lg+0.06
LIN_ 0.004,0,lg+0.05,0,0,lg+0.06
LIN_ -0.004,0,lg+0.05,0,0,lg+0.06
ADDY -BrktDst
HOTSPOT 0,swan,0,unID,h,1+128: unID=unID+1
HOTSPOT 0,swan,-h,unID,h,3: unID=unID+1
HOTSPOT 0,swan,h,unID,h,2: unID=unID+1
LIN_ 0,swan,h,0,swan,h+0.015
LIN_ 0.003,swan,h+0.01,0,swan,h+0.015
LIN_ -0.003,swan,h+0.01,0,swan,h+0.015
DEL 1
IF swan>0 THEN
ADDY -BrktDst-r
FOR ct=1 to 2
HOTSPOT r,0,h,unID,swan,1+128: unID=unID+1
HOTSPOT r,-swan,h,unID,swan,3: unID=unID+1
HOTSPOT r,swan,h,unID,swan,2: unID=unID+1
MUL -1,1,1
NEXT ct
DEL 3
ENDIF
rotz 90
cone lg,r,r,90,90+v+ang
add k,0,lg+(k*tanv)
cone h-(lg+k*tanv),r,r,90+v+ang,90
del 2
addz lg
rotx -(v+45)
rotz 90
cone k/cosv,r,r,90-(v+ang),90-(v+ang)
del 3
END
I think that you will find that the relationship that I require is not maintained i.e when h changes lg follows at the same distance, but when lg changes h remains the same.
If you convert the emboldened script steps in the Parameters script to comments; and un-comment the emboldened steps in the Master script, you will find that the script works - but ONLY when you change h for the SECOND (or successive) time(s), without having changed lg!!
Can anyone spot where this is going wrong? It's driving me nuts!!