Looking to create a fairly simple plugin.
-
Hello!
First post here. I've got a quick question. I've recently been dabbling with a little program called Hornresp for building and designing loudspeakers. This program is capable of outputting dimensions in txt/csv format.
My question is, would it be terribly difficult (for me) to create a plugin for Sketchup that would read something that looks like this:
Length (cm) Area (sq cm) Radius (cm) Angle (deg) Side Len (cm) Height/2 (cm) Top Len (cm) Width/2 (cm) Width Flare 0.000000 620.000000 14.048207 -0.828064 0.000000 12.450000 0.000000 12.449799 Con 0.500000 619.362115 14.040979 -0.828490 0.500042 12.443634 0.500041 12.443353 Con 1.000000 618.724231 14.033746 -0.828917 1.000083 12.437262 1.000081 12.436906 Con 1.500000 618.086346 14.026510 -0.829344 1.500125 12.430883 1.500122 12.430459 Con
and translate it into a basic shape in Sketchup? I'm not opposed to learning enough of the plugin language to make it happen, I'd just like to make sure that I'm not embarking on an impossible task before I set out to do it.
If it is possible, and someone could help me out with a very basic plugin example that grabs information out of a text or csv and draws objects with it, I'd love you forever!
-
Seems Dynamic Components of the SU V8 can also make this sort of parametric construction.
But I don't know if a dialog box of a Dynamic Component can read a list ?
If Yes that is very more easy than ruby scripting in my point of viewWait answer of specialist of Dynamic Components
-
DrDyna, This would be a relatively easy plugin to create. Something like this
def getdata
file_name = UI.openpanel "Open Data File", "c:", "*.dat";#get the file name
inp = File.open(file_name);#open the file
tmp = inp.readline;#read the header
while !inp.eof
tmp = inp.readline;#read a data record
dat = tmp.split(" ")#split the record using the space character as the seperator
#process dat array
length = dat[0].to_f;
area = dat[1].to_f;
;#etc.
end -
There are several existing scripts that read in 'text files' and parse the 'fields/parts' line-by-line into an array of values [e.g. separated by space/tab/,/;/etc] to use in making geometry of some sort from these as x/y/z/material/layer/etc ...
Find these and see how it's done...
Advertisement