Import Coordinates to create points

Next
 From:  Grendel
10886.1 
Is there an easy way to import sets of coordinates to create points based on those values? I know this is possible to have an x-ref drive sketch's in Solidworks but I would rather use MOI to be honest. The need arises from a measured data set of several hundred samples and I would like to define the curve formed by these data points. Basically a hole with flared diameter that was measured via a no-go gage.





  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Larry Fahnoe (FAHNOE)
10886.2 In reply to 10886.1 
Hi Grendel,

I think you'll get a good start by looking at the ImportPointFile script from: http://kyticka.webzdarma.cz/3d/moi/#ImportPointFile.

The updated version is available here: http://moi3d.com/forum/display.php?webtag=MOI&msg=5124.2

--Larry
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
10886.3 In reply to 10886.1 
The ImportPointsFile is a very good script.
The input file is basically a csv or text file.
Each row is a point, with the three coordinates separated by the selected delimiter.
There are several possible delimiters between the point coordinates, comma, space, etc.
The points can be imported as points, or two varieties of curves, etc.

The one thing that is not available from the script, is Groups, or sets of points, or sets of curves.
Recently, I have contemplated either turning a blank line into a Group separator (second delimiter), or using a tilde (~) as a group separator in formerly blank line, by modifying the script.
There would have to be test for a blank line, or tilde, and another loop, (while loop?), and array of point arrays to turn into curves. (Factories, like lineweb)
I began some initial looking at the code of PointImportFile script...Maybe in a few days or weeks i'll make a mod?
Michael could probably do a script modification in an hour or so?
Also an export script would be good?

Example: 9 violin back curves, as points.
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5293195/
The sets of curves do not each close separately, as there is no Grouping code.
Maybe the point/curve groups could be labeled MoI Groups as well?

- Brian

p.s. The PointImportNetwork script, using point data from Python, does do groups, but there is a repetitive field with the "group" number. (See my gyroid script.)

CSV files concentrate on importing data to a 2d table, (spreadsheet).
I was unable to locate software to do grouping of points in a CSV like file.

There is a group separator mentioned here:
https://en.wikipedia.org/wiki/Delimiter-separated_values
"ASCII includes several control characters that are intended to be used as delimiters. They are: 28 for File Separator, 29 for Group Separator, 30 for Record Separator, and 31 for Unit Separator. Use of these characters has not achieved widespread adoption; some systems have replaced their control properties with more accepted controls such as CR/LF and TAB."

EDITED: 31 Oct 2022 by BEMFARMER

Attachments:

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Grendel
10886.4 
Thank you Larry and Bemfarmer, that was exactly what i needed and it worked perfectly. I appreciate your help
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  bemfarmer
10886.5 
In an AHA moment this morning:

Define EOG, End Of Group, as tilde (~).
EOG is processed, and is to behave analogously to EOF, (End Of File).
Each group of point coordinates ends in a tilde, and each group acts as a CSV file. The txt file of all of the groups of points has multiple CSV file structures, each group separated by tilde in formerly blank line.
Nest EOG While loop, inside EOF While loop.

code:
while ( !f.AtEOF )
{
        While !EOG
        {
             // Process current group set of point coordinates, and save the resulting geometry in a factories array, like in LineWeb.
             // (Later, save and Increment the group name when the factories array is processed into Points or Lines geometry.  Also save the group name as MoI Group names...)
             ...
             PointList.push( point );
             // save PointList in ArrayOfPointlists
             // clear PointList for next group of points.
        }
}
// Process ArrayOfPointsLists into geometry...
...


(~) = tilde = '~' = EOG.

Brian

Is there a pre-existing EOG symbol?
The above code is a very rough draft :-)

(An alternative is to split the .txt of multiple groups of points into 9 individual CSV files, and import each file separately.)

EDITED: 1 Nov 2022 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All