Dxf to xyz arrays positions

NI Motion assistant 
Version 2.6
Labview full development system 2012
I need to read a CAD file and export the XYZ coordinates.
Problem :
It's possible with Motion assistant to enter a dxf file and to export XML file.
After this I can to work with the xml file to export the array of xyz position.
The problem is, without Motion Assistant it's not possible to create the xml file.
how can i in block diagram of labview export XML file from DXF?

unclebump wrote:
Send me a pm, I have a cad program that can read dxf files and spit out the coordinates. Is this a one time thing or do you need to do it over and over?
Or you could look at something like this
http://www.ransen.com/pointor/DXF-to-XYZ.htm
Another post by unclebump that came up in a different search... This is getting strange.
unclebump, I have a need for the functionality to output labview x/y coordinates to a DXF. The current method is to print out the coordinates and have another engineer plot them in SolidWorks. I would like to streamline this by outputting the DXF in LabVIEW. Is there a way to do this?
Thanks,
James
LabVIEW Professional 2014

Similar Messages

  • Displaying Array Position not working in case of descending Order?

    Hi,
    I need to display the array position of the sorted array in Descending order. Here is my code.
         int[] in = {5,3,2,7};
              int[] newArr = new int[in.length];
              int[] na = new int[in.length];
              //copying into a new array
              for(int i=0;i<in.length;i++){               
                   newArr[i] = in;     
              // code for descending order
              for(int j=0;j<in.length;j++){
              Arrays.sort(in);
              na[j] = in[in.length-(1+j)];
              }the sorted array will be will be {7,5,3,2} now according to this i need to display the array position of the sorted array which should be {3,0,1,2} i tried to compare newArr[i] with na[j] but am not gettin the result that i should be getting the same comparison is working in case of Ascending Order but not descending. Any suggestions or help will be appreciated.
    Thanks and regards.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    hi,
    what you are doing is correct only, do not put sort method inside the for loop
    and postion is correct also
    int[] in = {5,3,2,7};
            int[] newArr = new int[in.length];
            int[] na = new int[in.length];
            //copying into a new array
            for(int i=0;i<in.length;i++){
                newArr[i] = in;
    Arrays.sort(in);
    // code for descending order
    for(int j=0;j<in.length;j++){
    na[j] = in[(in.length-1)-j];
    System.out.println("Val --> "+na[j]);
    System.out.println("Position --> "+j);

  • Problem in displaying Array Position?

    hi,
    I am having a problem in displaying the array position of a sorted Array
    for ex:
    int[] a = {4,3,1,7}for sorting the array i am using Arrays.sort(a); then the output will be
    a = {1,3,4,7}now according to this i need to display the array position of a before sorting like a should have the output {2,1,0,3} which should be the array position of the sorted array. Any help will be appreciated.
    Thanks.

    for (int i = 0 ; i < unsortedArray.length ; i++)
       for (int j = 0 ; j < sortedArray.length ; j++)
           if (unsortedArray[i] == sortedArray[j]) {
                 System.out.println("position for element "+i+" is "+j);
                 break;
           }notice that if you have duplicate values, the position of the duplicate will always be considered as the first occurence of this value

  • MMM1061: Corrupted array: position mismatch at 0

    Hello
    We got severes errors on Parent Mappings with Pluggable Mappings inside. We can Analyze and Deploy the Parent Mappings without any error, but we get errors on syncrhonizing the Parent Mappings.
    1. Error on Synchronize a Parent Mapping (Pluggable Mappings inside)
    Msg Box:
    MMM1061: Corrupted array: position mismatch at 0.
    MMM1061: Corrupted array: position mismatch at 0.
    2. Error on closing the previously syncrhonized Parent Mapping
    Msg Box:
    INTERNAL ERROR: in MapGenerationLanguageValidator.validate(GENERATION_LANGUAGE, PLSQL)
    3. Error on opening this or any other mapping:
    Msg Box:
    Repository Usage Error: Start nested transaction while already in one. Please contact Oracle Support with the stack trace and details on how to reproduce it.
    All 3 msg boxes have a Detail button with a lot of Java function calls (too much to post it here).
    What we tried so far (but all didn't help so far)
    - Copy existing Pluggable Mapping and use this one in existing Parent Mapping
    - Removing Pluggable Mapping from Parent Mapping and the include it again
    - Recreating Pluggable Mapping from scratch and include it in Parent Mapping
    - Rebuidling new Pluggable Mapping from scratch and also new Parent Mapping, using the newly created Pluggable Mapping
    - Making sure all developers accessing the OWB Repository have the same language settings (English)
    The only thing that helped so far was creating a dummy Pluggable Mapping/Parent Mapping NOT using (including) any other existing objects from this Repository (like tables, etc.)
    The sync strategy (merge, update) has no influence whether we can sync successfully or not.
    My conclusion so far is:
    a) We have a severe internal Repository problem
    or
    b) This OWB version doesn't properly support Pluggable Mappings/Parent Mappings.
    Any1 already had the same problems? We are working with OWB Client 10.2.0.1.31 and Warehouse Builder Repository: 10.2.0.1.0
    Any hint are welcome
    Thank you

    Hi,
    I recommend using the latest OWB Patch 10.2.0.4. The first release of 10.2 was quite buggy concerning pluggable mappings. we did not use them in that version.
    Regards,
    Carsten.

  • Why do panel array positions change when I move to a computer with LCD screen?

    I wrote a program in the lab and then moved it to the production area which
    has a computer with an lcd monitor. The program has 3 arrays of clusters on
    the front panel and each contain both controls and indicators. When I moved
    it to the production computer the 3 array moved somewhat from their proper
    positions. Also, each one moved a different distance. I wanted them to be
    aligned so I ended up moving them out of alignment on the uncompiled copy so
    that the production copy would be aligned correctly. Is there something
    funny about lcd screens? Labview property node reports they are already
    aligned and of equal height. Is there a way of forcing the arrays to align
    no mat
    ter what computer it is installed on?

    I've seen this before. If the resolutions are different it scales certain fonts
    differently causing your controls to move. You need to make sure your using a
    common font type and size between them or change your resolution on your desktop
    to match the lcd's.
    You can check the font on both machines to match them. One might have Arial 13,
    20, 28 and the other Ariel 14, 20, 26. If you pick 20 it will go back and forth
    ok, properly scaled.
    Jim
    Adam Russell wrote:
    > I wrote a program in the lab and then moved it to the production area which
    > has a computer with an lcd monitor. The program has 3 arrays of clusters on
    > the front panel and each contain both controls and indicators. When I moved
    > it to the production computer the 3 array moved somewhat
    from their proper
    > positions. Also, each one moved a different distance. I wanted them to be
    > aligned so I ended up moving them out of alignment on the uncompiled copy so
    > that the production copy would be aligned correctly. Is there something
    > funny about lcd screens? Labview property node reports they are already
    > aligned and of equal height. Is there a way of forcing the arrays to align
    > no matter what computer it is installed on?

  • Modifying Array position with IViewCursor

    I have array print with command
    Alert.show(''+ObjectUtil.toString(arrColl));
    (mx.collections::ArrayCollection)#0
    filterFunction = (null)
    length = 4
    list = (mx.collections::ArrayList)#1
    length = 4
    source = (Array)#2
    [0] (Object)#3
    2008-03 = "1473"
    2008-03p = "40,19"
    desc = "Usuários únicos"
    [1] (Object)#4
    2008-03 = "1476"
    2008-03p = "-16,80"
    desc = "Novos usuários"
    [2] (Object)#5
    2008-03 = "53114"
    2008-03p = "39,25"
    desc = "Sessões"
    [3] (Object)#6
    2008-03 = "45"
    2008-03p = "-97,78"
    desc = "Tarifação"
    uid = "8B1A7D6D-62D1-C9BF-85DD-C538F40ED10D"
    sort = (null)
    source = (Array)#2
    I would like to modify the position of the Array, moving the
    last key for the beginning.
    thus:
    [0] (Object)#3
    desc = "Usuários únicos"
    2008-03 = "1473"
    2008-03p = "40,19"
    [1] (Object)#4
    desc = "Novos usuários"
    2008-03 = "1476"
    2008-03p = "-16,80"
    [2] (Object)#5
    desc = "Sessões"
    2008-03 = "53114"
    2008-03p = "39,25"
    [3] (Object)#6
    desc = "Tarifação"
    2008-03 = "45"
    2008-03p = "-97,78"
    my code source, but is not functioning. some tip of the
    error?
    /code]
    //Recebi o resultado e guarda em um array devido
    ordenação
    var arrColl:ArrayCollection = new ArrayCollection(event.data
    as Array);
    Alert.show(''+ObjectUtil.toString(arrColl));
    if (! runBefore) {
    runBefore=true;
    for (var i:int=0; i < arrColl.length; i++)
    // Get an IViewCursor object for accessing the collection
    data.
    var myCursor:IViewCursor=arrColl
    .createCursor();
    // Get the original collection length.
    var oldLength:int=arrColl.length;
    myCursor.seek(CursorBookmark.LAST);
    // The cursor is initially at the first item; delete it.
    var removedItem:Object=Object(myCursor.remove());
    // The cursor is at the (new) first item;
    // move it to the firs item.
    myCursor.seek(CursorBookmark.FIRST, 0);
    // Add removedItem as the first item.
    myCursor.insert(removedItem);
    var sort:Sort = new Sort();
    arrColl.sort=sort;
    // Refresh the collection view to apply the sort.
    arrColl.refresh();
    //Guarda na variavel o array
    dgReport.dataProvider = arrColl;
    [/code]

    No tip??

  • Array position problem

    HI everyone I am looking for some help on an array problem.
    I am reading in a text file that is in a line by line format eg.
    apple
    orange
    pear
    etc
    The problem is that I want my array to increment each line. However each time a new line is read from the text file the array postion goes back to zero. Im assuming theres something wrong with my loop. Somebody please help!!!
    String line;
    String[] words;
    int i;
    try { 
    BufferedReader reader = new BufferedReader(new FileReader("wordlist.txt"));
    while((line = reader.readLine()) != null){
    words = line.split(" ");
    for(i = 0; i < words.length; i++){
    Arrays.sort(words);
    //System.out.println(words);
    if(findWord.equals(words[i])) {
    Cap = "the word was found at position " + Arrays.binarySearch(words, words[i]);
    test=true;
    checkString();
    reader.close();
    I I read in
    apple orange pear
    carrot cucumber tomato
    then apple[0] orange[1] pear[2]
    but then this resets to 0 on new line i.e
    carrot[0] cucumber[1] tomato[2]

    Correct me if Im wrong but I think I have created the
    array out side the loop.Your original code declares the array outsid of the loop, but it doesn't create it. It just allocates a reference variable that will point to the aray.
    Inside the loop, where you do words = split you're creating a new array each time. (And like I said, if there's only one word on a line, you don't need to spilt.)
    As for putting the next
    lines word into the array on each loop pass I do not
    understand how to do this. Any help would be
    appreciated?
    for (int ix = 0; ix < numLines; ix++) {
        arrar[ix] = the line that you just read
    } Of course, if you're using the standard while (line != null) for loop control, then you can just skip the for part and create an index variable that you increment inside the body of the loop.

  • Writing random array positions to file

    Hi all.
    I have an array of 1000 positions each consisting of a String.
    I want to write the strings equally to two seperate text files which i have managed without any probs.
    The problem is i want to write these strings in a total random order so each time its run different strings would end up in different files and in total different order.
    i know how to generate a random number but not sure how to access all positions of the array but in random order.
    Any help would be appreciated.
    thanks

    The Random class has methods that generate random ints.
    You can use those ints to index the array and get the String from that position.
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Random.html

  • Is there a way to separate an array into it's positive and negative elements?

    I'm working with an array, and I'd like to be able to seperate this array into it's positive and negative elements. I'd like to be able to store each of these values in two other arrays (positive and negative arrays if you will). If anyone could suggest an algorithm for doing this, I'd appreciate any help I can get.

    Actually, if you slightly modify the VI in the example, you can use it as a sub-VI for your application. In the front panel, right-click the VI's icon located on the top-right of your VI. Then select "Show Connector" and add the necessary connetcors to the VI (One for the input and two for the output) for the VI so it can be used as a Sub-VI. Save it with a different name and location so you don't change the original.
    www.vartortech.com

  • Painting Graphics from an Array

    I have a GUI that displays the Towers of Hanoi solution in a JPanel. Everything actually works except for a slight repainting issue.
    Currently I am overriding the paint() function, I know that for my purpose using paintComponent() would probably be the better route, however that's not my issue...
    The images (disks) in my JPanel are not redrawing properly, and I have no idea why...
    Basically:
    - I call setup() to set the number of disks and the co ordinates they should be drawn. (store them in an array)
    - I call moveDisk() to change the co ordinates of each disk as they are being moved.
    - then drawDisk() is called to go through the array of disks and print them.
    currently paint() calls drawDisk() in order to display the current position of all the disks.
    It seems to work fine for the first 2 moves, then disks start disappearing until there is one (the last disk) left...BUT if I print the co ordinates of the disks they seem to be correct, just not drawing.
    could someone take a look at my code and see what is wrong?
    below is the meat of the code, minus the GUI:
        public class HanoiFrame extends javax.swing.JFrame {
        private static final int STATE_SETUP = 0;
        private static final int STATE_ANIMATE = 1;
        private static final int POLE_AREA_HEIGHT = 356;
        private static final int POLE_AREA_WIDTH = 205;
        private static final int DISK_ARC_HEIGHT = 15;
        private static final int DISK_ARC_WIDTH = 15;
        private static final int DISK_HEIGHT = 23;
        private static final int MAX_DISKS = 10;
        private static final int MAX_ANIMATION_DELAY = 30000;
        private static final int MAX_PHYSICAL_DELAY = 100000;
        private static final int MIN_DISKS = 1;
        private static final int MIN_ANIMATION_DELAY = 1;
        private static final int MIN_PHYSICAL_DELAY = 1;
        private static final int EMPTY_CELL_VALUE = -1;
        private static final int CELL_HEIGHT = 25;
        private static final int COLUMNS = 3;
        private static final int ROW = 11;
        private  static final int MILLISECONDS_PER_SECOND = 1000;
        private final static String newline = "\n";
        private static Disk[] disks;
        private static Disk newDisk;
        private static int[][] diskCells;
        public static  int startX = 2;
        public static  int startY = 340;
        public static int setDiskAmount = 0;
        public static int setAnimationDelay = 0;
        public static int  setPhysicalDelay = 0;
        public static int  moveNumber = 0;
        public static int intMovesLeft = 0;
        private boolean  buttonPressed = false;
        private double movesLeft = 0;
        private int windowState = 0;
        /** Creates new form HanoiFrame */
        public HanoiFrame() {
            initComponents();
            /* initialize the "poles" to hold a certain number of "cells */
            this.diskCells = new int[ROW][COLUMNS];
            for (int row = ROW - 1;row >= 0; row--) {
                for (int col = 0;col < COLUMNS ; col++) {
                    diskCells[row][col] = EMPTY_CELL_VALUE;
        private void resetButtonActionPerformed(java.awt.event.ActionEvent evt) {                                           
            /* reset all the variable to original state */
            setDiskAmount = 0;
            setAnimationDelay = 0;
            setPhysicalDelay = 0;
            moveNumber = 0;
            movesLeft = 0;
            intMovesLeft = 0;
            buttonPressed = false;
            windowState = 0;
            this.startButton.setEnabled(true);
            this.diskAmount.setEditable(true);
            this.animationDelay.setEditable(true);
            this.physicalDelay.setEditable(true);
            /* reset all the cell vales to empty (this could be its own function) */
            for (int row = ROW - 1;row >= 0; row--) {
                for (int col = 0;col < COLUMNS ; col++) {
                    diskCells[row][col] = EMPTY_CELL_VALUE;
            /* reset the content of the TextFields and Area */
            this.diskAmount.setText("");
            this.animationDelay.setText("");
            this.physicalDelay.setText("");
            this.outTextArea.setText("");
            /* repaint the display panel */
            this.hanoiPanel.repaint();
        /* i have no idea why this is here...It was generated by Netbeans when I
         *made the reset button.  As you can see it made 2.  The one above it the same
         *except it contains code.  Since it was automatically generated
         *I cannot delete it.
        private void resetButtonMouseReleased(java.awt.event.MouseEvent evt) {                                         
        /* is executed when the start button is pressed.
         *also executes a field check and intializes key variables. Finally,
         *it executes the solution and generates the solve time
        private void startButtonMouseReleased(java.awt.event.MouseEvent evt) {                                         
            /* check if the program has already been run (without being reset) */
            if (!buttonPressed){
                /* check the fields to ensure the input is correct and useable */
                if (checkFields()){
                    /* give button a pressed status if all info valid */
                    buttonPressed = true;
                    windowState = 1;
                    /* disable the button */
                    this.startButton.setEnabled(false);
                    /* disable the fields */
                    this.diskAmount.setEditable(false);
                    this.animationDelay.setEditable(false);
                    this.physicalDelay.setEditable(false);
                    /* setup the disks on the starting pole */
                    setup();
                    /* initialize the number of moves required. 2 to the power of n minus 1 */
                    movesLeft = Math.pow(2, setDiskAmount) - 1;
                    /* convert the number to an integer */
                    intMovesLeft = (int)movesLeft;
                    /* set the physical delay */
                    setPhysicalDelay = Integer.parseInt(this.physicalDelay.getText());
                    /* create and start a new thread.  This is EXTREMELY important
                     *as it allows for GUI to be repainted while the soulution
                     *is animated */
                    SolveEngine s = new SolveEngine();
                    s.start();               
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new HanoiFrame().setVisible(true);
        /*returns the Animation panel area graphics
         *@return Animation area graphics
        public static Graphics getAnimationArea(){
            /* get the usable area of poleA */
            Container clientArea = hanoiPanel;
            //Container clientArea = this.getContentPane();
            /* get the graphics to the display panel*/
            Graphics gfx = clientArea.getGraphics();
            return gfx;
         *set up the requested amount of disks on the first pole
         *@param diskAmount the amount of disks entered by the user
        public void setup(){
            int numberOfDisks = setDiskAmount;
            this.disks = new Disk[numberOfDisks];
            int diskNumber = 0;
            int diskWidth = POLE_AREA_WIDTH - 4;
            int arcH = DISK_ARC_HEIGHT;
            int arcW = DISK_ARC_WIDTH;
            int x = startX;
            int y = startY;
            int row = 0;
            int col = 0;
            /* get the graphics to the display panel*/
            //Graphics gfx = getAnimationArea();
            /* set the color of the disks */
            //gfx.setColor(Color.MAGENTA);
            /* draw the specified number of disks */
            while (diskNumber < numberOfDisks){
                /* reduce the y position */
                y = startY - diskNumber * CELL_HEIGHT;
                /* draw the disk */
                //gfx.fillRoundRect(x, y, diskWidth, DISK_HEIGHT, arcH, arcW);
                /* create a new instance of disk */
                newDisk = new Disk(x, y, diskWidth);
                /* give the new disk an id */
                this.disks[diskNumber] = newDisk;
                /* add the id to the cell array of poleA */
                this.diskCells[row][col] = diskNumber;
                /* make the disk smaller and center */
                x = x + 8;
                diskWidth = diskWidth - 16;
                /* increase disk number */
                diskNumber++;
                /* move to the next row */
                row++;
            repaint();
         *move the disk from a source pole to the destination pole.
         *this should take the source col and destination col to determine where to draw the
         *disk.  It will also need to know to draw the disk in the first available cell
         *in a col
         *@param source the starting pole of the next move
         *@param destination the end pole of the next move
        public void moveDisk(int src, int dest){
            /* the lines below would not be necessary if I were to pass the Graphics
             *gfx object as a parameter.  I may have to use this option in order
             *to work around the current repainting issue */
            /* get the graphics to the display panel*/
            Graphics gfx = getAnimationArea();
            /* get the id of the disk to be moved */
            int disk = getDiskId(src);
            /* get the to and from rows */
            int sourceRow = getRow(src);
            int destinationRow = getRow(dest);
            /* set the co ordintates of the destination */
            int col = dest * POLE_AREA_WIDTH;
            int x = disks[disk].getStartX() + col;
            int y = startY - (destinationRow * CELL_HEIGHT);
            int width = disks[disk].getDiskWidth();
            disks[disk].setStartX(x);
            disks[disk].setStartY(y);
            disks[disk].setDiskWidth(width);
            //System.out.println("startX " + x);
            //System.out.println("startY " + y);
            //System.out.println("destination row " + destinationRow);
            //System.out.println("disk " + disk);
            //System.out.println("Width " + width);
            diskCells[sourceRow - 1][src] = EMPTY_CELL_VALUE;
            /* set the destination row to the disk id */
            diskCells[destinationRow][dest] = disk;
            drawDisk();
            repaint();
        public void drawDisk(){
            int diskNum = setDiskAmount -1;
            int i = 0;
            Graphics gfx = getAnimationArea();
            gfx.setColor(Color.MAGENTA);
            while(diskNum >= 0){
                //System.out.println("here is the disk IDs " + diskNum);
                //System.out.println("the startY during draw " + disks[diskNum].getStartY());
                gfx.fillRoundRect(disks[diskNum].getStartX(), disks[diskNum].getStartY(), disks[diskNum].getDiskWidth(), DISK_HEIGHT, DISK_ARC_WIDTH, DISK_ARC_HEIGHT);
                diskNum--;
        public void paint(Graphics gfx){
            if(windowState == 0){
                super.paint(gfx);
                setup();
            } else if (windowState == 1){
                super.paint(gfx);
                drawDisk();
         *returns the id of the disk
         *@param col the the designated column
         *@return the disk identification number
        public static int getDiskId(int col){
            int diskIdent = 0;
            /* initialize the row number to max -1, because the array start at 0 */
            int row = MAX_DISKS - 1;
            /* do a cell check while row is greater than 0
             *this is done so that is starts at the top row
             *and moves down
            while (row > EMPTY_CELL_VALUE){
                /* when the first cell that is not -1 is reached get the disk number
                 *that disk will be the smallest in the stack */
                if(diskCells[row][col] != -1){
                    //diskIdent = this.diskCells[row][col];
                    diskIdent =diskCells[row][col];
                    break;
                row--;
            return diskIdent;
         *returns the first available row
         *@param col the designated col
         *@return the first available row number
        public static int getRow(int col){
            int rowNumber = 0;
            /* cycle through the cells until it finds an empty one */
            while (diskCells[rowNumber][col] != -1){
                rowNumber++;
            return rowNumber;
         *calculate the total time it takes for the tower of hanoi game to be
         *solved, given the amount of disk and the amount of time it takes
         *to physically move a disk from one pole to the other.
        public static void totalTime(){
            int timeInSeconds = setPhysicalDelay * intMovesLeft;
            int i = 0;
            int seconds = 0;
            int minute = 0;
            int hour = 0;
            int day = 0;
            int month = 0;
            int year = 0;
            while (i < timeInSeconds){
                if(seconds > 60){
                    minute++;
                    seconds = 0;
                if(minute > 60){
                    hour++;
                    minute = 0;
                if(hour > 24){
                    day++;
                    hour = 0;
                if(day > 30){
                    month++;
                    day = 0;
                if(month > 12){
                    year++;
                    month = 0;
                seconds++;
                i++;
            updateMessageCenter("It would take:" + year + " years " + month + " months " + day +
                    " days " + hour + " hours " + minute + " minutes and " + seconds + " seconds, to move " + setDiskAmount +
                    " disks at " + setPhysicalDelay + " seconds per move");
       

    Sorry if my post was a little too cryptic...
    "How do you know? You have a problem you can't solve. Anything could be your issue." Agreed. However, using the process of elimination and debug statments I have been able to narrow the scope of the issue.
    "If you can't solve it by executing the code and adding debug statements how to you expect us to help."If I could solve but "executing code and adding debug statements" there would be no need to post the problem here.
    "We don't know exactly what you are attempting to do."Trying to paint my graphics to a JPanel based on a set of co ordinates.
    "We don't know why you are passing the Graphics object around."Why not? is it impossible to do it this way?
    "The big problem is in the alogorithm you use to determine the location of each component."Who said you couldn't read minds?
    "If you are using some kind of animation then I would use a Timer to schedule the moving of components. I don't even see how you are doing this in your code."Sorry I guess stating that I didn't post my entire code may have threw things off...I do use a timer in a seperate class. I will include it in the next post.
    "I can't tell if you are using Threads of not."guess you overlooked these lines of code:
                    /* create and start a new thread.  This is EXTREMELY important
                     *as it allows for GUI to be repainted while the soulution
                     *is animated */
                    SolveEngine s = new SolveEngine();
                    s.start();   Here is the code once again:
    public class HanoiFrame extends javax.swing.JFrame {
        private static final int STATE_SETUP = 0;
        private static final int STATE_ANIMATE = 1;
        private static final int POLE_AREA_HEIGHT = 356;
        private static final int POLE_AREA_WIDTH = 205;
        private static final int DISK_ARC_HEIGHT = 15;
        private static final int DISK_ARC_WIDTH = 15;
        private static final int DISK_HEIGHT = 23;
        private static final int MAX_DISKS = 10;
        private static final int MAX_ANIMATION_DELAY = 30000;
        private static final int MAX_PHYSICAL_DELAY = 100000;
        private static final int MIN_DISKS = 1;
        private static final int MIN_ANIMATION_DELAY = 1;
        private static final int MIN_PHYSICAL_DELAY = 1;
        private static final int EMPTY_CELL_VALUE = -1;
        private static final int CELL_HEIGHT = 25;
        private static final int COLUMNS = 3;
        private static final int ROW = 11;
        private  static final int MILLISECONDS_PER_SECOND = 1000;
        private final static String newline = "\n";
        private static Disk[] disks;
        private static Disk newDisk;
        private static int[][] diskCells;
        public static  int startX = 2;
        public static  int startY = 340;
        public static int setDiskAmount = 0;
        public static int setAnimationDelay = 0;
        public static int  setPhysicalDelay = 0;
        public static int  moveNumber = 0;
        public static int intMovesLeft = 0;
        private boolean  buttonPressed = false;
        private double movesLeft = 0;
        private int windowState = 0;
        /** Creates new form HanoiFrame */
        public HanoiFrame() {
            initComponents();
            /* initialize the "poles" to hold a certain number of "cells */
            this.diskCells = new int[ROW][COLUMNS];
            for (int row = ROW - 1;row >= 0; row--) {
                for (int col = 0;col < COLUMNS ; col++) {
                    diskCells[row][col] = EMPTY_CELL_VALUE;
        private void resetButtonActionPerformed(java.awt.event.ActionEvent evt) {                                           
            /* reset all the variable to original state */
            setDiskAmount = 0;
            setAnimationDelay = 0;
            setPhysicalDelay = 0;
            moveNumber = 0;
            movesLeft = 0;
            intMovesLeft = 0;
            buttonPressed = false;
            windowState = 0;
            this.startButton.setEnabled(true);
            this.diskAmount.setEditable(true);
            this.animationDelay.setEditable(true);
            this.physicalDelay.setEditable(true);
            /* reset all the cell vales to empty (this could be its own function) */
            for (int row = ROW - 1;row >= 0; row--) {
                for (int col = 0;col < COLUMNS ; col++) {
                    diskCells[row][col] = EMPTY_CELL_VALUE;
            /* reset the content of the TextFields and Area */
            this.diskAmount.setText("");
            this.animationDelay.setText("");
            this.physicalDelay.setText("");
            this.outTextArea.setText("");
            /* repaint the display panel */
            this.hanoiPanel.repaint();
        /* i have no idea why this is here...It was generated by Netbeans when I
         *made the reset button.  As you can see it made 2.  The one above it the same
         *except it contains code.  Since it was automatically generated
         *I cannot delete it.
        private void resetButtonMouseReleased(java.awt.event.MouseEvent evt) {                                         
        /* is executed when the start button is pressed.
         *also executes a field check and intializes key variables. Finally,
         *it executes the solution and generates the solve time
        private void startButtonMouseReleased(java.awt.event.MouseEvent evt) {                                         
            /* check if the program has already been run (without being reset) */
            if (!buttonPressed){
                /* check the fields to ensure the input is correct and useable */
                if (checkFields()){
                    /* give button a pressed status if all info valid */
                    buttonPressed = true;
                    windowState = 1;
                    /* disable the button */
                    this.startButton.setEnabled(false);
                    /* disable the fields */
                    this.diskAmount.setEditable(false);
                    this.animationDelay.setEditable(false);
                    this.physicalDelay.setEditable(false);
                    /* setup the disks on the starting pole */
                    setup();
                    /* initialize the number of moves required. 2 to the power of n minus 1 */
                    movesLeft = Math.pow(2, setDiskAmount) - 1;
                    /* convert the number to an integer */
                    intMovesLeft = (int)movesLeft;
                    /* set the physical delay */
                    setPhysicalDelay = Integer.parseInt(this.physicalDelay.getText());
                    /* create and start a new thread.  This is EXTREMELY important
                     *as it allows for GUI to be repainted while the soulution
                     *is animated */
                    SolveEngine s = new SolveEngine();
                    s.start();
         *Check all the fields at once to ensure that they are valid
        private boolean checkFields(){
            String numberOfDisks = null;
            String animationDelay = null;
            String physicalDelay = null;
            numberOfDisks = this.diskAmount.getText();
            animationDelay = this.animationDelay.getText();
            physicalDelay = this.physicalDelay.getText();
            /* initiate my array of error messages */
            ArrayList errMsg = new ArrayList(0);
            /* check if the number of disks was left blank */
            if (numberOfDisks.equals("")){
                errMsg.add("Please enter the Number of Disks (MAX " + MAX_DISKS + ")");
            }else{
                /* check if the input given is valid */
                try {
                    /* parse the disk amount entered into an integer */
                    setDiskAmount = Integer.parseInt(numberOfDisks);
                    /* check the # of disks entered is greater than 0 and less than 10 */
                    if (setDiskAmount < MIN_DISKS){
                        errMsg.add("Number of Disks must be greater than " + MIN_DISKS);
                    } else if (setDiskAmount > MAX_DISKS){
                        errMsg.add("Number of Disks must be less than" + MAX_DISKS);
                } catch (NumberFormatException ex) {
                    errMsg.add("Number of Disks must be a Number");
            /* check if animation delay was left blank */
            if (animationDelay.equals("")){
                errMsg.add("Please enter disk Animation Delay");
            } else {
                /* check if the input given is valid */
                try {
                    /* parse the animation delay entered into an integer */
                    setAnimationDelay = Integer.parseInt(animationDelay);
                    /* check range of animation delay */
                    if (setAnimationDelay < MIN_ANIMATION_DELAY){
                        errMsg.add("Animation Delay must be greater than 0");
                    } else if (setAnimationDelay > MAX_ANIMATION_DELAY){
                        errMsg.add("Animation Delay must be less than " + MAX_ANIMATION_DELAY);
                } catch (NumberFormatException ex) {
                    errMsg.add("Animation Delay must be a Number");
            /* check if physical delay was left blank */
            if (physicalDelay.equals("")){
                errMsg.add("Please enter the Physical disk delay");
            } else {
                /* check if the input given is valid */
                try {
                    /* parse the physical delay entered into an integer */
                    setPhysicalDelay = Integer.parseInt(physicalDelay);
                    /* check check the range of the physical delay */
                    if (setPhysicalDelay < MIN_PHYSICAL_DELAY){
                        errMsg.add("Physical Delay must be greater than 0");
                    } else if (setPhysicalDelay > MAX_PHYSICAL_DELAY){
                        errMsg.add("Physical Delay must be less than " + MAX_PHYSICAL_DELAY);
                } catch (NumberFormatException ex) {
                    errMsg.add("Physical Delay must be a Number");
            /* if there is any problem, add the message to the popup and display */
            if (!errMsg.isEmpty()){
                JOptionPane.showMessageDialog(this, errMsg.toArray());
                return false;
            return true;
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new HanoiFrame().setVisible(true);
        /*returns the Animation panel area graphics
         *@return Animation area graphics
        public static Graphics getAnimationArea(){
            /* get the usable area of poleA */
            Container clientArea = hanoiPanel;
            //Container clientArea = this.getContentPane();
            /* get the graphics to the display panel*/
            Graphics gfx = clientArea.getGraphics();
            return gfx;
         *set up the requested amount of disks on the first pole
         *@param diskAmount the amount of disks entered by the user
        public void setup(){
            int numberOfDisks = setDiskAmount;
            this.disks = new Disk[numberOfDisks];
            int diskNumber = 0;
            int diskWidth = POLE_AREA_WIDTH - 4;
            int arcH = DISK_ARC_HEIGHT;
            int arcW = DISK_ARC_WIDTH;
            int x = startX;
            int y = startY;
            int row = 0;
            int col = 0;
            /* get the graphics to the display panel*/
            //Graphics gfx = getAnimationArea();
            /* set the color of the disks */
            //gfx.setColor(Color.MAGENTA);
            /* draw the specified number of disks */
            while (diskNumber < numberOfDisks){
                /* reduce the y position */
                y = startY - diskNumber * CELL_HEIGHT;
                /* draw the disk */
                //gfx.fillRoundRect(x, y, diskWidth, DISK_HEIGHT, arcH, arcW);
                /* create a new instance of disk */
                newDisk = new Disk(x, y, diskWidth);
                /* give the new disk an id */
                this.disks[diskNumber] = newDisk;
                /* add the id to the cell array of poleA */
                this.diskCells[row][col] = diskNumber;
                /* make the disk smaller and center */
                x = x + 8;
                diskWidth = diskWidth - 16;
                /* increase disk number */
                diskNumber++;
                /* move to the next row */
                row++;
            repaint();
         *move the disk from a source pole to the destination pole.
         *this should take the source col and destination col to determine where to draw the
         *disk.  It will also need to know to draw the disk in the first available cell
         *in a col
         *@param source the starting pole of the next move
         *@param destination the end pole of the next move
        public void moveDisk(int src, int dest){
            /* the lines below would not be necessary if I were to pass the Graphics
             *gfx object as a parameter.  I may have to use this option in order
             *to work around the current repainting issue */
            /* get the graphics to the display panel*/
            Graphics gfx = getAnimationArea();
            /* get the id of the disk to be moved */
            int disk = getDiskId(src);
            /* get the to and from rows */
            int sourceRow = getRow(src);
            int destinationRow = getRow(dest);
            /* set the co ordintates of the destination */
            int col = dest * POLE_AREA_WIDTH;
            int x = disks[disk].getStartX() + col;
            int y = startY - (destinationRow * CELL_HEIGHT);
            int width = disks[disk].getDiskWidth();
            disks[disk].setStartX(x);
            disks[disk].setStartY(y);
            disks[disk].setDiskWidth(width);
            //System.out.println("startX " + x);
            //System.out.println("startY " + y);
            //System.out.println("destination row " + destinationRow);
            //System.out.println("disk " + disk);
            //System.out.println("Width " + width);
            diskCells[sourceRow - 1][src] = EMPTY_CELL_VALUE;
            /* set the destination row to the disk id */
            diskCells[destinationRow][dest] = disk;
            drawDisk();
            repaint();
            String output = "";
            //must initialize row to max - 1 and increment 'til = 0
            //since the array position starts at 0
            //this will print the array from the top down
            for (int row = ROW - 1;row >= 0; row--) {
                for (int colm = 0;colm < COLUMNS ; colm++) {
                    output = output + diskCells[row][colm];
                output = output + "\n";
            System.out.println(output);
            System.out.println(newline);
        public void drawDisk(){
            int diskNum = setDiskAmount -1;
            int i = 0;
            Graphics gfx = getAnimationArea();
            gfx.setColor(Color.MAGENTA);
            while(diskNum >= 0){
                //System.out.println("here is the disk IDs " + diskNum);
                //System.out.println("the startY during draw " + disks[diskNum].getStartY());
                gfx.fillRoundRect(disks[diskNum].getStartX(), disks[diskNum].getStartY(), disks[diskNum].getDiskWidth(), DISK_HEIGHT, DISK_ARC_WIDTH, DISK_ARC_HEIGHT);
                diskNum--;
        public void paint(Graphics gfx){
            if(windowState == 0){
                super.paint(gfx);
                setup();
            } else if (windowState == 1){
                super.paint(gfx);
                drawDisk();
         *returns the id of the disk
         *@param col the the designated column
         *@return the disk identification number
        public static int getDiskId(int col){
            int diskIdent = 0;
            /* initialize the row number to max -1, because the array start at 0 */
            int row = MAX_DISKS - 1;
            /* do a cell check while row is greater than 0
             *this is done so that is starts at the top row
             *and moves down
            while (row > EMPTY_CELL_VALUE){
                /* when the first cell that is not -1 is reached get the disk number
                 *that disk will be the smallest in the stack */
                if(diskCells[row][col] != -1){
                    //diskIdent = this.diskCells[row][col];
                    diskIdent =diskCells[row][col];
                    break;
                row--;
            return diskIdent;
         *returns the first available row
         *@param col the designated col
         *@return the first available row number
        public static int getRow(int col){
            int rowNumber = 0;
            /* cycle through the cells until it finds an empty one */
            while (diskCells[rowNumber][col] != -1){
                rowNumber++;
            return rowNumber;
         *calculate the total time it takes for the tower of hanoi game to be
         *solved, given the amount of disk and the amount of time it takes
         *to physically move a disk from one pole to the other.
        public static void totalTime(){
            int timeInSeconds = setPhysicalDelay * intMovesLeft;
            int i = 0;
            int seconds = 0;
            int minute = 0;
            int hour = 0;
            int day = 0;
            int month = 0;
            int year = 0;
            while (i < timeInSeconds){
                if(seconds > 60){
                    minute++;
                    seconds = 0;
                if(minute > 60){
                    hour++;
                    minute = 0;
                if(hour > 24){
                    day++;
                    hour = 0;
                if(day > 30){
                    month++;
                    day = 0;
                if(month > 12){
                    year++;
                    month = 0;
                seconds++;
                i++;
            updateMessageCenter("It would take:" + year + " years " + month + " months " + day +
                    " days " + hour + " hours " + minute + " minutes and " + seconds + " seconds, to move " + setDiskAmount +
                    " disks at " + setPhysicalDelay + " seconds per move");
         *add the message to the diplay window
         *currently this is not necessary, but may be required to
         *dynamically display the contents of message into the text area
         *@param message the message to be added/appended the the text area
        public static void updateMessageCenter(String message){
            /* append text to the message */
            outTextArea.append(message + newline);
            /* ensure the the most recent line is viewable - auto scroll */
            outTextArea.setCaretPosition(outTextArea.getDocument().getLength());
        public class SolveEngine extends Thread {
            /** Creates a new instance of SolveEngine */
            public SolveEngine() {
            public void run(){
                /* start the engine/animation */
                solutionEngine(HanoiFrame.setDiskAmount,0, 2, 1);
                /* calculate and print the total time after the solution is complete */
                HanoiFrame.totalTime();
         *the recursive solution to the Towers of Hanoi problem
         *@param diskAmount the number of disks that need to be moved
         *@param start the identity of the starting column
         *@param end the identity of the ending column
         *@param temp the identity of the temporary column
            public void solutionEngine(int diskAmount,int start, int end, int temp){
                int disks = diskAmount;
                int startPole = start;
                int endPole = end;
                int tempPole = temp;
                try {
                    if ( disks == 1 ) {
                        HanoiFrame.moveNumber++;
                        HanoiFrame.updateMessageCenter("Moving disk from  "+ startPole + " to "+ endPole + " Move #: " + HanoiFrame.moveNumber + " of " + HanoiFrame.intMovesLeft);
                        /* delay the movement of the disk */
                        Thread.sleep(HanoiFrame.setAnimationDelay);
                        /* move the disk */
                        moveDisk(startPole, endPole);
                    } else {
                        solutionEngine( disks - 1, startPole, tempPole, endPole);
                        HanoiFrame.moveNumber++;
                        HanoiFrame.updateMessageCenter("Moving disk from  "+ startPole + " to "+ endPole + " Move #: " + HanoiFrame.moveNumber + " of " + HanoiFrame.intMovesLeft);
                        /* delay the movement of the disk */
                        Thread.sleep(HanoiFrame.setAnimationDelay);
                        moveDisk(startPole, endPole);
                        solutionEngine( disks - 1, tempPole, endPole, startPole);
                } catch (InterruptedException ex) {
                    ex.printStackTrace();
        }

  • Need help with connecting file inputs to arrays

    In this assignment I have a program that will do the following: display a list of names inputed by the user in reverse order, display any names that begin with M or m, and display any names with 5 or more letters. This is all done with arrays.
    That was the fun part. The next part requires me to take the names from a Notepad file, them through the arrays and then output them to a second Notepad file.
    Here is the original program: (view in full screen so that the code doesn't get jumbled)
    import java.io.*;       //Imports the Java library
    class progB                    //Defines class
        public static void main (String[] arguments) throws IOException
            BufferedReader keyboard;                                  //<-
            InputStreamReader reader;                                 //  Allows the program to
            reader = new InputStreamReader (System.in);               //  read the the keyboard
            keyboard = new BufferedReader (reader);                  //<-
            String name;                 //Assigns the name variable which will be parsed into...
            int newnames;               //...the integer variable for the amount of names.
            int order = 0;              //The integer variable that will be used to set the array size
            String[] array;             //Dynamic array (empty)
            System.out.println (" How many names do you want to input?");   //This will get the number that will later define the array
            name = keyboard.readLine ();
            newnames = Integer.parseInt (name);                                         // Converts the String into the Integer variable
            array = new String [newnames];                                               //This defines the size of the array
            DataInput Imp = new DataInputStream (System.in);       //Allows data to be input into the array
            String temp;                                       
            int length;                                                                  //Defines the length of the array for a loop later on
                for (order = 0 ; order < newnames ; order++)                                //<-
                {                                                                           //  Takes the inputed names and
                    System.out.println (" Please input name ");                            //  gives them a number according to
                    temp = keyboard.readLine ();                                           //  the order they were inputed in
                    array [order] = temp;                                                  //<-
                for (order = newnames - 1 ; order >= 0 ; order--)                                //<-
                {                                                                                //  Outputs the names in the reverse 
                    System.out.print (" \n ");                                                   //  order that they were inputed
                    System.out.println (" Name " + order + " is " + array [order]);             //<-
                for (order = 0 ; order < newnames ; order++)                                  //<-
                    if (array [order].startsWith ("M") || array [order].startsWith ("m"))     //  Finds and outputs any and all
                    {                                                                         //  names that begin with M or m
                        System.out.print (" \n ");                                            //
                        System.out.println (array [order] + (" starts with M or m"));         //
                    }                                                                         //<-
                for (order = 0 ; order < newnames ; order++)                                            //<-
                    length = array [order].length ();                                                   //
                    if (length >= 5)                                                                    //  Finds and outputs names
                    {                                                                                  //  with 5 or more letters
                        System.out.print (" \n ");                                                      //
                        System.out.println ("Name " + array [order] + " have 5 or more letters ");      //<-
    }The notepad file contains the following names:
    jim
    laruie
    tim
    timothy
    manny
    joseph
    matty
    amanda
    I have tried various methods but the one thing that really gets me is the fact that i can't find a way to connect the names to the arrays. Opening the file with FileInputStream is easy enough but using the names and then outputing them is quite hard. (unless i'm thinking too hard and there really is a simple method)

    By "connect", do you just mean you want to put the names into an array?
    array[0] = "jim"
    array[1] = "laruie"
    and so on?
    That shouldn't be difficult at all, provided you know how to open a file for reading, and how to read a line of text from it. You can just read the line of text, put it in the array position you want, until the file is exhausted. Then open a file for writing, loop through the array, and write a line.
    What part of all that do you need help with?

  • Populating an array of objects with a loop. Noob PHP question.

    Hey guys,
       You are all such a great help! Here is another one for you, the simple code below should create an array of pizza objects (and it does) then display each object in order. However... for some reason each object in the array seems to inherit the properties of whatever the last object entered was.
    This code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <?php
    class pizza{
              public $price;
              public $description;
              public $name;
    $menu2=fopen("pizzaMenu2.txt","r") or exit("System Error!");
    $pizzas = array();
    $arraypos=0;
    //This loop does all of the READING and populating of variables
    while(!feof($menu2))
                //First get the array position
                                  $arraypos = (int)fgets($menu2);
              //Then Put in Title in title2 array
                                  $pizzas[$arraypos2] = new pizza(0,0,0);
                                  $pizzas[$arraypos2]->title = fgets($menu2);
                                  $pizzas[$arraypos2]->description = fgets($menu2);
                                  $pizzas[$arraypos2]->price = fgets($menu2);
      } //End of reading loop
    //begin writing data
    $arraypos=1;
    while ($arraypos <=3){
              echo "the array is in position: ".$arraypos;
              echo "<br />";
              echo $pizzas[$arraypos2]->title;
              echo "<br />";
              echo $pizzas[$arraypos2]->description;
              echo "<br />";
              echo $pizzas[$arraypos2]->price;
              echo "<br />";
              $arraypos++;
    }//end of writing data loop
    fclose($menu2);
    ?>
    <body>
    </body>
    </html>
    returns this:
    the array is in position: 1
    Test Pizza Two
    The same as one with an extra one, yum!
    22.99
    the array is in position: 2
    Test Pizza Two
    The same as one with an extra one, yum!
    22.99
    the array is in position: 3
    Test Pizza Two
    The same as one with an extra one, yum!
    22.99
    when it should return this:
    the array is in position: 1
    Test pizza One
    Loaded with all that test pizza goodness! Lots and lots of ones 1111!
    11.99
    the array is in position: 2
    Test Pizza Two
    The same as one with an extra one, yum!
    22.99
    the array is in position: 3
    Test Threeza!
    Do you see what I did there? I added a three to pizza, hahaha, I am so punny.
    33.33
    using the following text file pizzaMenu2.txt:
    1
    Test pizza One
    Loaded with all that test pizza goodness! Lots and lots of ones 1111!
    11.99
    3
    Test Threeza!
    Do you see what I did there? I added a three to pizza, hahaha, I am so punny.
    33.33
    2
    Test Pizza Two
    The same as one with an extra one, yum!
    22.99
    Now, I have done line by line testing and shown that the values are being entered into the proper objects in the proper array, but whatever goes in last overwrites all of the other objects, so in the end I have 3 objects in my array that are all the same. I am not sure what I am missing here.

    Christ-Guard wrote:
    Thanks! I majored in computer science
    That helps enormously.
    Christ-Guard wrote:
    Also, I have never worked a CS job before and I've been out of school for 8 years, so I am better at remembering "This should work" then I am at "This is how I write this code".
    If you have a good idea something should work, based on theory, then that's half the battle.
    Its having no knowledge if something will work or not when it becomes a problem.

  • Problem: check random array with a static value

    My goal is to use the random number generator to put numbers into randomArray, then do a linear search to try to find if the number 5 has been generatated. Next print out where in the array the value can be found. I have no compile errors but I have a logical or syntax problem, any help would be great.
    public class test {
         int j;
         int target = 5;
         public static void main(String [] args) {
              int i;
              int[] randomArray = new int[20];
              for(i=0; i<randomArray.length; i++) {
                   randomArray[i] = (int)(Math.floor(Math.random() * (10.0 - 0.0)) + 0.0);
              test n = new test();
              n.display();
         public int arraySearch(int[] randomArray, int target) {
              for (j=0; j<randomArray.length; j++) {
                   if (randomArray[j] == target) {
                        return j;
              return -1;
         public void setArraySearch(int j) {
              j = j;
         int p;
         public void setArrayValues(int[] randomArray) {
              for (int k=0; k<randomArray.length; k++) {
                   p = randomArray[k];
         public void display() {
              System.out.println("Five is found in array position " + j);
              System.out.println(p);
    }

    Hi,
    That's correct. You need to call the other methods just as you call display, but you do also have some other minor problems. You have written some methods that aren't needed, and they do nothing. This might help you:
    public class test {
         public static void main(String [] args) {
              int i;
              int[] randomArray = new int[20];
              for(i=0; i<randomArray.length; i++) {
                   randomArray[i] = (int)(Math.floor(Math.random() * (10.0 - 0.0)) + 0.0);
              test n = new test();
              int indexFound = n.arraySearch(randomArray, 5);                
              n.display(indexFound );
         public int arraySearch(int[] randomArray, int target) {
              for (j=0; j<randomArray.length; j++) {
                   if (randomArray[j] == target) {
                        return j;
              return -1;
         public void display(int indexFound) {
              System.out.println("Five is found in array position " + indexFound);
    } /Kaj

  • Plotting xyz Coordinate​s on 3D Graph Help

    Hi,
    I have an array (max size 10) of xyz coordinates which i want to plot on a 3D graph.
    These 10 points are constantly moving (data from a Leap Motion hand tracker)
    I have attached a screen shot of simple VI and example data
    How would i go about gaphing this?

    Hi coqwas,
    That's a pretty interesting project you have there.
    I guess there is 2 types of 3D graph which you can find (use quick drop if you have to): 3D Line Graph and Active X 3D Curve Graph. You can find some examples on 3D graphs in NI Example Finder as well (Open LabVIEW >> Help >> Find Examples... >> Search key word "3D graph").
    Since it is a 3D array, can you tell me the array size for X, Y and Z (e.g. X size by Y size by Z size)? What does the row and column represents in the XYZ array shown inyour screenshot? 
    To use the 3D Line Graph.vi, you'll need to provide a 1D array of X vector, Y vector and Z vector. So you need to extract the values from that XYZ 3D array to those vectors respectively. You can extract the Z layers using Array Subset and Reshape array. Since I'm not really sure which part of the array (X, Y or Z) represents the finger no., you'll need to separate each array by individual fingers. Each XYZ array for each finger is fed to each create_plot_line.vi (4 fingers meaning 4 create_plot_line.vi) just as shown below:
    You can see there is a number from 0-3 at the create_plot_line.vi. Those are the plot ID (0 means plot 0 and 1 means plot 1). What I am trying to do above is that I'm ploting 4 plots in 1 3D graph. 
    The plot ID is specified by going to the front panel >> Right click on the 3D Line Graph >> select 3D Graph Properties >> go to Plots tab >> on the left column called Plots, add as many plots you want to plot into the 3D graph. 
    Additional info:
    http://zone.ni.com/reference/en-XX/help/371361H-01​/lvhowto/plotting_3d_graphs/
    http://www.ni.com/white-paper/9388/en/
    Warmest regards,
    Lennard.C
    Learning new things everyday...

  • Loading Array?

    I have found a script that allows me to create a scrolling
    photo gallery for my site. The actionscript code that you modify
    yourself has an array and you can just change the names of the
    pictures to match your own to pull pictures into the movie. The
    array is the picture names enclosed in quotation marks and
    separated by commas.
    I would love to load this info dynamically. I have a php page
    that pulls all the pictures in a directory and publishes those.
    http://www.stacybuckley.com/vars/pics.php
    There are various ways (maybe not the best) that I can import
    this data into flash but the quotation marks come out encoded and I
    can't seem to "un*escape" them.
    I could leave the quotation marks out of my php page, but
    then when I reference the array position it doesn't see it as a
    string and the script doesn't work.

    i don't see the loading method for the php doc in this code -
    however you should be able to leave out the quotes and they should
    come in as a string. If you are trying to pass this as an array,
    that may also be part of the problem. you'd need to pass it as a
    concatenated string and then use split at the commas on loading and
    push them into the array, then they should come in as
    strings.

Maybe you are looking for