/*dt = Open( "$SAMPLE_STIPS/Wafer Stacked Small.jmp" ); dt << Generatore di grafici( Dimensioni( 534, 464 ), Mostra pannello di controllo( 0 ), Spaziatura grafico( 4 ), Variabili( X( :X_Die ), Y( :Y_Die ), Avvolgi( :Lotto, Livelli per riga( 3 ) ), Colore ( : Difetti, Statistica riepilogativa ( " Somma " ) ) ), Elementi ( Mappa termica ( X, Y, Legenda ( 5 ) ) ), Invia a report ( Dispatch ( {}, "X_Die", ScaleBox, {Min ( - 22), Max( 22 ), Inc( 5 ), Minor Ticks( 4 )} ), Dispatch( {}, "Y_Die", ScaleBox, {Min( -20 ), Max( 22 ), Inc( 5 ), Minore Ticks( 4 )} ), ) );*/ // seconda parte ---------------------------------- ---------------------- //Nomi predefiniti qui (1); Nuovo spazio dei nomi ("LineScan"); LineScan:LS_Initialize = Function( {}, // variabili utilizzate per la comunicazione tra Linescan e Mousetrap LineScan:MyfirstClick = 1; LineScan:startx = 0; LineScan:starty = 0; LineScan:exx = 0; LineScan:exy = 0 ; LineScan:mouse_released = 0; LineScan:gb = 1; LineScan:dt = 1; ); LineScan:CloseTemporaryTables() = Function( {}, dtList = Ottieni elenco tabelle dati(); For Each( {checkDt, idx}, dtList, If( Not(IsMissing(Regex( checkDt << get name(), "tempDTLineCutXY. *" ))), Print( checkDt << ottieni nome() || ": chiudi" ); Chiudi (controlla Dt, nessun salvataggio))); ); LineScan:LS_findVariables = Function( {},foundX = 0;foundY = 0;foundCol = 0; allVariables = (LineScan:gb << ottieni variabili); For Each( {var, idx}, allVariables, If( Arg( var[ 2] ) == "X", xVar = var[1]; trovatoX = 1; ); If( Arg( var[2] ) == "Y", yVar = var[1]; trovatoY = 1; ); If( Arg( var[2] ) == "Colore", colVar = var[1]; findCol = 1; ); ); LineScan:myStatistics = "Mean"; LineScan:myGroups = {}; gbScript = LineScan:gb << Ottieni script; numArgs = N Arg( gbScript ); For( i = 1, i <= numArgs, i++, If( Head Name( Arg( gbScript, i ) ) == "Variabili", //Print( "trovato variabili", i ); nVariabili = N Arg( Arg( gbScript, i ) ); For( k = 1, k <= nVariabili, k++, If( Nome testa( Arg( Arg( gbScript, i ), k ) ) = = "Colore", //Stampa( "colore trovato", k ); nVoci = N Arg( Arg( gbScript, i ) ); For( m = 1, m <= nVoci, m++, If( Head Name( Arg( Arg( Arg( gbScript, i ), k ), m ) ) == "Statistica riepilogativa", //Print( "stat trovata", m ); LineScan:myStatistics = Arg( Arg( Arg( Arg( gbScript, i ) , k ), m ), 1 ) ) );, miaTesta = Nome testa( Arg( Arg( gbScript, i ), k ) ); Contiene( {"Gruppo X", "Gruppo Y", "Wrap"}, myHead);, //Stampa( "gruppo trovato", k); Inserisci in( LineScan:myGroups, Arg( Arg( Arg( gbScript, i ), k ), 1 ) ) ), ); ) ); trovatoX * trovatoY * trovatoCol; ); LineScan:LS_sel_rows = Funzione( {}, non riuscita = 0; xx = xVar << ottieni valori(); yy = yVar << ottieni valori(); nr = N elementi( yy ); x1 = LineScan:startx; x2 = LineScan :exx; y1 = LineScan:starty; y2 = LineScan:exy; dx = x2 - x1; dy = y2 - y1; d1_2sq=( dx * dx + dy * dy ); d1_2= Sqrt(d1_2sq);// distanza tra punti If( And( dx == 0, dy == 0 ), Print( "nessuna linea" ); fallito = 1; , px1 = (xx - x1); py1 = (yy - y1); dotp1 = (px1 * dx + py1 * dy); proj1sq = dotp1 dotp1 / d1_2sq; // proiezione lungo la linea proj1=sqrt(proj1sq); lensq = px1 px1 + py1 py1; // distanza da pt1 dist = Sqrt( lensq - proj1sq ); / /Selezione di Pitagora = J( nr, 1 ); larghezza = If( È vuoto( larghezzaEB ), Print( "usa predefinito" ); 0.7; , larghezzaEB << get() ); selezione[Loc( dist > larghezza )] = .; px2 = (xx - x2); py2 = (yy - y2); dotp2 = (px2 * dx + py2 * dy); proj2sq = dotp2 dotp2 / d1_2sq; proj2=sqrt(proj2sq); selezione[Loc( proj1 > d1_2 )] = .; //rimuove i punti troppo lontani (raggio attorno all'inizio e alla fine) selezione[Loc( proj2 > d1_2 )] = .; filteredRows = Loc((1::nr)`); Try( ldf = Linescan:TheReport["Filtro dati locali"] << ottieni oggetto scriptabile(); // meraviglioso (grazie Jim) filteredRows = ldf << Ottieni righe filtrate; ); Righeescluse = J( nr, 1 ); If(!IsMissing(filteredRows), esclusoRighe[filteredRows] = .; esclusoRighe=Loc(excludedRows); selezione[excludedRows] = .; //applica filtro dati ); selezione[LineScan:dt << Ottieni righe escluse()] = .; // applica la selezione del filtro dati globale = Loc(selezione); //mantieni solo quelli non vuoti If( N Items( selezione ) <= 0, Print( "niente selezionato" ); fallito = 1; , posAlongLine = proj1[selezione]; LineScan:CloseTemporaryTables(); LineScan:dt < < Cancella selezione; LineScan:dt << Seleziona righe (selezione); LineScan:dt_tempLineCut = LineScan:dt << Sottoinsieme (invisibile, righe (selezione), solo colonne selezionate (0), nascoste); LineScan:dt_tempLineCut << Nuova colonna ( "posizione lungo la linea", numerico, "continuo", valori (posAlongLine)); LineScan:dt_tempLineCut << Imposta nome ("tempDTLineCutXY");); ); Non(fallito); ); LineScan:GetStatisticsFunction = Function( {myStat}, Print( "implement" ) ); LineScan:LS_prepareExpressions = Funzione( {myStat}, //Print( "LS: prepareExpressions" ); myStatisticsFunction = Match( myStat, "N", Nome Espr( Col Numero ), "Media", Nome Espr( Col Mean ), " Mode", Nome Espr( Col Mode ), "Sum", Nome Espr( Col Sum ), "Std Dev", Nome Espr( Col Std Dev ), "Min", Nome Espr( Col Minimum ), "Max", Nome Espr( Col Massimo ), "Mediana", Nome Espr( Col Mediana ), "Intervallo", Nome Espr( Col Range ), "Somma cumulativa", Nome Espr( Col Somma cumulativa ), Nome Espr( Col Numero ) ); LineScan :YvariableName = myStat || "(" || (colVar << Ottieni nome) || ")"; LineScan:preparedYFunction = Substitute( Expr( __aggregation__( __colVar__, __xVar__, __yVar__ ) ), Expr( __aggregation__ ), Name Expr( miaFunzioneStatistica ), Espr( __colVar__ ), Nome Espr( colVar ), Espr( __xVar__ ), Nome Espr( xVar ), Espr( __yVar__ ), Nome Espr( yVar ), ); If( miaStat == "Mediana", LineScan:preparedYFunction = Inserisci( Nome Espr( LineScan:preparedYFunction ), 0.5, 2 ) ); For Each( {GroupVar, idx}, LineScan:myGroups, LineScan:preparedYFunction = Inserisci( Nome Espr( LineScan:preparedYFunction ), Nome Espr( GroupVar ) ) ); LineScan:preparedVariables = Expr( Variabili( X( :posizione lungo la linea ), Y( :YVariable ) ) ); If( N elementi( LineScan:myGroups ), LineScan:preparedVariables = Insert( Name Expr( LineScan:preparedVariables ), Eval Expr( Overlay( Expr( LineScan:myGroups[1] ) ) ) ) ); 1 //valore restituito, non eliminare!!! ; ); LineScan:LS_prepareWindow = Funzione( {}, //Print( "LS: prepareWindow" ); If( È vuoto( LineScan:LinecutWindow ), LineScan:LinecutWindow = Nuova finestra( "Linecut", Mostra menu( 0 ), Mostra barre degli strumenti( 0 ), Casella di riepilogo V ( Casella di riepilogo H ( Casella di testo ( "larghezza del taglio di linea: " ), larghezzaEB = Casella di modifica numero ( 0.6 ), Casella di testo ( " aggiornamento? -> disegna una nuova linea") ), Spacer Box( size( 100, 0 ) ), H List Box( Spacer Box( size( 0, 100 ) ), gb2_container = V List Box() ) ), ); LineScan: LinecutWindow << alla chiusura( // non funziona ?!??! Print("chiusura finestra"); LineScan:CloseTemporaryTables(); ) ; , LineScan:LineCutWindow << Porta la finestra in primo piano ) ); LineScan:LS_generateNewPlot = Function( {}, //Print( "generatePlot" ); Try( gbLC << delete() ); gb2_container << Append( Eval( Substitute( Expr( gbLC = LineScan:dt_tempLineCut << Generatore di grafici( Trasforma Colonna( "Variabile Y", Formula( __statistiche__ ) ), Dimensione( 450, 250 ), Mostra pannello di controllo( 0 ), Mostra legenda( 0 ), Mostra titolo( 0 ), Adatta finestra(), Spaziatura grafico( 4 ), __variabili__ , Elementi( Punti( X, Y, Legenda( 3 ) ), Smoother( X, Y, Legenda( 4 ), Lambda( 0.005 ) ) ) ) ), Espr( __statistics__ ), Nome Espr( LineScan:preparedYFunction ), Espr( __variables__ ), Nome Espr( LineScan:preparedVariables ) ) ) ); If( N elementi( LineScan:myGroups ), gbLC << Mostra legenda( 1 ) ); Report( gbLC )[AxisBox( 1 )] << Min( 0 ) ; Rapporto( gbLC )[Casella di modifica testo( 4 )] << Imposta testo( LineScan:YvariableName ); Rapporto( gbLC )[Casella di contorno( 1 )] << Imposta titolo( "Linecut" ); ); LineScan:LS_update = Function( {}, {Locale predefinito}, //Print( "LS: aggiornamento" ); If( LineScan:LS_findVariables(), If( LineScan:LS_sel_rows(), LineScan:LS_prepareExpressions( Linescan:myStatistics ); LineScan:LS_prepareWindow(); LineScan:LS_generateNewPlot(); ) ) ); LineScan:LS_getMousetrapCoordinates = Function( {}, If( LineScan:MyfirstClick == 1, LineScan:dt << Cancella selezione; LineScan:startx = x; LineScan:starty = y; LineScan:MyfirstClick++; ); LineScan:exx = x; LineScan:exy = y; ); // ora aggiungiamo MouseTrap LineScan:LS_Initialize(); Try( LineScan:CloseTemporaryTables(); Linescan:TheReport = Report corrente(); gbrs = (Report corrente() << XPath( "//OutlineBox[
@helpKey = 'Graph Builder']" )); If( N elementi( gbrs ), Linescan:gb = gbrs[1] << Ottieni oggetto scriptabile(); Linescan:dt = Linescan:gb << Ottieni tabella dati(); FrameBoxes = gbrs[1] << XPath( "//FrameBox" ) ; For Each( {myFrameBox, idx}, FrameBoxes, myFrameBox << aggiungi script grafico( Mousetrap( LineScan:LS_getMousetrapCoordinates(), LineScan:MyfirstClick = 1; LineScan:mouse_released = 1; ); myline = Line( {LineScan:startx, LineScan:starty}, {LineScan:exx, LineScan:exy} ); If( LineScan:mouse_released, If( 0, Print( 1 ), LineScan:LS_update() ) ); LineScan:mouse_released = 0; ) ); ); );