#!/usr/bin/perl #line 16 #### #### All Code by Steve Michel #### # $amp = amplitude; # $freq = frequency; # $phase = phase; # $offset = offset; # $range = linear range; # $step = step; # $thing = $range/2 ; # $num # $total # creates multiple dxf files $UPI = 1016; $VSspeed = 2; $rad= 3.1415926535/180; $circum = 3.1415926535 *2; $range = 6; # total length $step = .25; # gap between ribs $step2 = .05; # "resolution" of SIN wav $NuStep = 1/$step; $thing = int($range/2); # creates off-set so that center of range = zero $num = 1; $total = ($range/$step)+1; #total number of ribs $dxfStep = 0; $amp = 3; # factor for highs and lows of SIN wave $freq = 3; #factor for number of waves #$phase = 180; # starting angle - 180 worked $phase = 0; # starting angle #$RibThick = 3; #3 worked Test4 $RibThick = 4; $XYTotal = ($range/$step2)+1; $ThingUSE = $thing*10000; $OffsetYfact = 1.75; $R2factor = $OffsetYfact * 2 * $UPI; print $total . " " . $ThingUSE . " " . $XYTotal; print ("\n"); ############ # # # Be sure to edit destination path # # ############# make WAVE files #create files $num = 1; for ($i = 1; $i <= $total; $i++){ if ($num <=999){$fill = "0" ;} if ($num <=99){$fill = "00" ;} if ($num <=9){$fill = "000" ;} open (FILE2, ">D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_WAVE." . $fill . $num . ".plt"); close FILE2; $num++; } #create file headers $num = 1; for ($i=1;$i<= $total;$i++) { #num = dxf file number; # create a dxf file for each step; if ($num <=999){$fill = "0" ;} if ($num <=99){$fill = "00" ;} if ($num <=9){$fill = "000" ;} # open (FILE2, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_WAVE." . $fill . $num . ".plt"); print FILE2 ("IN;" . "\n"); print FILE2 ("VS" . $VSspeed . ";" . "\n"); print FILE2 ("SP1;" . "\n"); print FILE2 ("PU0,0;" . "\n"); close FILE2; $num++; } #create 3D coordinates # $x # $y # $z $NewXfactor = $range * .5; $Margin = .25; $MargX = $NewXfactor + $Margin; $xStart = $NewXfactor*-1; $yStart = -1; $xHome = $NewXfactor*-1; $yHome = -1; $xDest = $NewXfactor; $yDest = -1; #$xHIStart = -3; #$yHIStart = 1; #$xHIHome = -3; #$yHIHome = 1; #$xHIDest = 3; #$yHIDest = 1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $xHIHome = $NewXfactor*-1; $yHIHome = $yHome + $OffsetYfact; $xHIDest = $NewXfactor; $yHIDest = $yDest + $OffsetYfact; $dxfStep = 0; for ($Rib = 1; $Rib <= $total ; $Rib++){ $xStart = $NewXfactor*-1; $yStart = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $position1 = $Rib - 1; $position2 = $position1 * $step * 10000; $position4 = $position2 - $ThingUSE; $position5 = ($position4/10000); $PositionUSE = $position5; $PosZ = $PositionUSE; if ($Rib <=999){$fill = "0" ;} if ($Rib <=99){$fill = "00" ;} if ($Rib <=9){$fill = "000" ;} open (FILE2, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_WAVE." . $fill . $Rib . ".plt"); $xUSEplt = ($xStart+$MargX )* $UPI; $yUSEplt = ($yStart+1.25)* $UPI; print FILE2 ("PU" . $xUSEplt . "," . $yUSEplt . ";\n"); print FILE2 ("PD" . $xUSEplt . "," . $yUSEplt . ";\n"); print $Rib . " "; # print $position1 . " "; # print $position2 . " "; # print $position3 . " "; # print $position4 . " "; print $PositionUSE; print ("\n"); for ($XY =1 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; # print "XY= " . $XYpositionUSE; # print " XY= " . $XYposition4; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $xUSEpltDEST = int(($XYpositionUSE+$MargX )* $UPI); $yUSEpltDEST = int(($FactorY+1.25)* $UPI); print FILE2 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); # if XYpositionUSE = factor of .2 then vert cut line $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } # 1 print FILE2 ("PD" . (($xStart+$MargX )*$UPI) . "," . (($yDest+1.25)*$UPI) . ";" . "\n"); # 2 print FILE2 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); # 3 print FILE2 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); # 4 print FILE2 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); # 5 print FILE2 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); print FILE2 ("PD" . (($xStart+$MargX )*$UPI) . "," . (($yDest+1.25)*$UPI) . ";" . "\n"); print FILE2 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); print FILE2 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); print FILE2 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); print FILE2 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); #round 2 ########################################### $XY =1; $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $FactorY = $FactorY + $OffsetYfact; $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); print FILE2 ("PU" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); ###############################################3 for ($XY =2 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $FactorY = $FactorY + $OffsetYfact; $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); print FILE2 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } print FILE2 ("PD" . (($xStart+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); print FILE2 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); print FILE2 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); print FILE2 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); print FILE2 ("PU;PU;SP0;" . "\n"); close FILE2; } ############# make CUTS files #create files $num = 1; for ($i = 1; $i <= $total; $i++){ if ($num <=999){$fill = "0" ;} if ($num <=99){$fill = "00" ;} if ($num <=9){$fill = "000" ;} open (FILE3, ">D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_CUTS." . $fill . $num . ".plt"); close FILE3; $num++; } #create file headers $num = 1; for ($i=1;$i<= $total;$i++) { #num = dxf file number; # create a dxf file for each step; if ($num <=999){$fill = "0" ;} if ($num <=99){$fill = "00" ;} if ($num <=9){$fill = "000" ;} # open (FILE3, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_CUTS." . $fill . $num . ".plt"); print FILE3 ("IN;" . "\n"); print FILE3 ("VS" . $VSspeed . ";" . "\n"); print FILE3 ("SP1;" . "\n"); print FILE3 ("PU0,0;" . "\n"); close FILE3; $num++; } #create 3D coordinates # $x # $y # $z $xStart = $NewXfactor*-1; $yStart = -1; $xHome = $NewXfactor*-1; $yHome = -1; $xDest = $NewXfactor; $yDest = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $xHIHome = $NewXfactor*-1; $yHIHome = $yHome + $OffsetYfact; $xHIDest = $NewXfactor; $yHIDest = $yDest + $OffsetYfact; $dxfStep = 0; #for ($Rib = 1; $Rib <= $total ; $Rib++){ for ($Rib = 1; $Rib <= ($total) ; $Rib++){ $xStart = $NewXfactor*-1; $yStart = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $position1 = $Rib - 1; $position2 = $position1 * $step * 10000; $position4 = $position2 - $ThingUSE; $position5 = ($position4/10000); $PositionUSE = $position5; $PosZ = $PositionUSE; if ($Rib <=999){$fill = "0" ;} if ($Rib <=99){$fill = "00" ;} if ($Rib <=9){$fill = "000" ;} open (FILE3, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_CUTS." . $fill . $Rib . ".plt"); $xUSEplt = ($xStart+$MargX )*$UPI; $yUSEplt = ($yStart+1.25)*$UPI; # print FILE3 ("PU" . $xUSEplt . "," . $yUSEplt . ";\n"); # print FILE3 ("PD" . $xUSEplt . "," . $yUSEplt . ";\n"); print $Rib . " "; # print $position1 . " "; # print $position2 . " "; # print $position3 . " "; # print $position4 . " "; print $PositionUSE; print ("\n"); for ($XY =2 ; $XY <= ($XYTotal-1) ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; # print "XY= " . $XYpositionUSE; # print " XY= " . $XYposition4; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); # print FILE3 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); # if XYpositionUSE = factor of $step then vert cut line $Logic = ($XYpositionUSE*$step); $Test = int($XYpositionUSE*$step); print " Log=" . $Logic . " Test=" . $Test; if ($XYpositionUSE*$NuStep==int($XYpositionUSE*$NuStep)) { # $Ycut = int((($FactorY+1.25)+($yHome+1.25))/2)*$UPI; $Ycut = (int($yUSEpltDEST + 252)/2); $Ycut=int($Ycut); $Ycut2 = $Ycut + ($OffsetYfact*$UPI); print " XY= " . $XYpositionUSE; print FILE3 ("PU" . ($xUSEpltDEST-$RibThick) . "," . $Ycut . ";" . "\n"); print FILE3 ("PD" . ($xUSEpltDEST-$RibThick) . "," . $Ycut . ";" . "\n"); print FILE3 ("PD" . ($xUSEpltDEST-$RibThick) . "," . $Ycut2 . ";" . "\n"); print FILE3 ("PD" . ($xUSEpltDEST+$RibThick) . "," . $Ycut2 . ";" . "\n"); print FILE3 ("PD" . ($xUSEpltDEST+$RibThick) . "," . $Ycut . ";" . "\n"); print FILE3 ("PU" . ($xUSEpltDEST+$RibThick) . "," . $Ycut . ";" . "\n"); } $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } print FILE3 ("PU;PU;SP0;" . "\n"); close FILE3; } ############# make COMBO files #create files ############# make CUTS files #create files $num = 1; for ($i = 1; $i <= $total; $i++){ if ($num <=999){$fill = "0" ;} if ($num <=99){$fill = "00" ;} if ($num <=9){$fill = "000" ;} open (FILE4, ">D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_Combo." . $fill . $num . ".plt"); close FILE4; $num++; } #create file headers $num = 1; for ($i=1;$i<= $total;$i++) { #num = dxf file number; # create a dxf file for each step; if ($num <=999){$fill = "0" ;} if ($num <=99){$fill = "00" ;} if ($num <=9){$fill = "000" ;} # open (FILE4, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_Combo." . $fill . $num . ".plt"); print FILE4 ("IN;" . "\n"); print FILE4 ("VS" . $VSspeed . ";" . "\n"); print FILE4 ("SP1;" . "\n"); print FILE4 ("PU0,0;" . "\n"); close FILE4; $num++; } #create 3D coordinates # $x # $y # $z $xStart = $NewXfactor*-1; $yStart = -1; $xHome = $NewXfactor*-1; $yHome = -1; $xDest = $NewXfactor; $yDest = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $xHIHome = $NewXfactor*-1; $yHIHome = $yHome + $OffsetYfact; $xHIDest = $NewXfactor; $yHIDest = $yDest + $OffsetYfact; $dxfStep = 0; for ($Rib = 1; $Rib <= $total ; $Rib++){ $xStart = $NewXfactor*-1; $yStart = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $position1 = $Rib - 1; $position2 = $position1 * $step * 10000; $position4 = $position2 - $ThingUSE; $position5 = ($position4/10000); $PositionUSE = $position5; $PosZ = $PositionUSE; if ($Rib <=999){$fill = "0" ;} if ($Rib <=99){$fill = "00" ;} if ($Rib <=9){$fill = "000" ;} open (FILE4, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_Combo." . $fill . $Rib . ".plt"); $xUSEplt = ($xStart+$MargX )*$UPI; $yUSEplt = ($yStart+1.25)*$UPI; # print FILE4 ("PU" . $xUSEplt . "," . $yUSEplt . ";\n"); # print FILE4 ("PD" . $xUSEplt . "," . $yUSEplt . ";\n"); print $Rib . " "; # print $position1 . " "; # print $position2 . " "; # print $position3 . " "; # print $position4 . " "; print $PositionUSE; print ("\n"); for ($XY =2 ; $XY <= ($XYTotal-1) ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; # print "XY= " . $XYpositionUSE; # print " XY= " . $XYposition4; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); # print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); # if XYpositionUSE = factor of $step then vert cut line $Logic = ($XYpositionUSE*$step); $Test = int($XYpositionUSE*$step); print " Log=" . $Logic . " Test=" . $Test; if ($XYpositionUSE*$NuStep==int($XYpositionUSE*$NuStep)) { # $Ycut = int((($FactorY+1.25)+($yHome+1.25))/2)*$UPI; $Ycut = (int($yUSEpltDEST + 252)/2); $Ycut=int($Ycut); $Ycut2 = $Ycut + ($OffsetYfact*$UPI); print " XY= " . $XYpositionUSE; print FILE4 ("PU" . ($xUSEpltDEST-$RibThick) . "," . $Ycut . ";" . "\n"); print FILE4 ("PD" . ($xUSEpltDEST-$RibThick) . "," . $Ycut . ";" . "\n"); print FILE4 ("PD" . ($xUSEpltDEST-$RibThick) . "," . $Ycut2 . ";" . "\n"); print FILE4 ("PD" . ($xUSEpltDEST+$RibThick) . "," . $Ycut2 . ";" . "\n"); print FILE4 ("PD" . ($xUSEpltDEST+$RibThick) . "," . $Ycut . ";" . "\n"); print FILE4 ("PU" . ($xUSEpltDEST+$RibThick) . "," . $Ycut . ";" . "\n"); } $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } for ($XY =1 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $FactorY = $FactorY + $OffsetYfact; $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); # print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); # if XYpositionUSE = factor of .2 then vert cut line $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; if ($XYpositionUSE*10==int($XYpositionUSE*10)) { # $Ycut = int((($FactorY+1.25)+($yHome+1.25))/2)*$UPI; # $yHIDest = 1; $yHiTemp = ($yHIDest + 1.25)*$UPI; $Ycut = (int($yUSEpltDEST + $yHiTemp)/2); $Ycut=int($Ycut); $Ycut2 = 250; print " XY= " . $XYpositionUSE; # print FILE4 ("PD" . $xUSEpltDEST . "," . $Ycut . ";" . "\n"); # print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";" . "\n"); } $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } close FILE4; } ############# make WAVE files #create files $num = 1; #create 3D coordinates # $x # $y # $z $xStart = $NewXfactor*-1; $yStart = -1; $xHome = $NewXfactor*-1; $yHome = -1; $xDest = $NewXfactor; $yDest = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $xHIHome = $NewXfactor*-1; $yHIHome = $yHome + $OffsetYfact; $xHIDest = $NewXfactor; $yHIDest = $yDest + $OffsetYfact; $dxfStep = 0; for ($Rib = 1; $Rib <= $total ; $Rib++){ $xStart = $NewXfactor*-1; $yStart = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $position1 = $Rib - 1; $position2 = $position1 * $step * 10000; $position4 = $position2 - $ThingUSE; $position5 = ($position4/10000); $PositionUSE = $position5; $PosZ = $PositionUSE; if ($Rib <=999){$fill = "0" ;} if ($Rib <=99){$fill = "00" ;} if ($Rib <=9){$fill = "000" ;} open (FILE4, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_Combo." . $fill . $Rib . ".plt"); $xUSEplt = ($xStart+$MargX )* $UPI; $yUSEplt = ($yStart+1.25)* $UPI; print FILE4 ("PU" . $xUSEplt . "," . $yUSEplt . ";\n"); print FILE4 ("PD" . $xUSEplt . "," . $yUSEplt . ";\n"); print $Rib . " "; # print $position1 . " "; # print $position2 . " "; # print $position3 . " "; # print $position4 . " "; print $PositionUSE; print ("\n"); for ($XY =1 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; # print "XY= " . $XYpositionUSE; # print " XY= " . $XYposition4; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $xUSEpltDEST = int(($XYpositionUSE+$MargX )* $UPI); $yUSEpltDEST = int(($FactorY+1.25)* $UPI); print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); # if XYpositionUSE = factor of .2 then vert cut line $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } # print FILE4 ("PD" . (($xStart+$MargX )*$UPI) . "," . (($yDest+1.25)*$UPI) . ";" . "\n"); # print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); # print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); # print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); # print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); print FILE4 ("PD" . (($xStart+$MargX )*$UPI) . "," . (($yDest+1.25)*$UPI) . ";" . "\n"); print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); #round 2 for ($XY =1 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $FactorY = $FactorY + $OffsetYfact; $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); #print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } print FILE4 ("PU" . (($xStart+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); print FILE4 ("PD" . (($xStart+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); for ($XY =1 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $FactorY = $FactorY + $OffsetYfact; $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } print FILE4 ("PD" . (($xStart+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); print FILE4 ("PU" . (($xStart+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PU;PU;SP0;" . "\n"); close FILE4; } ##################################### ##################################### ########################################################################## ##################################### ########################################################################## ##################################### ########################################################################## ##################################### ########################################################################## ##################################### ##################################### ############# make COMBO files #create files ############# make CUTS files #create files $num = 1; for ($i = 1; $i <= $total; $i++){ if ($num <=999){$fill = "0" ;} if ($num <=99){$fill = "00" ;} if ($num <=9){$fill = "000" ;} open (FILE4, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_Combo." . $fill . $num . ".plt"); close FILE4; $num++; } #create file headers $num = 1; for ($i=1;$i<= $total;$i++) { #num = dxf file number; # create a dxf file for each step; if ($num <=999){$fill = "0" ;} if ($num <=99){$fill = "00" ;} if ($num <=9){$fill = "000" ;} # # open (FILE4, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_Combo." . $fill . $num . ".plt"); # print FILE4 ("IN;" . "\n"); # print FILE4 ("VS5;" . "\n"); # print FILE4 ("SP1;" . "\n"); # print FILE4 ("PU0,0;" . "\n"); # close FILE4; $num++; } #create 3D coordinates # $x # $y # $z $xStart = $NewXfactor*-1; $yStart = -1; $xHome = $NewXfactor*-1; $yHome = -1; $xDest = $NewXfactor; $yDest = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $xHIHome = $NewXfactor*-1; $yHIHome = $yHome + $OffsetYfact; $xHIDest = $NewXfactor; $yHIDest = $yDest + $OffsetYfact; $dxfStep = 0; for ($Rib = 1; $Rib <= $total ; $Rib++){ $xStart = $NewXfactor*-1; $yStart = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $position1 = $Rib - 1; $position2 = $position1 * $step * 10000; $position4 = $position2 - $ThingUSE; $position5 = ($position4/10000); $PositionUSE = $position5; $PosZ = $PositionUSE; if ($Rib <=999){$fill = "0" ;} if ($Rib <=99){$fill = "00" ;} if ($Rib <=9){$fill = "000" ;} open (FILE4, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_Combo." . $fill . $Rib . ".plt"); $xUSEplt = ($xStart+$MargX )*$UPI; $yUSEplt = ($yStart+1.25)*$UPI; # print FILE4 ("PU" . $xUSEplt . "," . $yUSEplt . ";\n"); # print FILE4 ("PD" . $xUSEplt . "," . $yUSEplt . ";\n"); print $Rib . " "; # print $position1 . " "; # print $position2 . " "; # print $position3 . " "; # print $position4 . " "; print $PositionUSE; print ("\n"); for ($XY =2 ; $XY <= ($XYTotal-1) ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; # print "XY= " . $XYpositionUSE; # print " XY= " . $XYposition4; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); # print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); # if XYpositionUSE = factor of $step then vert cut line $Logic = ($XYpositionUSE*$step); $Test = int($XYpositionUSE*$step); print " Log=" . $Logic . " Test=" . $Test; if ($XYpositionUSE*$NuStep==int($XYpositionUSE*$NuStep)) { # $Ycut = int((($FactorY+1.25)+($yHome+1.25))/2)*$UPI; $Ycut = (int($yUSEpltDEST + 252)/2); $Ycut=int($Ycut+$R2factor); $Ycut2 = $Ycut + ($OffsetYfact*$UPI); print " XY= " . $XYpositionUSE; print FILE4 ("PU" . ($xUSEpltDEST-$RibThick) . "," . $Ycut . ";" . "\n"); print FILE4 ("PD" . ($xUSEpltDEST-$RibThick) . "," . $Ycut . ";" . "\n"); print FILE4 ("PD" . ($xUSEpltDEST-$RibThick) . "," . $Ycut2 . ";" . "\n"); print FILE4 ("PD" . ($xUSEpltDEST+$RibThick) . "," . $Ycut2 . ";" . "\n"); print FILE4 ("PD" . ($xUSEpltDEST+$RibThick) . "," . $Ycut . ";" . "\n"); print FILE4 ("PU" . ($xUSEpltDEST+$RibThick) . "," . $Ycut . ";" . "\n"); } $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } for ($XY =1 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $FactorY = $FactorY + $OffsetYfact; $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); # print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); # if XYpositionUSE = factor of .2 then vert cut line $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; if ($XYpositionUSE*10==int($XYpositionUSE*10)) { # $Ycut = int((($FactorY+1.25)+($yHome+1.25))/2)*$UPI; # $yHIDest = 1; $yHiTemp = ($yHIDest + 1.25)*$UPI; $Ycut = (int($yUSEpltDEST + $yHiTemp)/2); $Ycut=int($Ycut); $Ycut2 = 250; print " XY= " . $XYpositionUSE; # print FILE4 ("PD" . $xUSEpltDEST . "," . $Ycut . ";" . "\n"); # print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";" . "\n"); } $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } close FILE4; } ############# make WAVE files #create files $num = 1; #create 3D coordinates # $x # $y # $z $xStart = $NewXfactor*-1; $yStart = -1; $xHome = $NewXfactor*-1; $yHome = -1; $xDest = $NewXfactor; $yDest = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $xHIHome = $NewXfactor*-1; $yHIHome = $yHome + $OffsetYfact; $xHIDest = $NewXfactor; $yHIDest = $yDest + $OffsetYfact; $dxfStep = 0; for ($Rib = 1; $Rib <= $total ; $Rib++){ $xStart = $NewXfactor*-1; $yStart = -1; $xHIStart = $NewXfactor*-1; $yHIStart = $yStart + $OffsetYfact; $position1 = $Rib - 1; $position2 = $position1 * $step * 10000; $position4 = $position2 - $ThingUSE; $position5 = ($position4/10000); $PositionUSE = $position5; $PosZ = $PositionUSE; if ($Rib <=999){$fill = "0" ;} if ($Rib <=99){$fill = "00" ;} if ($Rib <=9){$fill = "000" ;} open (FILE4, ">>D:\\Projects\\3D-design\\SIN\\Perl\\plt\\sinWav_Combo." . $fill . $Rib . ".plt"); $xUSEplt = ($xStart+$MargX )* $UPI; $yUSEplt = ($yStart+1.25)* $UPI; $yUSEpltTEMP = $yUSEplt + $R2factor; print FILE4 ("PU" . $xUSEplt . "," . $yUSEpltTEMP . ";\n"); print FILE4 ("PD" . $xUSEplt . "," . $yUSEpltTEMP . ";\n"); print $Rib . " "; # print $position1 . " "; # print $position2 . " "; # print $position3 . " "; # print $position4 . " "; print $PositionUSE; print ("\n"); for ($XY =1 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; # print "XY= " . $XYpositionUSE; # print " XY= " . $XYposition4; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $xUSEpltDEST = int(($XYpositionUSE+$MargX )* $UPI); $yUSEpltDEST = int(($FactorY+1.25)* $UPI); #$R2factor $yUSEpltDESTtemp = $yUSEpltDEST + $R2factor; print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDESTtemp . ";\n"); # if XYpositionUSE = factor of .2 then vert cut line $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } # print FILE4 ("PD" . (($xStart+$MargX )*$UPI) . "," . (($yDest+1.25)*$UPI) . ";" . "\n"); # print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); # print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHome+1.25)*$UPI) . ";" . "\n"); # print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); # print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); #$R2factor $yDestTempHere = (($yDest+1.25)*$UPI) + $R2factor; $yHomeTempHere = (($yHome+1.25)*$UPI) + $R2factor; print FILE4 ("PD" . (($xStart+$MargX )*$UPI) . "," . $yDestTempHere . ";" . "\n"); print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . $yHomeTempHere . ";" . "\n"); print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . $yHomeTempHere . ";" . "\n"); #print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIHome+1.25)*$UPI) . ";" . "\n"); #round 2 for ($XY =1 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $FactorY = $FactorY + $OffsetYfact; $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); #print FILE4 ("PD" . $xUSEpltDEST . "," . $yUSEpltDEST . ";\n"); $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } #$R2factor $yHIDestTempHere = (($yHIDest+1.25)*$UPI) + $R2factor; print FILE4 ("PU" . (($xStart+$MargX )*$UPI) . "," . $yHIDestTempHere . ";" . "\n"); print FILE4 ("PD" . (($xStart+$MargX )*$UPI) . "," . $yHIDestTempHere . ";" . "\n"); print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . $yHIDestTempHere . ";" . "\n"); #print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); for ($XY =1 ; $XY <= $XYTotal ; $XY++){ $XYposition1 = $XY - 1; $XYposition2 = $XYposition1 * $step2 * 10000; $XYposition4 = $XYposition2 - $ThingUSE; $XYposition4 = $XYposition4 * 1.0000001; $XYposition4 = int($XYposition4); $XYposition5 = ($XYposition4/10000); $XYpositionUSE = $XYposition5; $HypoCalc = ($PositionUSE**2)+($XYpositionUSE**2); $Hypo = ($HypoCalc**.5); $HypoFact = (int($Hypo*100000))/100000; $HypoUSE = $HypoFact; $Factor1 = $HypoUSE*90; $Factor2 = $freq * $Factor1; $Factor3 = $Factor2 + $phase; $Factor4 = $Factor3 * $rad; $Factor5 = (int($Factor4*1000000))/1000000; # $Factor5 = RAD conversion of X $Factor6 = sin($Factor5); $Factor7 = (int($Factor6*1000000))/1000000; # $Factor7 = sin of X $Factor8 = ($Factor5 / $circum) +1; $Factor9 = (int($Factor8*1000000))/1000000; # $Factor9 = $AlmostY = (($Factor7*((160/$Factor9**2)))/90*$amp); $FactorY = (int($AlmostY*1000000))/1000000; # $FactorY = Y $FactorY = $FactorY + $OffsetYfact; $xUSEpltDEST = int(($XYpositionUSE+$MargX )*$UPI); $yUSEpltDEST = int(($FactorY+1.25)*$UPI); #$R2factor $yTEMPusePLTdest = $yUSEpltDEST + $R2factor; print FILE4 ("PD" . $xUSEpltDEST . "," . $yTEMPusePLTdest . ";\n"); $Logic = ($XYpositionUSE*10); $Test = int($XYpositionUSE*10); print " Log=" . $Logic . " Test=" . $Test; $xStart = $XYpositionUSE; $yStart = $FactorY; print ("\n"); } $yHIDestTEMP = (($yHIDest+1.25)*$UPI) + $R2factor; print FILE4 ("PD" . (($xStart+$MargX )*$UPI) . "," . $yHIDestTEMP . ";" . "\n"); #print FILE4 ("PD" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); #print FILE4 ("PU" . (($xHome+$MargX )*$UPI) . "," . (($yHIDest+1.25)*$UPI) . ";" . "\n"); print FILE4 ("PU;PU;SP0;" . "\n"); close FILE4; }