1. Hey guyz. Welcome to the All New Phlatforum!



    Sign Up and take a look around. There are so many awesome new features.

    The Phlatforum is a place we can all hang out and

    have fun sharing our RC adventures!

  2. Dismiss Notice

PhlatFoil tool

Discussion in 'SketchUcam Related Software' started by iGull, Dec 13, 2010.

  1. iGull

    iGull Member

    Offline
    Messages:
    53
    Trophy Points:
    8
    Location:
    Edinburgh, Scotland
    Just added 2010-12-17 19:25 GMT...
    Latest version 1.002 of 'phlatFoil' and the new 'phoilPal' aerofoil file converter plugin (now attached to this post)


    Hi All
    Just finished my first ruby tool that creates aerofoils (airfoils :) from aerofoil files - don't tell me someone else has built one or I'll cry :lol:
    Attached is a zip file containing "phlatFoil.rb", a couple of cursor image files "cursor_aerofoil_begin.png" & cursor_aerofoil_end.png" - there are also a few test aerofoils (*.foil extension). All the above files (apart from the aerofoils) should reside in the plugins folder. Fire up SU and the tools menu should have two extra menuitems - "Select Aerofoil..." and "Aerofoil". Choose "Select Aerofoil" and navigate to wherever you put the aerofoil files then pick one. The aerofoil data will stay loaded until you choose another foil or change tools. Choose "Aerofoil" then just click click, click drag or click then type in a value in the VCB. The aerofoil will be drawn as a surface (not grouped, you may want to group them first).
    It's not been fully tested, but I'm sure some folks will blow it up :lol:
    The foils only work on the flat [phlatLand ?]] (not in 3D space).
    Some massaging of other foil files may be necessary - foil format info can be seen in the rb file (maybe I should have written a readme :) :)

    It's a quick way to create a set of ribs by using a pair of LE and TE guides with rib stations - just click your way through the wing !

    I am extremely impressed with all the phlat stuff for cnc - to the point that I have nearly become a sketchup convert from Vectorworks !

    I've only tested this on Mac OSX 10.6.5 & SU 7, but I see no reason for it not to work on a PC - perhaps someone can test it.

    Cheers

    Neil Attached files Phoilstuff.zip (33.4 KB)Â
     
  2. 3DMON

    3DMON Moderator Staff Member

    Offline
    Messages:
    2,380
    Trophy Points:
    38
    Location:
    Sebastian, Florida
    I just tested it. It works great!
    Thanks for the cool plugin.

    Oh and welcome to the Phlatforum. What a cool first post. :D

    Now to find a bunch of .foil files
     
  3. jovian

    jovian Member

    Offline
    Messages:
    208
    Trophy Points:
    16
    Indeed very cool. We might just have to add it the the PhlatPlugins when the time comes.
    Edit
    I should have also added that if you would like it to be added there as well.
     
  4. pezzer2003

    pezzer2003 Member

    Offline
    Messages:
    66
    Trophy Points:
    6
    Location:
    Sydney, Australia
    Where are you getting the airfoils from? I have a heap in DXF format. Can i convert them for this plugin?
    Thanks this is a great tool..

    PEZ
     
  5. kram242

    kram242 Administrator Staff Member

    Offline
    Messages:
    6,311
    Trophy Points:
    13
    Location:
    NJ
    Neil this is fantastic! way to go on your first plugin :D
    I did a few test to see if I could apply the phlatfoils to unique shapes and it works perfect.
    It should be noted that you must use the tool on the horizontal (left to right/right to left) for it to show up.
    After the ribs were made I used both the skin plugin and the curviloft to test the connects for a skin around the ribs. Curviloft winds hands down :)
    Once again great job and thank you for sharing this. When SketchUcam is ready we will have to add this one to the plugins.
    Mark and Trish Attached files [​IMG] [​IMG] [​IMG] [​IMG] [​IMG] [​IMG]
     
  6. 7up

    7up Moderator Staff Member

    Offline
    Messages:
    1,090
    Trophy Points:
    38
    Location:
    Kentucky
    Welcome Neil! Great plugin, I don't know how I missed this post, but I just found it. Good job and thanks for sharing. :D
     
  7. iGull

    iGull Member

    Offline
    Messages:
    53
    Trophy Points:
    8
    Location:
    Edinburgh, Scotland
    Hi All

    Thank you for all the good comments - I'm _very_ impressed with stuff done using curviloft - I haven't seen that yet - must spend more time reading these forums :lol:
    OK on adding it to PhlatPlugins - no problem, my pleasure and perhaps a small token in return for all the phlat stuff I've downloaded ;)

    The aerofoil format issue is certainly an issue in general terms. There are loads of different aerofoil formats (dxf isn't one of them though BTW :))).
    As a _general_ rule of thumb, you start at 0,0 on the leading edge, go over the top to the trailing edge at 100,0 then return along the bottom to 0,0 again. This can be started at 100,0 in reverse too - although phlatphoil doesn't care nor does it care whether you start going over the top or the bottom.
    The technical format that phlatfoil wants for each data point is the following ...
    xCo-ordinate TAB yCo-ordinate LF (or CRLF) - where TAB is a Tab character (9), LF is a linefeed character (10) - CR is carriage return character (13). There are usually about 70 co-ordinates per file - again, it doesn't matter how many - the more you get, the better the foil resolution. It is important that you start at 0,0 and finish at 100,0 (or the reverse). If the file were to start at 0,0 to 100,0 over the top then 0,0 to 100,0 over the bottom, then you would end up with a line up the middle of the chord :-(
    Some aerofoil files are like this. :)
    Other aerofoil files go from 0,0 to 10,0 - those won't work - you'll end up being 1/10th of the size :) You can massage (multiply everything by 10) them in something like (Mac) Numbers or Excel (Mac/PC) 'though.

    Foils edited for foam cutting software are the easiest to work on as they MUST work their way around the foil (otherwise you end up with slices of discarded foam :lol: :lol: :lol: ) That reminds me about another plugin I might work on....

    I have been considering writing a separate plugin that will convert all (or at least some of the more common types) of the different foil types available into the above - I have done something in realbasic and vectorworks but it is incomplete.
    Ruby is new to me, so it might take a wee while :lol:

    BTW, the foils will also need to have a '*.foil' extension too ;)

    Cheers

    Neil
     
  8. iGull

    iGull Member

    Offline
    Messages:
    53
    Trophy Points:
    8
    Location:
    Edinburgh, Scotland
    Hi All (again :D )

    Should have mentioned this link - the UIUC Airfoil Database - pretty much the fount of all aerofoil stuff (even though they can't spell aerofoil :lol: )...

    http://www.ae.illinois.edu/m-selig/ads/ ... abase.html

    They DO mention DXF files too - sorry ;)

    Cheers

    Neil
     
  9. 3DMON

    3DMON Moderator Staff Member

    Offline
    Messages:
    2,380
    Trophy Points:
    38
    Location:
    Sebastian, Florida
    I have searched and can not find any .foil extensions. The .dat is the most common extension I find.

    Neil, where can we find more .foil extensions?
     
  10. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    Neil, good work! I just tried it, like Mark did with cuviloft, and worked great to make a wing. I did hack mine, so it makes the airfoils in the vertical plane. :)

    @3dmon, my guess is the .foil extension is just a made up extension, like the phlatscript's .cnc extension. Meaning you won't find any.

    -Kwok
     
  11. jovian

    jovian Member

    Offline
    Messages:
    208
    Trophy Points:
    16
    extension shouldn't matter as long as it follows the format that iGull specified
     
  12. pezzer2003

    pezzer2003 Member

    Offline
    Messages:
    66
    Trophy Points:
    6
    Location:
    Sydney, Australia
    I'm lost :oops: what is needed to be done to the .dat files?
     
  13. iGull

    iGull Member

    Offline
    Messages:
    53
    Trophy Points:
    8
    Location:
    Edinburgh, Scotland
    Hi All

    Exactly, there are just so many 'formats' that it is very difficult to do a "one-size fits all" routine - hence the *.foil extension.

    While *.dat is the most common extension, sadly, it doesn't mean that the data within are all in the same format. At the last count (I'm currently working on a converter for this BTW) I counted sixteen different *.dat internal formats (of aerofoils that is - not to mention all the other *.dat data types !!!) !! On top of that, you have all the *.cor formats that foamcutters use (indeed there are variations on that too :lol: ) plus various historical aerofoil formats and individual stuff that has been created from them (*.dxf/*.dwg/*.igs/*.3ds ad nauseam)
    Do we need any more 'standards' ? - perhaps what we need is a STANDARD for US - I'm suggesting that this is the 'standard' (we could have endless committee meetings about it of course or just give in and accept it ;) ...

    Start from the "leading edge" at 0,0 - over the top to the trailing edge at 100,0 (or 1,0), back to the leading edge underneath to 0,0. Some aerofoil data of course may not end at 100,0 on the trailing edge - it may be 100, -10 or whatever - it is important that it starts at 0,0 and ends at 100, nn (or 1,nn).
    Format for data ...
    xCo-rd TAB yCo-ord CRLF
    (strictly speaking, either CR or LF would do - I'm bowing to OS history here - it just means that it makes it more human readable if opened on multiple OSs).

    As many data points as in the original foil so that no data is hurt in the process.

    There's no big reason for 0 to 100 rather than 0 to 1 other than the 100 becomes 100% (which indeed 1 does too - I'm talking myself out of it here - which I'm quite happy to - I argue with myself regularly :))

    The extension as *.foil - which is probably used for some other format too (I just checked filext.com, it isn't - probably because it's got four letters :)

    It all depends on whether folks want a 'standard' that they know will work with phlatFoil and sketchup.

    Personally, I don't want to get too anal about this as it's only a hobby but
    if anyone wants a say in this, speak now or forever hold your peace :lol:

    WARNING - You may wish to bear in mind that a lot of aerofoil data has commercial copyright !

    In the interim (as a temporary measure), if anyone wants a specific aerofoil changed to *.foil format for a current project, just PM me (but not with a folder full of files please :D )

    Meanwhile, I'll plod along with the converter.

    Cheers

    Neil
     
  14. pezzer2003

    pezzer2003 Member

    Offline
    Messages:
    66
    Trophy Points:
    6
    Location:
    Sydney, Australia
    Thanks Neil,
    This is a great tool, I like the idea of setting up a standard just for what we do too.

    PEZ
     
  15. lovebugjunkie

    lovebugjunkie New Member

    Offline
    Messages:
    57
    Trophy Points:
    0
    One more vote for a standard, what ever you would like it to be.
     
  16. 66tbird

    66tbird Moderator Staff Member

    Offline
    Messages:
    431
    Trophy Points:
    18
    Location:
    Deserts of Arizona
    Mmmmm! converter :cool: .

    Nice piece of code and a real time saver, Thank you
     
  17. 3DMON

    3DMON Moderator Staff Member

    Offline
    Messages:
    2,380
    Trophy Points:
    38
    Location:
    Sebastian, Florida
    A converter sounds good to me too.
     
  18. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    All the foils that I have used I took form the place mentioned above, so for ME they are the standard. Having said that, most of the foils that they have start at 0.0 and go to 1.0 to make the upper line. For some reason they go back to 0.0 and start the lower line back to 1.0. It should be like the files included in this tool, Start at 0.0 and end at 0.0. I don't know why they make it the way they do. That they do it to 1.0 and not to 100.0 makes no difference to me since in SU it is easy to scale it up to the size I want.

    Just my $0.02
     
  19. iGull

    iGull Member

    Offline
    Messages:
    53
    Trophy Points:
    8
    Location:
    Edinburgh, Scotland
    Hi All

    I am well on with the foil converter, but have come across what seems to be a limitation in SU - perhaps a SU expert can help me here. It pertains to the resolution of a 'point' (I believe the internal measurements are imperial ? That would then assume a maximum resolution of 1/1000th of an inch (0.001" or 0.025mm ) - entirely unhelpful in a 'CAD' environment ??). I can't find any info on this at sketchup.com.

    Here is a very simple example ...

    model = Sketchup.active_model
    entities = model.active_entities
    pts = []
    pts[0] = [0, 0, 0]
    pts[1] = [100, 0, 0]
    pts[2] = [100, 100, 0]
    pts[3] = [0, 100, 0]
    pts[4] = [0.0001, 100, 0]
    # Add the face to the entities in the model
    face = entities.add_face pts

    This will fail for "(eval):12:in `add_face': Duplicate points in array"
    It thinks that 0 in [pt3] and 0.00001 in [pt4] are the same value.
    However, if I change 0.0001 to 0.001 in pts[4], then it works OK.
    I really can't believe that an application with such a standing as SU can have a limitation like this ??? As we have no control of the data within aerofoils - nor the sizes that the end user might want (although a wing chord of say 60/1000" would require some real quality balsa :p ), then this is a serious 'limitation'.

    Tell me that there is a preference to set this smaller please !! :lol:

    TIA

    Neil

    PS Perhaps I should post this elsewhere, my apologies if this is a misdemeanour =;-??
     
  20. kyyu

    kyyu Active Member

    Offline
    Messages:
    1,183
    Trophy Points:
    36
    Location:
    Maryland
    Yes, I've read that sketchup's limit is 0.001" resolution. I take this to mean drawing dimension, not internal variable value. You can always check with the ruby gurus at the sketchucation developer's forum: http://forums.sketchucation.com/viewforum.php?f=180

    I've just done a quick test and nope you can't make an edge between two points, 0.0009" apart. 0.001" works fine. Sample code:

    model = Sketchup.active_model
    ent = model.entities
    t1 = [0,0,0]
    p1 = Geom::point3d.new t1
    t2 = [0.001,0,0]
    p2 = Geom::point3d.new t2
    line = ent.add_line p1,p2
    puts p1, p2, line

    The obvious solution would be to scale up your data. I think I've just faced this problem for the 1st time, in my latest plugin. Although not directly. I was slicing up a model in very thing slices, and having problems with anomalies. Scaling the model up, I got less and less problems. Now I am scaling the model to 10,000 inches (that's 10 thousand if you guys use the comma different than we do) and it's working fine now.

    -Kwok
     
  21. iGull

    iGull Member

    Offline
    Messages:
    53
    Trophy Points:
    8
    Location:
    Edinburgh, Scotland
    Hi All
    Thanks Kwok - that pretty much verified what I found, so I've scaled all the data instead.

    I've completed the aerofoil converter (to the best of my knowledge :p ) and have attached it and an updated version of phlatFoil to accommodate the new type of *.foil files.
    In the spirit of fun, the converter is call 'phoilPal' :lol:
    You just need to open a 'standard' aerofoil file and then click save - nothing complicated, no choices or decisions to make other than where you want to save the file. phlatFoil works the same as before of course.
    I've include a 'readme' with some simple instructions :roll: :lol:

    Cheers

    Neil Attached files Phoilstuff.zip (33.4 KB)Â
     
  22. TigerPilot

    TigerPilot Well-Known Member

    Offline
    Messages:
    1,578
    Trophy Points:
    48
    Oh man, Neil, that is so sweet! Together with the loft plugin it's a winner! The conversion worked excellent.

    Why did you put them in two different places? Can you make it like Kwok did and put them in one sub-directory?

    Allso,can you put the zip file in the first post? Someone who comes to this thread will download the from the first post, normally, and if this thread will become a big one, it will be easier to find the latest updates.

    Thanks you, Neil, good show.
     
  23. iGull

    iGull Member

    Offline
    Messages:
    53
    Trophy Points:
    8
    Location:
    Edinburgh, Scotland
    Hi Yoram

    Well, phlatFoil is a tool (the foil select part I kept next to it because it seemed logical), phoilPal is really a utility - hence the reason for putting it in plugins.
    It can surely be put in the tools menu if folks feel strongly about it ?
    I nearly rolled the whole thing into one and keep the original foil format of the data and just do an internal conversion of the file without saving anything at all - just passing the data internally to the draw routines ??? I kept them separate in case anyone had a need for the files - again I'm open to suggestion.

    I'm still feeling my way around sketchup and ruby and am not completely at home with it yet. I was going to create tool icons for a toolbar, but it looks like I can't get toolbars on the Mac - is this the case ??? (and if I can't have them on my Mac then you're not getting them on your PCs - so there :lol: :lol: :lol: )

    As Yoram suggested, I've put the latest download in the first post of the series.

    Cheers

    Neil
     
  24. blindflight

    blindflight Moderator Staff Member

    Offline
    Messages:
    361
    Trophy Points:
    16
    Location:
    CA
    Hey guys is the phlatFoil installed in "tools or plugins"?
    Thanks
     
  25. iGull

    iGull Member

    Offline
    Messages:
    53
    Trophy Points:
    8
    Location:
    Edinburgh, Scotland
    Knew I shouldn't have included a readme :lol:

    Everything goes in the plugins folder bar the aerofoils (keep them somewhere else).
    The software sorts out which menus it attaches itself to - phlatFoil attaches to the 'Tools' menu and phoilPal to the 'Plugins' menu automagically.
    Hope that helps.

    Cheers

    Neil
     

Share This Page