Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Importing Data Points from a CSV File

rex_hansonrex_hanson Member Posts: 41 ✭✭
About a year ago I found a script or function called 3D CSV 1 that would read a csv file containing xyz data points and then it would create a data point for each point found in the file. I recently tried using this and now it won't regenerate. I compared the syntax of my previous files that worked to my current file that doesn't and I don't see anything different. I've searched for the 3D CSV 1 on the forum and I can't find it anywhere. Not sure how to get help on it or if there is a new / better way to import points from a data file. Hoping someone can point me in the right direction.

Thank you!
Tagged:

Best Answer

Answers

  • rex_hansonrex_hanson Member Posts: 41 ✭✭
    Found out how to more specifically identify the feature script I'm trying to use by right clicking and selecting the "open" option.

    When I open the link I get:    3D XYZ CSV Points and SplinesV4

    First two lines of the script says this:
         FeatureScript 891;
         import(path : "onshape/std/geometry.fs", version : "891.0");

    Not sure how I get help on making it work.
  • rex_hansonrex_hanson Member Posts: 41 ✭✭
    When I added more information the system thought I answered the question. My question is NOT answered.
  • john_mcclaryjohn_mcclary Member, Developers Posts: 3,935 PRO
    can you link the featurescript document? I remember when they introduced that capablity, but never went anywhere with it yet.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    There are many similar scripts knocking about and it’s only about 10 lines of code. 
    Senior Director, Technical Services, EMEAI
  • rex_hansonrex_hanson Member Posts: 41 ✭✭
    john_mcclary, not sure what you mean when you say "link" the featurescript. Do you mean link it to this question or somehow link it to my model? Either way, I have no idea how to do that.

    NeilCooke, I could try a different script, but I think the real issue is something with my file. The script I had found works for one set of data points but not my new set that was created from a cmm machine. I'm not sure who wrote the script and I'm not sure how to debug it. The only error message I get is that it doesn't regenerate when I select the "plot points" checkbox.

    I found a few different feature scripts that create points and then fit splines through them. For now all I need is points. I didn't find anything that did just that.

    Thanks for helping.
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    @rex_hanson that script was written by our very own @philip_thomas so should work as advertised. Check that your CSV file is in the correct format and that you've entered the correct "Data Start Column" (starting at 0 which would be column A in a spreadsheet)
    Senior Director, Technical Services, EMEAI
  • rex_hansonrex_hanson Member Posts: 41 ✭✭
    Neil,

    I've looked at my text file and the format appears to be correct. I'm thinking maybe it has to do with hidden characters associated with carriage return / line feeds or something like that. My original text files that work were created on a PC running windows. My new text file was imported from a Mac. On my Mac I don't have an editor that will show the special characters and I don't have access to the Windows computer because I recently retired and that Windows computer was at work.
    Here is a link to my model:
    https://cad.onshape.com/documents/8f96f0f57ac0cafc749051bd/w/60ec1d0bc661168cfdfd3d23/e/156902e34866a626db0db1db

    Part Studio 2 works like it is supposed to work. It references the "New Profile.csv" import.
    Part Studio(Data from Romer Arm) doesn't work. It references the data file "Quick Measure Data Point Capture.csv" import.

    The goal of my project is to demonstrate the process for importing a CMM point cloud, surfacing that point cloud, and then subtracting it from CAD geometry created from sketches and extrudes. The end goal is to use a 3D printer to make parts that mate up to an existing part whose shape was digitized using a Romer arm. The basic process appears to be sound. My original models that regenerate without error use point data fabricated from a Creo model. My Romer arm example that fails to regenerate is trying to use data obtained from the Romer arm. I'm sure it is a simple syntax issue but I'm not seeing it.

    Thank you very much for looking at this. I realize I'm not a paying customer. However, this project is for the students at NICC community college where I have volunteered to get their Romer arm working and then show the students how to use it in conjunction with their engineering technology lab.

    Rex
  • Jacob_CorderJacob_Corder Member Posts: 137 PRO
    @rex_hanson

    I have to filter out this symbol in my csv file text



     copy the symbol and paste it in your featuerscript code 
     if(isIn("�",splitIntoCharacters(someText)))
            {
                println("Found a silly question mark square thing");
            }
  • rex_hansonrex_hanson Member Posts: 41 ✭✭
    Not sure I have the authority to modify someone else's script that I've linked to. Plus, I'm not sure I want to risk messing it up since I'm not proficient at writing feature scripts. If I knew how to make a copy and then modify my personal copy I might try it.

    I have tried to export the data with several different options in Excel. Tried Mac.csv, DOS.csv, and generic.csv. None of them resulted in a file that would work. So I'm obviously missing something.
  • rex_hansonrex_hanson Member Posts: 41 ✭✭
    I will try dividing the values by 1000 and re-importing the data. Thank you!
  • chad_chaffeechad_chaffee Member Posts: 13

    First of all, a big thank you to Philip Thomas and anyone else who contributed to the 3D CSV code.

    I was able to get the code to work, but after importing the points and the spline, I was not able to select the points using the box selector. I can select them one at a time, and the box selector WILL select the spline, but for the points the box selector does nothing. I'm still new to OnShape. Is there something I'm missing or is there a way to fix this? Thanks.

Sign In or Register to comment.