Excel Files into Rhino?

What is your desired end goal? And do you have any experience with writing python scripts for Rhino?

Hi norseman.

Not much experience with python.im a quick learner though.


From: Norsemen23

Sent: ‎17/‎10/‎2014 17:58

To: solutionboatdesign.edmonds@gmail.com

Subject: [McNeel Forum] [Rhino for Windows] Excel Files into Rhino?

Norsemen23

October 17

What is your desired end goal? And do you have any experience with writing python scripts for Rhino?

To respond, reply to this email or visit http://discourse.mcneel.com/t/excel-files-into-rhino/12519/2 in your browser.


Previous Replies

jedo41

October 17

Does any one know of an easy way to bring in Excel Files into a Rhino Layout?

I have had limited success turning the Excel File into CSV and then Importing to Rhino. How ever the Scale tends to go a bit Loopy


To respond, reply to this email or visit http://discourse.mcneel.com/t/excel-files-into-rhino/12519/2 in your browser.

To unsubscribe from these emails, visit your user preferences.

Sorry desired result was to export some of my excel spread sheet onto a rhino layout


From: Norsemen23

Sent: ‎17/‎10/‎2014 17:58

To: solutionboatdesign.edmonds@gmail.com

Subject: [McNeel Forum] [Rhino for Windows] Excel Files into Rhino?

Norsemen23

October 17

What is your desired end goal? And do you have any experience with writing python scripts for Rhino?

To respond, reply to this email or visit http://discourse.mcneel.com/t/excel-files-into-rhino/12519/2 in your browser.


Previous Replies

jedo41

October 17

Does any one know of an easy way to bring in Excel Files into a Rhino Layout?

I have had limited success turning the Excel File into CSV and then Importing to Rhino. How ever the Scale tends to go a bit Loopy


To respond, reply to this email or visit http://discourse.mcneel.com/t/excel-files-into-rhino/12519/2 in your browser.

To unsubscribe from these emails, visit your user preferences.

Why is Python needed?

Hey David,

I have attached a CSV File that I am trying to Paste on a Rhino LayOut.

Regards JedNew WinRAR archive.rar (418 Bytes)

What are you trying to achieve with this? I don’t see much in the file that could be interpreted as either Rhino geometry or even a 2D drawing, it’s just a parts list…

If you just want to import the text, you can open the CSV, Ctrl+A, Ctrl+C (copy all) then start the Text command in Rhino and paste the result in the box.

This could be automated perhaps with a Python script that would parse the CSV and do some formatting perhaps before pasting it at a given insertion point…

–Mitch

Thanks Mitch Ive got that- But as I mentioned at the top the Format changes- I can live with not Importing the Boarders on the Spread Sheet. How ever all of the cells move around.

Jed

Well, there’s only so much you can do to try and translate an Excel spreadsheet into something that works graphically on a layout page. Maybe you just need to paste a screenshot from Excel into the layout…

Certainly with Python, you can parse the .csv file and try to organize the text a bit - but the fact that you have blank cells and that the text length in each cell can vary will make the chances of success in all cases pretty slim.

–Mitch

Righto- Thanks alot for your Help.
Regards Jed

You should be able to do all the organization in Python… find the length of the longest string to create the size of the columns, check if there is a space to create an empty cell etc. It probably wouldn’t be the prettiest script on the block but it would get the job done. Where to insert the table potentially opens up a whole new can of worms depending on how much the cell sizes vary…

-Andrew

Yep… and make sure to use a monospace typeface - otherwise you have no control over the string length… Type height is another issue… And then if you want to actually draw in the cells you do have to make a grid of Rhino lines that correspond to the type spacing. Definitely a can of worms… :stuck_out_tongue_closed_eyes:

–Mitch

There are quite a few Grasshopper plug-ins that simplify Excel exchange that you could look into.
Grasshopper gives you dynamic feedback and if you just add a few sliders to change cell height and width, it shouldn’t be too bad.

Nice idea, I hadn’t thought of that… Of course, if you’re just making printed drawings, I stick with my original idea of pasting a screenshot of an Excel file into the layout… Simple and easy to control if all you need is to do is read the text, not extract it. --Mitch

Our free open source plugin Table let you import csv data file as tables in rhino:
http://www.rhinopiping.com/_table-plugin-for-rhinoceros/

2 Likes

Now that’s cool! --Mitch

This looks Good I will check it out

Thank You matthieu_arnol1. Plugin works great.

Is it possible to add there some variable factor to control offset of borders and text? I am asking because I dont feel confident in programming and this source code scares me.

Hi mlukasz87,
You should look for this code in tabGenerator.vb:

        'Ecriture et positionnement du texte
        Dim PtWithOffset As Point3d = pt0
        PtWithOffset.X = PtWithOffset.X + (hauteurTexte / 2) 'position initiale en x
        Dim ObjectID As Guid
        Dim DefColumns(MyArray.GetLength(1)) As Double
        DefColumns(0) = pt0.X
        For b As Double = 0 To MyArray.GetLength(1) - 1
            Dim maxSizeColumn As Double = 0
            For a As Double = 0 To MyArray.GetLength(0) - 1
                PtWithOffset.Y = pt0.Y - (hauteurTexte * 1.5 * a) - (hauteurTexte * 1.25) 'position en Y
                ObjectID = AddAnnotationText(doc, PtWithOffset, MyArray(a, b), hauteurTexte, TextJustification.BottomLeft, MyFont) 'ajouter annotation
                Dim tp As Object = doc.Objects.Find(ObjectID)
                tp.Attributes.Name = "TabulatedText" & "_" & b & "_" & a 'Attribution d'un nom à l'objet pour modification ultérieure
                tp.CommitChanges()
                doc.Objects.Select(ObjectID) 'selectioner
                'Calcul de la taille  de colonne
                Dim sizeColumn As Double = tp.Geometry.GetBoundingBox(True).Max.X - tp.Geometry.GetBoundingBox(False).Min.X
                If sizeColumn > maxSizeColumn Then maxSizeColumn = sizeColumn
            Next
            PtWithOffset.X = PtWithOffset.X + maxSizeColumn + hauteurTexte + (hauteurTexte / 2)  'ajustement de la position en x du texte
            DefColumns(b + 1) = PtWithOffset.X - (hauteurTexte / 2) 'ajustement de position en x de la ligne verticale
        Next

In this section of the code, replace every “hauteurTexte” with the offset value in mm you need.
As it is now, the offset is calculated from the text height. I used this to keep it proportional to the text, watether the size or style you choose. (For information, “hauteurTexte” means text heigth in french)

I don’t see that the end result was clearly stated.
As I read it, it sounds like jedo41 would be sell served with an image of the Excel spreadsheet used with PictureFrame.
Sure, it would not be text that could be edited, but it would not involve any scripting or coding.

Am I confused?

The previous free and basic version of our plugin table has been deprecated, but a new one is available for Rhino5-6-7.