SkyPirate1982
Member
For those of you that use Sketchup for concept design or just drawing, making airfoils is a pain. I found a plugin that will draw the airfoil from a dat file but it is old and doesn't work on new versions of Sketchup. After some digging I found a way to get it to work.
In Sketchup open the Ruby console and paste this in:
def airfoil_dat_main
model = Sketchup.active_model
entities = model.active_entities
c = 1 # used to skip first line in file
vert = []
filename = UI.openpanel "Import Airfoil data points","C:\","*.dat"
IO.foreach(filename){
|x|
if c == 1
c = 2
elsif
data = x.split
vert.push [data[0].to_f, data[1].to_f, 0.to_f]
end
}
new_line = entities.add_face vert
Sketchup.send_action("viewTop:")
Sketchup.send_action("viewZoomExtents:")
end
if( not file_loaded?("airfoil_dat.rb") )
add_separator_to_menu("Plugins")
UI.menu("Plugins").add_item("Airfoil data loader") { airfoil_dat_main }
file_loaded("airfoil_dat.rb")
end
This does need some help and if any of you know Ruby, please feel free to help finish this. My coding skills are slow and will take time to complete.
Here are some issues that I have found/not finished yet:
This is session based so much be done every time Sketchup is opened. Needs to be a real plugin.
Will create an airfoil with a 1" chord. This can be scaled but there needs to be a way to set the chord length
In Sketchup open the Ruby console and paste this in:
def airfoil_dat_main
model = Sketchup.active_model
entities = model.active_entities
c = 1 # used to skip first line in file
vert = []
filename = UI.openpanel "Import Airfoil data points","C:\","*.dat"
IO.foreach(filename){
|x|
if c == 1
c = 2
elsif
data = x.split
vert.push [data[0].to_f, data[1].to_f, 0.to_f]
end
}
new_line = entities.add_face vert
Sketchup.send_action("viewTop:")
Sketchup.send_action("viewZoomExtents:")
end
if( not file_loaded?("airfoil_dat.rb") )
add_separator_to_menu("Plugins")
UI.menu("Plugins").add_item("Airfoil data loader") { airfoil_dat_main }
file_loaded("airfoil_dat.rb")
end
This does need some help and if any of you know Ruby, please feel free to help finish this. My coding skills are slow and will take time to complete.
Here are some issues that I have found/not finished yet:
This is session based so much be done every time Sketchup is opened. Needs to be a real plugin.
Will create an airfoil with a 1" chord. This can be scaled but there needs to be a way to set the chord length