Hello everyone. I have a problem which i will be explaining in full detail.
I am working on a Grasshopper code which is supposed to import a given semi ship hull surface, manipulate it and then export the halfbreadth table to a .dat file. The exporting should be in a dynamic way, because i want to connect the .dat file to a resistance prediction program to monitor the change of ship drag in every single surface manipulation process. The problem starts after obtaining the final hull form surface.
The code places the hull surface on rhino origin then provides scaling, editing three selected frame sections and limited extension to the overall length. After this point i need to obtain the points by which the half breadth table will be formed.
HALF BREADTH TABLE
This table, which all the naval architects know for sure, should basically look like a matrix whose column and row amounts are determined by number sliders within grasshopper. The content of the table should be the y axis values of the needed points (considering the centerline of the ship is on the x axis). In the code i am sharing, the row and column numbers are 6 and 16 respectively. So the first row in table should start with the y values of the points with 6 lowest x values, in an array of increasing z axis values. The second row will include 2nd set of 6 y axis values with 2nd lowest x values, again in an array of increasing z axis values. In the .dat file the numbers in each row should be seperated with one space from another. An example .dat file is also attached (it is a .txt file since uploading a .dat is not supported).
My opinion is, the best way to do this is creating the table as complete as it can be within the grasshopper code and then exporting it to the .dat file. To do this i probably need a ghpython component or something like it because i guess it will be hard to achieve all with only grasshopper, but if you don’t think so i would like to hear why and how.
Biggest problem is that i cannot get a proper point cloud projected on the final surface. One thing that makes the problem a little more complex is that my example 6x16 equispaced point cloud will never meet the surface completely through project command, since the half of a hull surface is not in a shape of rectangle when looked from y axis (in the rhino file it is “front” angle). Unfortunately the halfbreadth table has to be filled with zeros where the points don’t meet the surface. (See attached pictures with boundary surfaces)
To overcome this;
- I have made a boundary surface by splitting an xz plane with the hull surface and then projected my points, which actually worked but gave a list of 97 numbers instead of 96.
- I have also tried projecting equispaced lines to the surface first, then intersected them with equispaced surfaces and obtained numbers, the result was still the same.
- Then i have projected equispaced lines which are in positive Z direction to the surface, then picked their lower end points and added lines to these points which are in negative z direction, then intersected these curves and lines with equispaced surfaces. This time i got 106 points.
- Thought maybe in 3rd trial the equispaced surfaces intersect with curves and lines at the same time and there is a lot of duplicated data in point cloud, used “Delete Consecutive” command, the result was 101 points, still not 96.
- Thought about rounding some numbers after first successful project, but would probably lead problems in some cases where the 3rd or 4th number after comma might be necessary.
Since i want this Grasshopper code to be able to work properly on different type of hull forms (or at least maybe over 70 percent of the surfaces imported), i need a reliable way to get this done.
*To run the code just set the given half hull surface in the rhinoceros to the surface command on the far left in Grasshopper code, marked with green and specified as “Vessel 1”
- Red marked JOIN command through middle of the code is the finalized surface.
- Light red marked command group (and the cont.) is the section that i have tried to obtain the projected points on surface to form the halfbreadth table.
- Yellow marked command group is the section that i have tried anything that came in my mind.
- Red marked JOIN command after light red marked group is the finalized surface with the boundary xz surface.
-Finalized surface is the merge of five seperate surfaces. I couldn’t make the manipulation and rebuilding part without separating the aft and fore parts of the surface and using split commands.
-I had so many problems with projecting line and point sets to the final surface, the set was getting projected only some certain parts of the multisurface.
-The boundary surface only worked with the form inside the attached Rhino file. I had many issues with other forms since they had discontinuities on their border curves. (as looked in grasshopper)
-At a point i had better results after moving the surface in positive y direction and then projecting the points.
-There are ExcelWrite commands within the code since i have tried to export data to excel, then to matlab to arrange it and export, but then decided it would be better not to include matlab just for data arranging.
-“Frame” and “Waterline” means column and row numbers respectively, by means of halfbreadth table.
-I can surely be counted as a rookie in Grasshopper.
I have asked questions about this before and shortened the code to the amount in which the problem existed before sharing, but this time i would like to share the whole Grasshopper code due to possibility of very inefficient ways of mine that make things already unnecessarily complicated or inappropriate.
I will be waiting to hear some answers, thank you.
Gh Halfbreadth Export.gh (98.6 KB)
input_halfbreadth.txt (590 Bytes)