sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Looking to create a fairly simple plugin.

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    4 Posts 4 Posters 149 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      DrDyna
      last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • pilouP Offline
        pilou
        last edited by

        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 view πŸ˜‰

        Wait answer of specialist of Dynamic Components πŸ˜„

        Frenchy Pilou
        Is beautiful that please without concept!
        My Little site :)

        1 Reply Last reply Reply Quote 0
        • sdmitchS Offline
          sdmitch
          last edited by

          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

          Nothing is worthless, it can always be used as a bad example.

          http://sdmitch.blogspot.com/

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            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... πŸ’­

            TIG

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement