Excel Data to Model
-
not that it really matters i suppose, since this dxf file does indeed import into sketchup, it will not import into rhino, or autocad 2000 - autocad gives this error message:
No layer specification for this object. on line 12.
Invalid or incomplete DXF input -- drawing discarded.
Regenerating model.cheers
rabbit -
Taff - thanks for bringing back the nightmare called high school geometry!
Okay, after a brief refresher course and dusting off some formulas, this is how I THINK I am supposed to solve the problem...
In my Excel file, I have two columns:
A - Angle (0 - 360)
B - Radius (variable distances from the center point of the cam)I need to convert these to X and Y values for SU
I created two new columns, called X and Y (Z doesnt matter at this point....)
In the X column, I used this formula:
=B2*(COS(A2))In the Y column, I used this formula:
=B2*(SIN(A2))This gave me some happy little numbers in my X and Y columns, so I duplicated the formula for all rows and I got quite a bit of data. When I try importing it using the Cloud plugin (which I had been playing with for a couple days prior to my initial post) it brings in all 360 points, but it looks nothing like what I expect to see...
I expect to see a series of dots with a smooth, flowing outline - what I get is a bunch of scattered points...
Any help or suggestions are greatly appreciated....I am attaching a screenshot of the results in SU.
-
@rabbit said:
...it will not import into rhino, or autocad 2000
Not surprised -- I kept the included elements to the bare minimum -- only those required for SketchUp.
Taff
-
aspaddict,
If you can share the csv data, I can write an importer fairy fast. Post it here, or PM it to me.
-
aspaddict,
I generated Excel data, using the above equations, for 360 degrees (converted to radians, of course) and unit radius (1.0)
I imported the data into SketchUp, using 'cloud_v6', as did you. The attached image is the result.
Taff
-
@aspaddict said:
....thanks for bringing back the nightmare called high school geometry!
You weren't one of those students who thought, "I'm never going to need this!" were you?
[EDIT - Ignore this; see subsequent postings
I think the problem is likely due to +/- values of either the angle input, or sin/cos output. Try this - do only one quadrant, where the results will be all positive. Stick to the range of 0-90 degrees, and see what you get.
[END EDIT]](You can attach your spreadsheet, dxf and skp, if you want, but you're might have to zip them first.)
Taff
-
aspaddict,
I've been playing with Excel a little, and I think your problem is that the SIN and COS functions expect the angle parameter to be in units of RADIANS. If you haven't already, try these:
=B2*COS(RADIANS(A2))
=B2*SIN(RADIANS(A2))
I'll keep testing in Excel, to see if there might be some other "gotchas" to confound your calculations.Taff
-
Taff, this is epic! You really need a blog page to show off the cool stuff you do with SketchUp, that is totally different to what everyone else does!
Hwyl
[Edit: Actually this reminds me of something I have been thinking about for some time. You are obviously very mathematically-inclined, how difficult would it be to do a similar thing for a rippled surface in SketchUp. Lots of people have trouble with this, and I'm guessing that it's a mathematical function relating to amplitude. Accurender has a nifty function which can add one of 2 types of ripple to surfaces. Water is the main use for this. For rendering it makes a big difference. Is it possible, given a predetermined surface, to plot the mathematical function relating to ripples, and create the geometry to describe these sorts of surfaces? For rendering purposes, it would be really useful.]
-
@bigstick said:
...need a blog page to show off the cool stuff you do with SketchUp, that is totally different to what everyone else does!
Jim,
Hah! History repeats itself. What I'm doing here is actually an 'old school' technique from the introductory IBM-PC days (early 1980s.)
DXF was a ubiquitous file format back then, as it is now. Getting spreadsheet data (anyone remember VisiCalc?) into a CAD program was handled in the manner I used. Conceptually, it's simple, relatively easy to understand, nothing but text, and can be used with many programs (...and I'm getting to be an old dog, comfortable with my old tricks.)
Regarding ripples and waves, even PhotoShop can apply such 'distortions' to an image. The mathematical simulation of waves has been "algorithmized" in many ways, and 3D graphics articles/papers have been published by students/professors in the major graphics journals. These guys know much, MUCH more than do I on the subject. Modification and application into a SketchUp ruby is the missing exercise, but with a bit of homework, shouldn't be too difficult for an experienced ruby 'scripter' (of which, I am not.)
-
aspaddict,
I've a fair amount of experience in scientific/mathematical use of Excel, so producing a DXF file from a spreadsheet isn't too difficult for me. I realize that may not be true for you, so I've attached a ZIP file containing a spreadsheet that demonstrates how it's done.
(Please don't ask about the rather convoluted Excel formulae, 'cause it would require instruction in Excel. I suspect the formulae could be simplified further, as the newest version of Excel is giving me fits!)
The spreadsheet is protected to prevent structural changes, as that would 'break' its functionality. The only cells that can be modified are those that specify the length of the radial distances. The angles, and formulae for the x,y data are locked. They can not be modified unless you unprotect the spreadsheet. The formulae in the column of text for the DXF file are also locked from modification. You can copy and paste the DXF text, after your changes to the length parameters automatically modify the DXF info for you.
The spreadsheet should allow you to do plenty of "what if" adjustments to the length values.
I've also included the resulting DXF file, and a screengrab image of the SketchUp import (depicting 360 line entities.)
Regards,
Taff
-
Taff,
hay thanks for this thread it is just what I was looking for. I an trying your method and an having a problem and I am hoping you can help.when I try to import excel data I get this error in the ruby window.
Error: #<TypeError: nil can't be coerced into Length>
(eval):147:in*' (eval):147:in
import_points_cloud'
(eval):144:ineach' (eval):144:in
import_points_cloud'
(eval):481
(eval):147:in `call'
(eval):147I have tried opening the file in text edit but can see no problem.
here is the CVS file I am trying to use.any suggestions to what I am doing wrong and how I can fix it would be greatly appreciated.
Thank you and keep up the good work
Uberchurch
-
That worked BEAUTIFULLY! The RADIANS function is what I was missing out on...
...and yes, I was one of THOSE kids who said "Meh, I'll never need this later in life..." (Time to call my kids and warn THEM!)
Is there any quick and dirty way to connect all the points, or do I just need to use the line tool to achieve this? I need to connect them, then group them all together...
I think I can handle drawing 360 little lines at this point - the hard part is done - but if there's a smoother way of doing this, I'd prefer to go that route...
Thanks for the help!
-
@aspaddict said:
Is there any quick and dirty way to connect all the points...
Um,
The "Excel&DXF" example files I provided do precisely that. Extract the zip files and see if they do the trick. -
uberchurch,
I downloaded your file, opened it with Wordpad, copied everything to the clipboard, opened Notepad, pasted, and saved the file with a '.csv' extension.
The contents look okay. It may be that the extra carriage-return/line-feed info that Wordpad inserts is causing a problem. (I don't know for certain.) I can tell you that, with your data in an ASCII-text '.csv' file, the "import cloud" plugin worked fine. (See attached.)
-
Taff,
thanks for your help. I think the problem has to have something to do with the fact that I am on a mac because when I open the file that your created (thank you) which we know works I get the same error. But when I open it on a PC it is OK, although only with control points not components which is what I really need. So for now I will just create the point clouds on the PC and then bring it back to the MAC. Thanks again for your help and if you have any idea how I can replace the points with geometry that would be great.
Thanks Again
Uberchurch -
hello everyone,
i need the same tool as describe, but to make another shape:
i must draw line (i have the length),circle arc (i have the rayon and the angle of courbure), and slope (i have the length up or down).
all my data are in an excel
Can i use it automatically to make my way?
thx u 4 adavnce
Advertisement