Need Help! 3D probing to create point cloud. - Page 2


Page 2 of 2 FirstFirst 12
Results 13 to 16 of 16

Thread: 3D probing to create point cloud.

  1. #13
    Registered
    Join Date
    Jun 2004
    Location
    Scotland
    Posts
    312
    Downloads
    0
    Uploads
    0

    Default Re: 3D probing to create point cloud.

    I've imported point clouds to Solidworks and Fusion360 in the past, however they were in DXF format.

    I've not done any for a while and certainly not since I've moved to F360, but my workflow used to be export/import the point cloud DXF from Mach3/Probe-It wizard into Solidworks to tidy up the cloud and create a drawing/model, then export/import a STL/Step to CamBam.
    But without the initial DXF file, I think Tom's suggestion of MeshLab is probably worth a shot first.



  2. #14
    Registered
    Join Date
    Oct 2008
    Location
    USA
    Posts
    39
    Downloads
    0
    Uploads
    0

    Default Re: 3D probing to create point cloud.

    Here is what I have so far.

    Attachment 394292Attachment 3942923D probing to create point cloud.-lofted-points-jpeg

    This is a test scan of a section of a motorcycle gas tank.
    After scanning the txt file is opened in Excel for conversion the the points are imported into inventor.
    One picture shows the lines created by the points the other is after lofting a surface.

    This the C program so far:

    #include "KMotionDef.h"

    // New Probe Direction Rev. 1
    // Completed 5/13/2018
    // For basic KMotionCNC Probing configure KMotionCNC to call this C Program
    // with an MCode and 3 parameters P Q R passed in variables 50,51,52 to
    // specify the Xmax Ymax Z depth.
    //
    // Modify this program for the input bit you are using for your probe. As
    // written the program keeps moving until the bit goes high. If the polarity
    // of your probe is opposite of this then remove the NOT Symbol '!' applied to the
    // ReadBit result.
    //
    // For Example:
    // M100 P2 Q2 R2
    // M100 = Exec/Wat/Sync Thread 2 Var 50 <>\C programs\NewProbeDirection.c
    // Move to X and Y starting point currenly hard coded within probing program.
    // Then to probe in the y (Q) direction at .5mm steps
    // Z moves toward Zmax depth, if probe is trigger then the three points are save to file
    // Z returns to starting position and Y increments .5mm
    // at the end of the Y for loop Y returns to start point and X icrements .5mm
    // This is repeated untill X and Y both reach max.
    //
    // PlANED UPDATES:
    //
    // Move to fixture Offset for starting point.
    //
    // Modify R parmameter to be uesd for changing probing resolution.
    //
    // Develop smoother probe pattern with use of Uni-direction(6 Ball) Probe.
    //
    //
    #define TMP 10 // which spare persist to use to transfer data
    #include "KflopToKMotionCNCFunctions.c"
    #define Zaxis 2
    #define Xaxis 0
    #define Yaxis 1
    #define StepsPerMM 410 // CNTS to move X or Y axis 1.0mm
    #define XaxisIndex_mm 205 // CNTS to move Xaxis 0.5mm
    #define YaxisIndex_mm 205 // CNTS to move Yaxis 0.5mm
    #define ToolProbePin 1055
    #define ToolProbeX 10413 // X START POSITION OF PROBE
    #define ToolProbeY 10000 // Y START POSITION OF PROBE 20500
    #define PlusZaxisIndex_mm 820.00 // CNTS to move Probe 0.5mm up
    #define MinusZaxisIndex_mm 328.00 // CNTS to move Probe 0.2mm Down
    #define ZaxisIndex_mm 1640 // CNTS to move Zaxis 1.0mm
    #define Xmax persist.UserData[50] //Set to X max BY M100 Q FOR X AXIS
    #define Ymax persist.UserData[51] //Set to Y max BY M100 P FOR Y AXIS
    #define Zmax persist.UserData[52] //Set to Z max BY M100 R FOR Z AXIS
    #define Zmin

    int DoPC(int cmd);
    int DoPCFloat(int cmd, float f);
    int DoPCInt(int cmd, int i);
    int MsgBox(char *s, int Flags);
    int SetVars(int poff, int varoff, int n);
    int GetVars(int varoff, int n, int poff);
    int GetToolLength(int index, double *Length);
    int SaveZLimits; //place to save limit switch settings
    double P0,P1,P2;

    main()
    {
    int i,x,y,step,Xloop,Yloop;
    float Zpos,Xneg,Yneg,P0,P1,P2; //Xmax,Ymax,Zmax;
    ///////////////////////////////////////////////////////
    float XMAX = *(float *)&persist.UserData[50]*StepsPerMM; //XMAX BY M100 Q FOR X AXIS,Checked and corrected User data OK 5/6/2018
    float YMAX = *(float *)&persist.UserData[51]*StepsPerMM; //YMAX BY M100 P FOR Y AXIS, Checked and corrected User data OK 5/6/2018
    float ZMAX = *(float *)&persist.UserData[52]*ZaxisIndex_mm; //ZMAX BY M100 R FOR Z AXIS, Checked OK 5/4/2018
    //
    Zpos = ch2->Dest;
    //
    //
    FILE *f=fopen("C:\\temp\\kflopdata.txt","wt");

    //Calculate number of Loop for X and Y

    //Xloop = (XMAX / XaxisIndex_mm); //convert to the number of Xloops for 0.5mm steps in X, Checked and corrected formula OK 5/6/2018
    //Yloop = (YMAX / YaxisIndex_mm); //convert to the number of Yloops fro 0.5mm steps in Y, Checked and corrected formula OK 5/6/2018
    Xloop = (XMAX / (StepsPerMM*5)); //convert to the number of Xloops for 1.00mm steps in X, Checked OK 5/28/2018
    Yloop = (YMAX / (StepsPerMM*5));//convert to the number of Yloops fro 1.00mm steps in Y, Checked OK 5/28/2018

    SetBitDirection(1055,1); // Tool Probe input - SetBitDirection( ToolProbePin ,0) SetBitDirection(1055,1);

    // Move probe to starting position and zero DRO for Axis 0,1

    MoveAtVel(Xaxis,ToolProbeX,25000); // X Axis Probe start position
    MoveAtVel(Yaxis,ToolProbeY,25000); // Y Axis Probe start position
    while (ch0->Dest != ToolProbeX) ; // CHECK CONDITION!!!!
    while (ch1->Dest != ToolProbeY) ; // CHECK CONDITION!!!!
    Delay_sec(0.5);
    Zero(0); // Zero X axis position
    Zero(1); // Zero Y axis position

    // stores the current position as the start of the data gather line

    Xneg = ch0->Dest;
    Yneg = ch1->Dest;
    Zpos = ch2->Dest;

    // Print the start position

    fprintf(f,"%8.3f,%8.3f,%8.3f\n",(ch0->Dest),(ch1->Dest),(ch2->Dest)); // Test print to file 5/8/2018 OK
    fprintf(f,"\n");

    //Start of Nested for loop
    int x=0;
    for(x=0; x<Xloop+1; x++) // 1st for Loop, loop however many Xloops make the increment and start probe at new X position
    {

    int y=0;
    for(y=0; y<Yloop+1; y++) // 2nd for Loop (for Loop int. Condition; Increment) however many Yloops make the increment and start probe at new Y position, Checked and corrected Loop OK 5/6/2018
    { // Start of Code Block
    MoveAtVel(2,-ZMAX,8000); // y<Yloop=True. Move the z axis to the lower position at a low speed
    //5/4/2018 float ZMAX = *(float *)&persist.UserData[52]*ZaxisIndex_mm; checked OK

    while(!CheckDone(2) && !ReadBit(1055)); // check for either probe contact or the end of the move !ReadBit(1055)

    Jog(2,0.0); // stops the movement on the Z axis
    P0 = ch0->Dest; // stores the current position as the start of the data gather line
    P1 = ch1->Dest;

    if (ReadBit(1055)) // only save the position if the probe was triggered
    { // 5/13/2018 now prints to file (!ReadBit(1055) removed !(Not) from Readbit
    P2=ch2->Dest;
    fprintf(f,"%8.3f,%8.3f,%8.3f\n",(P0/StepsPerMM),(P1/StepsPerMM),(P2/ZaxisIndex_mm)); // write the three axis coordinates to file with commas (ch0->Dest/StepsPerMM),(ch1->Dest/StepsPerMM),(ch2->Dest/ZaxisIndex_mm))
    }
    Delay_sec(.1); // Delay .1 seconds
    Move(2,Zpos); // raise the Z axis to the upper position

    while (!CheckDone(2)); // Check if motion is complete

    //MoveAtVel(1,(y+1) * YaxisIndex_mm,2000); // move to the next position 5/5/2018 added + (y + 1) * now moves to next Y position Yneg +, removed Yneg from formula 5/6/2018
    MoveAtVel(1,(y+1) * (StepsPerMM*5),2000); // Added to make next position 5mm 5/28/18
    while (!CheckDone(1)) ; // Original line "while (!CheckDone(0) && !CheckDone(1))"


    //fprintf(f,"\n"); // put an additional new line at the end to help discriminate this set of points, commented out 5/28/18
    } // End of 2nd Loop, Return to begining of Y for Loop for y<Yloop


    Move (1,Yneg); // Y Axis Probe start position, Checked and corrected OK 5/6/2018
    Delay_sec (.2);
    MoveAtVel(0,Xneg+ (x + 1) * (StepsPerMM*5),20000); // corrected axis call was 1 (Y axis) OK 5/6/2018, changed XaxisIndex_mm to StepsPerMM for 1mm step 5/28/18
    while (!CheckDone(0)&& !CheckDone(1));
    Delay_sec (.5);
    } // End of 1st Loop,Return to begining of X for Loop
    //
    fclose(f); // X Loop Completed close file
    //completed Probing Return to Home Position
    }

    I have also included the TXT file created by this program.
    I put a few comments in the program for " wish list" features to work on.
    If any one has some suggestions please share.

    Thanks Tom and the CNC zone community

    Attached Thumbnails Attached Thumbnails 3D probing to create point cloud.-probed-points-jpeg  
    Attached Files Attached Files


  3. #15
    Gold Member TomKerekes's Avatar
    Join Date
    May 2006
    Location
    USA
    Posts
    2790
    Downloads
    0
    Uploads
    0

    Default Re: 3D probing to create point cloud.

    Hi eng101,

    Looks like you have a good start.

    FYI as a minor note if you post code using the cnczone code tag (# on the menu) it keeps the indentation so it is easier to read by everyone. Sometimes it is also necessary to replace tabs with 4 spaces.

    To get the current Origin offset you can see the ToolTableSet.c example for how to do this,

    #define Xmax persist.UserData[50] //Set to X max BY M100 Q FOR X AXIS
    #define Ymax persist.UserData[51] //Set to Y max BY M100 P FOR Y AXIS
    #define Zmax persist.UserData[52] //Set to Z max BY M100 R FOR Z AXIS
    btw this looks odd maybe you have your PQR parameters in the wrong order?

    If you need more than 3 parameters passed from GCode you might use another MCode to first set some persist parameters. Otherwise you might use GCode Variables.

    Regards

    TK
    http://dynomotion.com


  4. #16
    Registered
    Join Date
    Oct 2008
    Location
    USA
    Posts
    39
    Downloads
    0
    Uploads
    0

    Default Re: 3D probing to create point cloud.

    Hi Tom,

    You're right, I notice that while testing. when I ran a square section I didn't see it.
    It wasn't until ran a large rectangular part that something wasn't right.
    I had corrected myself in the Gcode for the M100 but didn't correct all the notes in the C program.
    My mom always said that I needed to mind my P's and Q's.



Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


About CNCzone.com

    We are the largest and most active discussion forum for manufacturing industry. The site is 100% free to join and use, so join today!

Follow us on


Our Brands

3D probing to create point cloud.

3D probing to create point cloud.