home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.dds.no
/
ftp.dds.no.tar
/
ftp.dds.no
/
pub
/
Customers
/
sys-js.txt
/
TroxOrionSirius.js
< prev
next >
Wrap
Text File
|
2014-05-09
|
12KB
|
383 lines
function DdsScript.Draw()
{
var
dTwist = GdpVariable.Get(5),
HorizontalDir = GdpVariable.Get(6),
VerticalDir = GdpVariable.Get(7),
i_Medium = parseInt(GdpVariable.Get(8)),
i_mmDuctW = (GdpVariable.Get(9) * 1000),
i_mmDuctH = (GdpVariable.Get(10) * 1000),
i_mDuctW = GdpVariable.Get(9),
i_mDuctH = GdpVariable.Get(10),
i_mPlenumX = GdpVariable.Get(12),
i_mPlenumY = GdpVariable.Get(13),
i_mPlenumZ = GdpVariable.Get(14),
i_mTerminalX = .6,
i_mTerminalY = .6,
i_mTerminalZ = -.066,
d_mSleeveZ = GdpVariable.Get(15),
boFloodFill = GdpVariable.Get(18),
i_mmDuctW2 = 100,
i_ViewState = GdpVariable.Get(55),
a_Angle = GdpVariable.Get(25),
d_DL = GdpVariable.Get(11),
d_DZ = d_mSleeveZ,
boTopConnect = GdpVariable.Get(30),
boTerminalOnly = false,
boTerminalRect = true,
boPlenumRect = false,
boUseIP = true,
boLouvre = false,
a_Angle = GdpVariable.Get(25),
r_Angle = GdpVariable.Get(25) * (Math.PI / 180),
vartext = " ",
endVar;
if(i_ViewState<2)
i_ViewState = 2;
if(i_mPlenumX == 0)
boTerminalOnly = true;
if(i_mPlenumX > 0 && i_mPlenumY > 0)
boPlenumRect = true;
if(i_mTerminalY>0)
boTerminalRect = true;
if(boTerminalOnly && boTerminalRect)
boLouvre = true;
if(d_DZ<=0)
d_DZ=.0001;
// Set Flood Fill
boFloodFill === 0;
/*
for ( i = 0; i<99; ++i){
if(GdpVariable.Get(i) != 0)
vartext += "Var nr " + i + " = " + GdpVariable.Get(i) + "\n";
}
DdsMessage.Display(vartext , "");
*/
if(i_mmDuctW < 150){
i_mmDuctW2 = 200;
}
else if(i_mmDuctW < 190){
i_mmDuctW2 = 250;
}
else if(i_mmDuctW < 220){
i_mmDuctW2 = 315;
}
else{
i_mmDuctW2 = 400;
}
with(DdsDraw)
{
SolidBrushSet(boFloodFill);
TransfPush();
if(GdpVariable.Get(28)>0)
TranslateXYZ(GdpVariable.Get(11),0,-d_DZ*2);
RotateZ(r_Angle);
if(boTopConnect)
RotateY(-Math.PI*.5);
fTerminal(boLouvre, i_mTerminalX, i_mTerminalY, i_mTerminalZ, boTerminalRect, i_ViewState);
LineXYZ(0,0,0,0,0,-.0001); // To create a snap point in center of terminal
//Circle(i_mmDuctW*.0005);
RotateZ(-r_Angle);
if(!boTerminalOnly)
{
fConnect(d_DZ, i_ViewState, i_mDuctW, i_mmDuctW2);
TranslateXYZ(- d_DL + i_mPlenumX*.5, 0, d_DZ);
fPlenum(i_mPlenumX, i_mPlenumY, i_mPlenumZ, boPlenumRect, i_ViewState);
if(!boTopConnect)
{
TranslateXYZ(-i_mPlenumX*.5, 0, i_mPlenumZ*.5);
fIP(boUseIP, boPlenumRect, i_mPlenumX, i_Medium, i_mmDuctW, i_mmDuctH, boTopConnect, i_ViewState, a_Angle);
}
else // If top connect
{
TranslateXYZ(0, 0, i_mPlenumZ);
fIP(boUseIP, boPlenumRect, i_mPlenumX, i_Medium, i_mmDuctW, i_mmDuctH, boTopConnect, i_ViewState, a_Angle);
}
}
else // If terminal only
fIP(boUseIP, boPlenumRect, i_mPlenumX, i_Medium, i_mmDuctW, i_mmDuctH, boTopConnect, i_ViewState, a_Angle);
TransfPop();
//
if(boFloodFill && i_ViewState<3) // If flood fill, set Brush to false, and redraw with black pen. Don't want to redraw if 3D.
{
if(GdpVariable.Get(28)>0)
TranslateXYZ(GdpVariable.Get(11),0,-i_mPlenumZ*.5);
boUseIP = false; // Don't want double IP's
SolidBrushSet(false);
RotateZ(r_Angle)
Pen("Gdp.Bfc.2");
if(boTopConnect)
RotateY(-Math.PI*.5);
fTerminal(boLouvre, i_mTerminalX, i_mTerminalY, i_mTerminalZ, boTerminalRect, i_ViewState);
RotateZ(-r_Angle);
if(!boTerminalOnly)
{
fConnect(d_DZ, i_ViewState, i_mDuctW, i_mmDuctW2);
TranslateXYZ(- d_DL + i_mPlenumX*.5, 0, d_DZ);
fPlenum(i_mPlenumX, i_mPlenumY, i_mPlenumZ, boPlenumRect, i_ViewState);
if(!boTopConnect)
{
TranslateXYZ(-i_mPlenumX*.5, 0, i_mPlenumZ*.5);
fIP(boUseIP, boPlenumRect, i_mPlenumX, i_Medium, i_mmDuctW, i_mmDuctH, boTopConnect, i_ViewState, a_Angle);
}
else
{
TranslateXYZ(0, 0, i_mPlenumZ);
fIP(boUseIP, boPlenumRect, i_mPlenumX, i_Medium, i_mmDuctW, i_mmDuctH, boTopConnect, i_ViewState, a_Angle);
}
}
else
fIP(boUseIP, boPlenumRect, i_mPlenumX, i_Medium, i_mmDuctW, i_mmDuctH, boTopConnect, i_ViewState, a_Angle);
}
}
function fTerminal(boLouvre, i_mTerminalX, i_mTerminalY, i_mTerminalZ,boTerminalRect, i_ViewState)
{
with(DdsDraw)
{
TransfPush();
switch (i_ViewState)
{
case 1:
break;
case 2:
if(!boTerminalRect)
{
Circle(i_mTerminalX*.5);
Circle(i_mTerminalX*.45);
}
else
{
TranslateXYZ(-i_mTerminalX*.5, -i_mTerminalY*.5, 0);
RotateX(Math.PI*.5);
Rect(i_mTerminalX, .04);
RotateY(Math.PI*.5);
Rect(i_mTerminalY, .04);
RotateY(-Math.PI*.5);
RotateX(-Math.PI*.5);
Rect(i_mTerminalX, i_mTerminalY);
TranslateXYZ(i_mTerminalX*.08, i_mTerminalX*.08,0)
Rect(i_mTerminalX-i_mTerminalX*.16, i_mTerminalY-i_mTerminalX*.16);
}
break;
case 3:
Material("Ven.Duc.4000");
if(boTerminalRect)
{
var iNumPin = 8;
TranslateXYZ(-i_mTerminalX*.5, -i_mTerminalY*.5, 0);
Box(i_mTerminalX, i_mTerminalY, -i_mTerminalZ);
TranslateXYZ(i_mTerminalX*.5, i_mTerminalY*.5, 0);
var dConDim = i_mTerminalX*.05,
dWayOut = i_mTerminalX*.4,
iConX = parseInt((.5*dWayOut)/dConDim);
for(z=0;z<iConX;z++)
{
var
dConRound = 2*dWayOut*Math.PI,
iConRound = parseInt(.5*dConRound/dConDim),
dAngStep = 2*Math.PI/iConRound;
for(j=0;j<iConRound; j++)
{
TranslateXYZ(dWayOut, 0, 0);
ConeCutOnTop(dConDim, dConDim*.8, -.01, false, false);
TranslateXYZ(-dWayOut, 0, 0);
RotateZ(dAngStep);
}
dWayOut = dWayOut-2*dConDim;
}
}
break;
}
TransfPop();
}
}
function fConnect(d_DZ, i_ViewState, i_mDuctW, i_mmDuctW2)
{
with(DdsDraw)
{
switch (i_ViewState)
{
case 1:
break;
case 2:
TranslateXYZ(0,0,.066);
Cylinder(i_mmDuctW2*.0005, d_DZ-.066, false, false);
TranslateXYZ(0,0,-.066);
break;
case 3:
TranslateXYZ(0,0,.066);
Cylinder(i_mmDuctW2*.0005, d_DZ-.066, false, false);
TranslateXYZ(0,0,-.066);
break;
}
}
}
function fPlenum(i_mPlenumX, i_mPlenumY, i_mPlenumZ, boPlenumRect, i_ViewState)
{
with(DdsDraw)
{
TransfPush();
switch (i_ViewState)
{
case 1:
break;
case 2:
if(boPlenumRect)
{
TranslateXYZ(-.5*i_mPlenumX, -.5*i_mPlenumY, 0);
Rect(i_mPlenumX, i_mPlenumY);
RotateY(-Math.PI*.5);
Rect(i_mPlenumZ, i_mPlenumY);
RotateY(Math.PI*.5);
}
else// Plenum is round
Circle(i_mPlenumX*.5)
break;
case 3:
if(boPlenumRect)
{
TranslateXYZ(-.5*i_mPlenumX, -.5*i_mPlenumY,0);
Box(i_mPlenumX, i_mPlenumY, i_mPlenumZ);
}
else// Plenum is round
{
Cylinder(i_mPlenumX*.5, i_mPlenumZ, true, true);
}
break;
}
TransfPop();
}
}
function fIP(boUseIP, boPlenumRect, i_mPlenumX, i_Medium, i_mmDuctW, i_mmDuctH, boTopConnect, i_ViewState, a_Angle)
{
var
ipDirZ = 0,
ipDirX = 180;
if(boUseIP)
GdpCommand.Process("IP",i_Medium, i_mmDuctW+i_mmDuctH*.001, ipDirX,ipDirZ);
with(DdsDraw)
{
TransfPush();
switch(i_ViewState)
{
case 1:
break;
case 2:
if(boTopConnect && i_mPlenumX>0)
Circle(i_mmDuctW*.0005);
else if(boPlenumRect)
{
TranslateXYZ(0,-i_mmDuctW*.0005,0);
Rect(-i_mmDuctW*.0005, i_mmDuctW*.001);
}
else if(!boPlenumRect && i_mPlenumX>0)// Make a closed polygon with arc to fit the round plenum
{
var
d2dPointList = new DdsCurvedLine2d(),
aRad1 = Math.asin((i_mmDuctW*.0005)/(i_mPlenumX*.5)),
dTmp1 = Math.cos(aRad1)*i_mPlenumX*.5,
dTmp2 = i_mPlenumX*.5-dTmp1;
//
d2dPointList.AddLineTo(new DdsPoint2d(-dTmp2, 0));
d2dPointList.AddLineTo(new DdsPoint2d(-dTmp2, -i_mmDuctW*.001));
d2dPointList.AddLineTo(new DdsPoint2d(0, -i_mmDuctW*.001));
d2dPointList.AddArcRightTo(new DdsPoint2d(0,0), i_mPlenumX*.5);
TranslateXYZ(dTmp2,i_mmDuctW*.0005,0);
PolygonCurvedLine(d2dPointList);
}
break;
case 3:
if(boTopConnect && i_mPlenumX>0)
Cylinder(i_mmDuctW*.00051, i_mmDuctW*.0001, false, false);
else if(boPlenumRect)
{
RotateY(-Math.PI*.5);
Cylinder(i_mmDuctW*.00051, i_mmDuctW*.0005, false, false);
RotateY(Math.PI*.5);
}
else if(!boPlenumRect && i_mPlenumX>0)// Make a nice spigot out of round plenum
{
var
iHorSteps = 36,
arrayX = new Array(),
arrayY = new Array(),
arrayZ = new Array(),
aHorSteps = 2*Math.PI/iHorSteps,
aStepUp = 0,
aYZangle = 0,
dExtra = 0,
dOutDist = 0.02,
pointlist = new DdsPointList();
//
TranslateXYZ(-.02,0,0);
RotateY(Math.PI*.5);
for(i=0; i<iHorSteps+1; i++)
{
arrayX[i] = i_mmDuctW*.0005*Math.sin(aStepUp);
arrayY[i] = i_mmDuctW*.0005*Math.cos(aStepUp);
//
aYZangle = Math.asin((arrayY[i])/(i_mPlenumX*.5));
dExtra = i_mPlenumX*.5-(i_mPlenumX*.5*Math.cos(aYZangle));
//
arrayZ[i] = dOutDist+dExtra;
//
if(i!=0)
{
pointlist.AddXYZ(arrayX[i],arrayY[i],0);
pointlist.AddXYZ(arrayX[i],arrayY[i],arrayZ[i]);
pointlist.AddXYZ(arrayX[i-1],arrayY[i-1],arrayZ[i-1]);
pointlist.AddXYZ(arrayX[i-1],arrayY[i-1],0);
}
Polygon(pointlist);
aStepUp = aStepUp+aHorSteps;
pointlist = new DdsPointList();
}
RotateY(-Math.PI*.5);
}
break;
}
TransfPop();
}
}
function fLogo(i_mPlenumX, i_mPlenumY, i_mPlenumZ, i_Medium, boTopConnect)
{
with(DdsDraw)
{
SurfaceTypeSet(ONLY_IN_SURFACE_MODEL);
var
zMove = i_mPlenumZ*.3,
xMove = i_mPlenumX*.5;
if(boTopConnect)
{
xMove = 0;
zMove = i_mPlenumZ*.8;
}
Pen("7.1.3" + i_Medium);
if(i_mPlenumY>0)
{
TransfPush();
TranslateXYZ(xMove, -i_mPlenumY*.5, -zMove);
Scale(i_mPlenumX*.4);
RotateX(Math.PI*.5);
DrawFile("DDS-CAD.CFI");
TransfPop();
TransfPush();
TranslateXYZ(xMove,i_mPlenumY*.5, -zMove);
RotateX(Math.PI*.5);
RotateY(Math.PI);
Scale(i_mPlenumX*.4);
DrawFile("DDS-CAD.CFI");
TransfPop();
}
else
{
TransfPush();
TranslateXYZ(xMove,0,-zMove);
Scale(i_mPlenumX*.5);
DrawFile("dds-curv.cfi");
TransfPop();
}
}
}
}