/*dt = Open( "$SAMPLE_STIPS/Wafer Stacked Small.jmp" ); dt << Générateur de graphiques (taille (534, 464), afficher le panneau de configuration (0), espacement des graphiques (4), variables (X (: X_Die), Y (: Y_Die), Wrap (: Lot, niveaux par ligne (3) ) ), Color(

éfauts, Statistiques récapitulatives( "Sum" ) ) ), Elements( Heatmap( X, Y, Legend( 5 ) ) ), SendToReport( Dispatch( {}, "X_Die", ScaleBox, {Min( - 22 ), Max( 22 ), Inc( 5 ), Ticks mineurs( 4 )} ), Dispatch( {}, "Y_Die", ScaleBox, {Min( -20 ), Max( 22 ), Inc( 5 ), Mineur Tiques( 4 )} ), ) );*/ // deuxième partie ---------------------------------- ---------------------- //Noms par défaut ici( 1 ); Nouvel espace de noms( "LineScan" ); LineScan:LS_Initialize = Function( {}, // variables utilisées pour la communication entre le Linescan et le 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 = Get Data Table List(); For Each( {checkDt, idx}, dtList, If( Not(IsMissing(Regex( checkDt << get name()), "tempDTLineCutXY. *" ))) , Print( checkDt << get name() || ": close" ); Fermer (checkDt, pas de sauvegarde) ) ); ); LineScan:LS_findVariables = Function( {}, foundX = 0; foundY = 0; foundCol = 0; allVariables = (LineScan:gb << obtenir des variables); Pour chaque ({var, idx}, allVariables, If( Arg( var[ 2] ) == "X", xVar = var[1]; foundX = 1; ); If( Arg( var[2] ) == "Y", yVar = var[1]; foundY = 1; ); If( Arg( var[2] ) == "Couleur", colVar = var[1]; foundCol = 1; ); ); LineScan:myStatistics = "Mean"; LineScan:myGroups = {}; gbScript = LineScan:gb << Obtenir le script ; numArgs = N Arg( gbScript ); For( i = 1, i <= numArgs, i++, If( Head Name( Arg( gbScript, i ) ) == "Variables", //Print( "found variables", i ); nVariables = N Arg( Arg( gbScript, i ) ); For( k = 1, k <= nVariables, k++, If( Nom de la tête( Arg( Arg( gbScript, i ), k ) ) = = "Couleur", //Print( "couleur trouvée", k ); nEntries = N Arg( Arg( gbScript, i ) ); For( m = 1, m <= nEntries, m++, If( Nom de la tête ( Arg( Arg( Arg( gbScript, i ), k ), m ) ) == "Statistiques récapitulatives", //Print( "statistiques trouvées", m ); LineScan:myStatistics = Arg( Arg( Arg( Arg( gbScript, i ) , k ), m ), 1 ) ) );, myHead = Head Name( Arg( Arg( gbScript, i ), k ) ); Contient( {"Groupe X", "Groupe Y", "Wrap"}, myHead );, //Print( "groupe trouvé ", k ); Insérer dans( LineScan:myGroups, Arg( Arg( Arg( gbScript, i ), k ), 1 ) ) ), ); ) ); foundX * foundY * foundCol; ); LineScan:LS_sel_rows = Function( {}, failed = 0; xx = xVar << obtenir les valeurs (); yy = yVar << obtenir les valeurs (); nr = N éléments ( 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);// distance entre points If( And( dx == 0, dy == 0 ), Print( "no line" ); failed = 1; , px1 = (xx - x1); py1 = (yy - y1); dotp1 = (px1 * dx + py1 * dy); proj1sq = dotp1 dotp1 / d1_2sq; // projection le long de la ligne proj1=sqrt(proj1sq); lensq = px1 px1 + py1 py1; // distance à pt1 dist = Sqrt( lensq - proj1sq ); / /Sélection Pythagore = J( nr, 1 ); width = If( Is Empty( widthEB ), Print( "use default" ); 0.7; , widthEB << get() ); selection[Loc( dist > width )] = .; px2 = (xx - x2); py2 = (yy - y2); dotp2 = (px2 * dx + py2 * dy); proj2sq = dotp2 dotp2 / d1_2sq; proj2=sqrt(proj2sq); sélection[Loc( proj1 > d1_2 )] = .; //supprimer les points trop éloignés (rayon autour du début et de la fin) sélection[Loc( proj2 > d1_2 )] = .; filteredRows = Loc((1::nr)`); Try( ldf = Linescan:TheReport["Local Data Filter"] << obtenir un objet scriptable (); // merveilleux (merci Jim) filteredRows = ldf << Obtenir les lignes filtrées; ); ExclusRows = J( n°, 1 ); If(!IsMissing(filteredRows), exclusRows[filteredRows] = .; exclusRows=Loc(exclusRows); sélection[exclusRows] = .; //appliquer un filtre de données ); selection[LineScan:dt << Obtenir les lignes exclues()] = .; // appliquer la sélection du filtre de données global = Loc( sélection ); // gardez simplement ceux qui ne sont pas vides If( N Items( selection ) <= 0, Print( "nothing selected" ); failed = 1; , posAlongLine = proj1[selection]; LineScan:CloseTemporaryTables(); LineScan:dt < < Effacer la sélection ; LineScan:dt << Sélectionner les lignes (sélection); LineScan:dt_tempLineCut = LineScan:dt << Sous-ensemble (Invisible, Lignes (sélection), Colonnes sélectionnées uniquement (0), masquées); LineScan:dt_tempLineCut << Nouvelle colonne ( "position le long de la ligne", numérique, "continu", valeurs ( posAlongLine ) ); LineScan:dt_tempLineCut << Set Name( "tempDTLineCutXY" ); ); ); Non (échec); ); LineScan:GetStatisticsFunction = Function( {myStat}, Print( "implement" ) ); LineScan:LS_prepareExpressions = Function( {myStat}, //Print( "LS: prepareExpressions" ); myStatisticsFunction = Match( myStat, "N", Name Expr( Col Number ), "Mean", Name Exr( Col Mean ), " Mode", Nom Expr (Col Mode), "Sum", Nom Expr (Col Sum), "Std Dev", Nom Expr (Col Std Dev), "Min", Nom Expr (Col Minimum), "Max", Nom Expr (Col Maximum), "Médiane", Nom Expr (Col Médian), "Plage", Nom Expr (Col Range), "Somme cumulée", Nom Expr (Col Cumulative Sum), Nom Expr (Col Number) ); LineScan :YvariableName = myStat || "(" || (colVar << Get Name) || ")"; LineScan:preparedYFunction = Substitute( Expr( __aggregation__( __colVar__, __xVar__, __yVar__ ) ), Expr( __aggregation__ ), Name Expr( maFonctionStatistiques), Expr( __colVar__ ), Nom Expr( colVar ), Expr( __xVar__ ), Nom Expr( xVar ), Expr( __yVar__ ), Nom Expr( yVar ), ); If( myStat == "Median", LineScan:preparedYFunction = Insérer (Nom Expr( LineScan:preparedYFunction ), 0.5, 2 ) ); Pour chaque ( {GroupVar, idx}, LineScan:myGroups, LineScan:preparedYFunction = Insert( Name Expr( LineScan:preparedYFunction ), Name Expr( GroupVar ) ) ); LineScan:preparedVariables = Expr( Variables( X( :position le long de la ligne ), Y( :YVariable ) ) ); If( N Items( LineScan:myGroups ), LineScan:preparedVariables = Insert( Name Expr( LineScan:preparedVariables ), Eval Expr( Overlay( Expr( LineScan:myGroups[1] ) ) ) ) ); 1 //valeur renvoyée, ne supprimez pas !!! ; ); LineScan:LS_prepareWindow = Function( {}, //Print( "LS: prepareWindow" ); If( Est vide( LineScan:LinecutWindow ), LineScan:LinecutWindow = Nouvelle fenêtre( "Linecut", Afficher le menu ( 0 ), Afficher les barres d'outils ( 0 ), V List Box ( H List Box ( Text Box ( " largeur de la coupe de ligne : " ), widthEB = Number Edit Box ( 0.6 ), Text Box ( " update ? -> tracer une nouvelle ligne" ) ), Spacer Box( size( 100, 0 ) ), H List Box( Spacer Box( size( 0, 100 ) ), gb2_container = V List Box() ) ), ); LineScan : LinecutWindow << on Close( // ne fonctionne pas ?!??! Print( "fermeture de la fenêtre" ); LineScan:CloseTemporaryTables(); ) ; , LineScan:LineCutWindow << Amener la fenêtre au premier plan ) ); LineScan:LS_generateNewPlot = Function( {}, //Print( "generatePlot" ); Try( gbLC << delete() ); gb2_container << Append( Eval( Substitute( Expr( gbLC = LineScan:dt_tempLineCut << Graph Builder( Transform Colonne ( "YVariable", Formule ( __statistiques__ ) ), Taille ( 450, 250 ), Afficher le panneau de configuration ( 0 ), Afficher la légende ( 0 ), Afficher le titre ( 0 ), Ajuster la fenêtre (), Espacement du graphique ( 4 ), __variables__ , Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ), Lambda( 0.005 ) ) ) ) ), Expr( __statistics__ ), Name Expr( LineScan:preparedYFunction ), Expr( __variables__ ), Nom Expr( LineScan:preparedVariables ) ) ) ); If( N Items( LineScan:myGroups ), gbLC << Show Legend( 1 ) ); Report( gbLC )[AxisBox( 1 )] << Min( 0 ) ; Rapport( gbLC )[Text Edit Box( 4 )] << Définir le texte( LineScan:YvariableName ); Rapport( gbLC )[Outline Box( 1 )] << Définir le titre( "Linecut" ); ); LineScan:LS_update = Function( {}, {Default Local}, //Print( "LS: update" ); If( LineScan:LS_findVariables(), If( LineScan:LS_sel_rows(), LineScan:LS_prepareExpressions( Linescan:myStatistics ); LineScan:LS_prepareWindow(); LineScan:LS_generateNewPlot(); ) ) ); LineScan:LS_getMousetrapCoordonnées = Function( {}, If( LineScan:MyfirstClick == 1, LineScan:dt << Clear Select; LineScan:startx = x; LineScan:starty = y; LineScan:MyfirstClick++; ); LineScan:exx = x; LineScan:exy = y; ); // ajoutons maintenant le MouseTrap LineScan:LS_Initialize(); Try( LineScan:CloseTemporaryTables(); Linescan:TheReport = Current Report(); gbrs = (Current Report() << XPath( "//OutlineBox[
@helpKey = 'Graph Builder']" )); If( N Items( gbrs ), Linescan:gb = gbrs[1] << Obtenir un objet scriptable (); Linescan:dt = Linescan:gb << Obtenir une table de données (); FrameBoxes = gbrs[1] << XPath( "//FrameBox" ) ; Pour chaque( {myFrameBox, idx}, FrameBoxes, myFrameBox << ajouter un script graphique ( Mousetrap( LineScan:LS_getMousetrapCoordonnées(), 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; ) ); ); );