Taking content from arrays to open a .3ds file
-
This is part of my program. what it is intented to do is get the first line of a txt file which is saved in a[0]. this will be the name of a .3ds model which than has to be imported in sketchup, but to do so, .3ds has to be added to the name. Something is wrong with my code I know it's something in the first line shown but I can't figure how to write it
correctly.machine = "a[0].3ds"
model = Sketchup.active_model
show_summary = true
status = model.import machine, show_summaryThanks
-
Your
machine = "a[0].3ds"
Is simply a string - with no reference to array 'a' at all.
machine = a[0].to_s+".3ds"
Takes the value of the first item in the array 'a' and adds .3ds onto the end of that all as a string...
If you are sure the first item in the array 'a' is a string you don't need the .to_s parta[0]+".3ds"
will do...
Advertisement