Text , X , Y , Z import
-
Hi , Thanks for the Text and Leader tip
If I want to import Y, X ,Z rather than X,Y,Z
Can I just switch around the
x=data[1].to_f.mm
y=data[2].to_f.mm
z=data[3].to_f.mm
pt=[x,y,z]To
y=data[1].to_f.mm
x=data[2].to_f.mm
z=data[3].to_f.mm
pt=[y,x,z]Best Regards
Kristoffer -
Yes.
Thedata[]
order is the order typed in each line in the .dat file.
The original code assumed the first was the 'text', then x, y and z values, as in the .dat file supplied.
You can have the .dat file's entries in any order as long as the code's data[] values are adjusted accordingly - for example if the format werex,y,z,text
then the values would all change around to suit withtxt=data[3]
, and thenx=data[0]
,y=data[1]
andz=data[2]
...
The code I gave you was only a basis for .dat file reading - it's very flexible...PS: DON'T swap the point's values around use
pt[x,y,z]
always, no matter what the order they were read from the file ! -
Hi again
When I try to import a file Negative Co-ordinates I cet an error
Is this an easy fix ?See the example file
Best Regards
Kristoffer
-
What's the error ? Please post examples...
The codex.to_f.mm
should take the text 'string' of 'x' and make it into a 'number' [+/-] and then tell SUp it's in 'mm', not the default 'inches'? -
@khallgren said:
When I try to import a file Negative Co-ordinates I cet an error
Exactly what does the error say?
-
Hi , I tried to make my own file for testing and the negative co-ordinates workes fine, so the problem is not the negative co-ordinates. But when I export a file from my calculation program and try it import it I get an error, but the files sceems identical to me?
Here is the error i get
and the file is attached below
Error: #<Errno::ENOENT: C:/Programfiler/Google/Google SketchUp 7/Plugins/cptstxt.rb:14:in `readlines': No such file or directory - C:\Documents and Settings\krh\Skrivebord\BeregnetHøyderfile8.txt>
C:/Programfiler/Google/Google SketchUp 7/Plugins/cptstxt.rb:14Best Regards
KRistoffer
-
I think I know what the problem is . Its the dicimales.... Its fine importing a file that says:
example: text,200.0,200.0,200.0
But when the file has a desimale value thats larger than 0 i get an error
example: text,200.5,200.5,200.5
Best regards
Kristoffer -
Ah!
I know why that is - because you are Norwegian! Sketchup's ruby doesn't read files that has characters which isn't ASCII (A-Z). So our beloved æøå makes SU's file functions go belly up.I struggled for ages with this some time ago. Found no good solution for that. You can work around be renaming your file.
Hilsen fra Bartehovedstaden!
-
@khallgren said:
I think I know what the problem is . Its the dicimales.... Its fine importing a file that says:
example: text,200.0,200.0,200.0
But when the file has a desimale value thats larger than 0 i get an error
example: text,200.5,200.5,200.5
Best regards
Kristoffer?? With the same file you tried earlier? Or did you create a new test file with just ASCII chars in the file name & path?
-
As Thomthom said -
It's an 'unrelated' error to the code itself... you have 'special characters' in the filepath - this always causes Ruby / Sketchup problems [it can be trapped form but it's a bit complex for this simple example code!].
So please do it without the 'ø' etc in filename 'BeregnetHøyderfile8.txt' >>> 'BeregnetHoyderfile8.txt' ? it should then work !
-
Hi,
@Khallgren: I'm just about to modify my points cloud script to achieve what you want. Stay tuned.... -
Hi , Oppps I missed that issue
Diddler Bur: It would be great if your point cloud importer had a "text" option
Thanks for all your helpBerst regards "fra regn byen"
Kristoffer
Advertisement