Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Export points as Vectors?


Tinyfxds
 Share

Recommended Posts

I have a set of points that I need to export with vector values.  The points need to have an x,y,z,0,0,0,0 values to them.  Is this possible thru Mastercam?  I need these points converted to vectors to run an inspection program in PC-DMIS.  Below is an example of how the points need to look in order for the CMM to read them properly. 

Sample_Points.PNG.4be8343d078c1ee5337d1241abc6e6fd.PNG

Link to comment
Share on other sites

Just point entities.  Our CMM program can take .txt files and use the information in that file, which is vector data, to probe points on our parts.  I'm trying to create a program that will probe our magnetic pallets that we use to machine parts on.  This would basically let me know if we are "dishing" our pallets over time.  This is just a little project I'm trying in my spare time.

Link to comment
Share on other sites
On 8/31/2018 at 8:17 AM, Tinyfxds said:

I have a set of points that I need to export with vector values.  The points need to have an x,y,z,0,0,0,0 values to them.  Is this possible thru Mastercam?  I need these points converted to vectors to run an inspection program in PC-DMIS.  Below is an example of how the points need to look in order for the CMM to read them properly. 

Sample_Points.PNG.4be8343d078c1ee5337d1241abc6e6fd.PNG

I do not use Mcam anymore so I can't help you get the post but to help clarify what you are looking for I have a few questions. A fixed point in space does not have vector information by itself. Are the points you are wanting extract on a surface that can use the normal as vector definition? Also, The code sample you show has X,Y,Z,0,0,0,0, I am assuming this quaternions for vector definition? I know there are posts that can output Euler angles normal to surface for points for 3D comp, I am sure it could be converted into quaternions.

Link to comment
Share on other sites

You say – "Just point entities", but then "...which is vector data."
Of course, Point Entities do not have vector data.
If you want to just output the X,Y,Z data for Point Entities in a file, you can do a SaveAs and select the Save as Text (.txt or csv) filter option.

Someone else asked about outputting Line data to a text file.
The Save as Text option mentioned above only does Points.
To output Line data, (all?, only selected?, or only those on this level?, or this color?) could easily be done with a NET-Hook add-in.
 

Link to comment
Share on other sites

If you use lines, the below method may be helpful.  I'm not a programmer, so there is definitely a better way to do this.

  public bool ProcessLinesOnLevel(int level)
        {
            var selectLines = new GeometryMask
            {
                Lines = true
            };
            var selectAll = new SelectionMask
            {
                All = true
            };

            // Get all lines on a given level
            var selectedGeometry = SearchManager.GetGeometry(selectLines, selectAll, level);
            
            // Make sure there are lines to process
            if (selectedGeometry.Count() > 0)
            {
                // Iterate through each entity
                foreach (var entity in selectedGeometry)
                {
                    // Cast the entity to LineGeometry
                    var line = (LineGeometry)entity;

                    // Create instances of Vector3D for the start and end points 
                    var startPoint = new Vector3D(line.EndPoint1.x, line.EndPoint1.y, line.EndPoint1.z);
                    var endPoint = new Vector3D(line.EndPoint2.x, line.EndPoint2.y, line.EndPoint2.z);
                    
                    // Calculate the vector
                    var vector = Vector3D.Subtract(startPoint, endPoint);

                    // Normalize/Unitize the vector
                    vector.Normalize();

                    // Write the values to a list of strings for output later
                    lineData.Add($"{Math.Round(startPoint.X, 8)};{Math.Round(startPoint.Y, 8)};{Math.Round(startPoint.Z, 8)};" +
                                 $"{Math.Round(vector.X, 8)};{Math.Round(vector.Y, 8)};{Math.Round(vector.Z,8)};");
                }
                return true;
            }
            else
            {
                return false;
            }
        }

That gets you the XYZ position and the unitized vector of a given line.  I think you would have to convert that vector into Euler angles then convert the Euler angles to quaternions.

Converting the unit vector to Euler angles is simple.  It appears that converting Euler angles to quaternions is simple, though I've never done it; I may try tonight for fun. 

  • Like 1
Link to comment
Share on other sites

I think he just wants what Roger mentioned

outputting vector information can be done in the post but is not for the faint of heart; even experienced programmers will find matrix calculations frustrating at first blush in post. 

NEThook would be easy enough to write jlw, how bad you want something?

If you only need to do this once, and having a unit vector (i,j,k) is okay.  You can save the file as a .STEP then open it as a text file. 
 

iThere will be a section for each line, you can search/replace everything else  to just be left with points / vector  (Direction)


ie: 

104=LINE('',#101,#103);
#105=CARTESIAN_POINT('',(0.869525945998740,-1.491090563615069,1.013089119252023));
#106=TRIMMED_CURVE('',#104,(PARAMETER_VALUE(0.0),#101),(PARAMETER_VALUE(1.0),#105),.T.,.PARAMETER.);
#107=CARTESIAN_POINT('',(0.618476426778893,0.380408095902425,0.708966688719660));
#108=CARTESIAN_POINT('',(0.618476426778893,0.380408095902425,0.708966688719660));
#109=DIRECTION('',(0.851776802699722,0.523904837143769,0.0));
#110=VECTOR('',#109,1.0);

  • Like 1
Link to comment
Share on other sites
5 hours ago, Tyler Robotson said:

I think he just wants what Roger mentioned

outputting vector information can be done in the post but is not for the faint of heart; even experienced programmers will find matrix calculations frustrating at first blush in post. 

NEThook would be easy enough to write jlw, how bad you want something?

If you only need to do this once, and having a unit vector (i,j,k) is okay.  You can save the file as a .STEP then open it as a text file. 
 

iThere will be a section for each line, you can search/replace everything else  to just be left with points / vector  (Direction)


ie: 

104=LINE('',#101,#103);
#105=CARTESIAN_POINT('',(0.869525945998740,-1.491090563615069,1.013089119252023));
#106=TRIMMED_CURVE('',#104,(PARAMETER_VALUE(0.0),#101),(PARAMETER_VALUE(1.0),#105),.T.,.PARAMETER.);
#107=CARTESIAN_POINT('',(0.618476426778893,0.380408095902425,0.708966688719660));
#108=CARTESIAN_POINT('',(0.618476426778893,0.380408095902425,0.708966688719660));
#109=DIRECTION('',(0.851776802699722,0.523904837143769,0.0));
#110=VECTOR('',#109,1.0);

I had totally forgotten this about step files.  Thanks for the offer Tyler, Jeff.D already hooked me up.  However, I like to learn so if you're inclined to throw something together I'd love to see it.

Link to comment
Share on other sites

Verisurf and the analysis or reverse part of the software might be able to do this. I just proved a CAV Software and a CMM wrong by using this process. I was told the tools paths were gouging the part. I took the DXF from Cimco brought it in compared it back to the part. Toolpath was good out to 7 places past the decimal when compared back to the 2D profile I was cutting. I got back a CMM report that show excess in one area and over cut in other areas. I took the RAW CMM data like what you have there and imported it into the Mastercam. I took and did an analysis and matched them exactly. I then did a best fit shift of .0006" and X and .0038" and Z and all the points came in within .0001" to .0004". No one at the company had every seen someone use software the way I did to prove it was right, but that is the beauty of having different things to prove you did your best.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...