MoI discussion forum
MoI discussion forum

Full Version: Anyone wish to develop a custom script?

Show messages:  1-6  …  47-66  67-86  87-106  107-126  127-146  147-166  167-186  …  207-223

From: bemfarmer
1 Jan 2012   [#107]
Thought of an alternative method.
Use the script to draw the two arcs.
Modify the menu .htm to request the user to pick the intersection point(s).
Recalculate the control "spline."
Delete arcs, and redraw smaller arcs, or user can do the trims and deletions...
From: Michael Gibson
1 Jan 2012   [#108] In reply to [#106]
Hi Brian,

> Created one object list by: var arc1List = arcFactory1.calculate();
> Created second object by: var arc2List = arcFactory2.calculate();
>
> How is it possible to combine the two lists into one list, with the two arcs in it?

An object list has a method addObject( obj ) that you can call to add the given object to the end of the list.

And you can retrieve an object from a list by using the item( index ) method.

So what you are talking about would be something like (assuming each has 1 object in it currently):

arc1List.addObject( arc2List.item(0) );



> Or create one list in some other script way?

You could also create a completely new list by calling moi.geometryDatabase.createObjectList() and then add both arcs to it.


> I do not understand the difference between an Object, and the Object
> List created by a factory.calculate();

Well, an object list is a container that can hold multiple objects - since some geometry factories may generate multiple objects the .calculate() method cannot just return a single object since that would then not work for those kinds of factories that generate multiple outputs.

So in order to be consistent across any kind of use, the calculate() method always returns an object list, even if the output was only a single object like it often is in most of the draw-type commands. So in cases like that it's a list but it contains just 1 object which you can access using the .item() method on the object list.

That's one of the details that's kind of more complicated currently with the factory system being oriented towards working with a number of different commands, at some point in the future it is likely that I'll add some more kinds of geometry creation methods that will just pass all the different parameters to a creation function rather than setting up factory inputs like the current system - the factory input system is more oriented towards each different input being wired up to some kind of UI control.


Check out this previous post for a plug-in command that creates a couple of circles and intersects them to create a point - it sounds like that is pretty close to what you are trying to do currently:
http://moi3d.com/forum/index.php?webtag=MOI&msg=3832.15


- Michael
From: bemfarmer
1 Jan 2012   [#109] In reply to [#108]
Thank you very much Michael. :-))
It Worked. Have created the leading edge arc, and the spline, for the AirFoil.

Now need to "duplicate" the code for the trailing edge...
From: bemfarmer
1 Jan 2012   [#110]
Attached is "provisory culmination" (just read that in a book...) of the Prop_Design_Geo Script for MoI.
There may still be errors.

The "tangent" points, and the two edge radius arcs, are created non-interactively.
Dealing with the leading edge and trailing edge, non-interactively, took about 100 lines of code.
This might be reduced a bit by calling a few functions..
Creating the points with interactive MoI takes perhaps 10 actions +/-.

Michaels help was invaluable.

Learned a great deal about MoI scripting, on this project.
:-))

Attachments:
PROP_DESIGN_GEO_1_1_2012.7z


From: Unknown user
2 Jan 2012   [#111] In reply to [#110]
thanks brian,

can't wait to check it out.

anthony
From: Unknown user
2 Jan 2012   [#112] In reply to [#111]
hey brian,

got a chance to try it out. works good. a few things though. with the le the way you are doing it you have to take out point .75, .835. Otherwise the curve fit gets messed up. I just manually deleted it and the curve adjusted, however, most people wouldn't know to do that. Also a long time ago burrman and Michael found that you couldn't have the le and te be two arcs. Which is what I had. It would be like mirroring the two that you have in there. So I mirror the spline then make the arcs, so that they are one arc for the le and one for the te. You can do this easily from what you have generated. But most people wouldn't know to do that. I'm curious if its taking 100 lines of code to find the tangent points, wouldn't it have been easier to just enter the tangent point i added into the array?

anthony
From: bemfarmer
2 Jan 2012   [#113] In reply to [#112]
Hi Anthony, :-)

I'll remove the .75 and .835 from the code for the spline.


>Also a long time ago burrman and Michael found that you couldn't have the le and te be two arcs. Which is what I had. It would be like mirroring the two that you have in there. So I mirror the spline then make the arcs, so that they are one arc for the le and one for the te. You can do this easily from what you have generated.

Edit: Okay, I think I see your point now. A mirrored half arc (even if joined,) has different control points from one full arc.
It should be possible to easily adjust the arc creation code, to do so. Just start on the tangent point, and make the stop point the tangent point adjusted with negative Y value.

>wouldn't it have been easier to just enter the tangent point i added into the array?
Yes, this is true, if the points are on the arc, (or within .001 ?). But initially, did not have the data point, and later the two points did not quite lie on the arc, so got started trying to figure out how to script the arcs and tangent points, to be more or less "exact".
If you like, I can make a version using your given tangent points, if they are within "tolerance"? (for a reduced code linecount.)
From: Unknown user
2 Jan 2012   [#114] In reply to [#113]
hi brian,

i didn't realize the tangent points i added were wrong until you pointed it out. i did two checks, but was zoomed out to much to see the error. they had round-off error because i reduced them to the naca three decimal format. so i increased them to the max moi allows. that should fix the problem. but doing it the way you have it now is fine. it should be just as accurate. sorry i was too late to save you all the added coding. but it seems like you enjoyed the process of learning moi scripting.

i look forward to the next version.

anthony
From: Frenchy Pilou (PILOU)
2 Jan 2012   [#115]
Does this srcipt can be used also for boats' propeller blades ?
From: Unknown user
2 Jan 2012   [#116] In reply to [#115]
Hi,

No, sorry. However, if anyone knows enough about marine propellers, it should be a pretty easy code update. I don't know anything about them, but I think you would need to use a hydrofoil model rather than an airfoil model, account for cavitation, chord distribution options appropriate for marine propellers, and use water properties rather than an atmospheric model. Other than that, PROP_DESIGN probably would work for marine propellers. But you would need to consult with an expert or be an expert in that area to know for sure.

I have a version of PROP_DESIGN, that I haven't released, that you can enter any fluid properties. So that part is already done. I looked into hydrofoil properties at one time, but not having any experience with that, I didn't pursue it too much. If that is something you know a lot about, the two of us should be able to get the update done.

I only have expertise with aircraft propellers. Which is why I haven't adapted PROP_DESIGN for helicopters either. I could adapt it to wind turbines but have no desire to. Just not into wind turbines. I have been interested in propellers since college. Studied them for years and then took jobs in that industry to learn more. So a lot of man hours went into PROP_DESIGN. I am not the kind of person to just code something I don't know anything about.

PROP_DESIGN is open source though. I released it as public domain software. So you could do anything you like with it. No need for my permission or anything. My hope is people will develop it more and make it even better. I wanted to give students something better than I had to go through to learn about propellers. I accomplished that. However, as far as software goes, PROP_DESIGN could use the love/development attention of many types of engineers (marine, aerospace, structural, software).

Anthony
From: bemfarmer
2 Jan 2012   [#117]
Custom distance script can be used to measure the Y and Z coordinates of a point, (distance to axi.)
First increase the number of digits, as previously posted on the forum.
From: bemfarmer
4 Jan 2012   [#118]
Here is an update to the MoI script version, PropDesignGeoOptionA.
It uses Option A, pre-calculated "tangent" points, which is probably better than trying
to find the points by arc, or circle interception, as there could be zero or two intersection points.

Most of the coding for the previous version was re-used, with slight change, except for the four arc intercept coding.

The mirrored tangent points were easy to get, just negate the y values. The arcs are on both sides, no need to mirror them.

I think it would be easy to script mirror the airfoil spline, with the mirror factory...

On a side note, still trying to figure out how to extract the x, y, and z values, from a given point.
Either vector math, or the "get" method in point?
From: Unknown user
4 Jan 2012   [#119] In reply to [#118]
thanks brian,

i'll check it out. i was just about to post a hack i did of your script to give you and idea of what i was thinking. but let me see what you have here. i noticed one thing with the previous scripts. they don't use the hub end point input. what that input is for is to make a circle at the point specified. the circle would be in the top view and use the point on the 1/4 chord line. the first point being counted as 1. so it should be relatively easy. since that input would just be making a circle. i was able to use trial and error and beat the script into submission. however, i don't know enough to actually add something to it. i was just editing what existed.

anthony
From: Unknown user
4 Jan 2012   [#120]
hi brian,

i like what you got. its a little better than what i did. the only thing i changed form what you have now is removing the points from the le and te rails. the points are only needed on the 1/4 rail for reference. i also tried taking the curve off the 1/4 rail but that made it graphically hard to look at. so i ended up putting the curve back on the rail along with the points.

if you do go about mirroring the airfoil spline, would it be possible to join all four curves of the airfoil definition, so that it was one joined curve. if so, it would be reading to sweep, with no work.

great job.

anthony
From: bemfarmer
4 Jan 2012   [#121] In reply to [#119]
Hi Anthony,

> noticed one thing with the previous scripts. they don't use the hub end point input. what that input is for is to make a circle at the point specified. the circle would be in the top view and use the point on the 1/4 chord line. the first point being counted as 1. so it should be...

Are you talking about HEP? All I see in the GEO script, is HEP = HEP + 1, but do not see where HEP is used anywhere in the GEO fortran code.???

Is the Airfoil curve near the center of the "fan," and offset from the centerpoint, by the Hub "radius"?

Please explain a bit, or elaborate. (Seems to me, the one time I imported to MoI, your fortran points, that there was an offset from y=0 axis???)
From: Unknown user
4 Jan 2012   [#122] In reply to [#121]
Hi Brian,

Yes the geo code does not use the hub end point. I think it was just left there because I copied that code from PROP_DESIGN. PROP_DESIGN uses the hub end point. But for the MoI script you can either take it out completely or if you want to implement it, it would be a circle at the specified point along the quarter chord line. 0,0,0 being point number 1. So if the user input 3. That would be two points away from 0,0,0 along the quarter chord line.

The fortran codes should place the airfoil in the right view of MoI with the quarter chord point being at 0,0,0. There should be no offset.

I just updated PROP_DESIGN, PROP_DESIGN_OPT, and PROP_DESIGN_GEO. After working withe MoI for awhile and your script. I took lessons learned to make it even easier to go from PROP_DESIGN to MoI. I will be posting an updated screencast soon. You won't believe how easy it is now.

This method may help you with scripting as well. Since everything is practically done for you. You could just read in the various files. The leading and trailing edge radius' can be created with the two point arc now. It should all be clear in the forthcoming screencast. Give me about an hour to get it recorded and uploaded.

PROP_DESIGN and PROP_DESIGN_OPT are on my website. Here is the latest version of PROP_DESIGN_GEO.

Anthony

Edit; Download the latest version, contained in a later post.
From: Unknown user
4 Jan 2012   [#123]
Here is a link to an updated screencast, showing how to import the PROP_DESIGN .XYZ data files into MoI for the purpose of creating an aircraft propeller blade model.

Anthony

Edit; the latest screencast link is in a later post
From: Michael Gibson
4 Jan 2012   [#124] In reply to [#118]
Hi Brian,

> On a side note, still trying to figure out how to extract the x, y,
> and z values, from a given point.
> Either vector math, or the "get" method in point?

There are a couple of different kinds of points - there's a "point object" which is one that can be added to the geometry database and will then show up on the screen and can be selected and assigned an object name and so forth, and then there's a plain data point as well that only contains x,y,z values and nothing else.

If you have a "point geometry database object" that you might have got as a result from a geometry factory or something like that, then that object has a "pt" property on it that will return a plain data point that has the x,y,z values in it.

So you would do something like this to get the data structure point from a point object:

var datapt = pt_object.pt;

Then for the data structure type point has x,y,z values that can be accessed like:

var x = datapt.x;
var y = datapt.y;
var z = datapt.z;

Hope this helps!

- Michael
From: Unknown user
4 Jan 2012   [#125]
Here is the NACA 4, 5, and 6 series airfoil generator from the PDAS site. I compiled it and created an input file for the NACA 65A009. This is an update to the code I posted previously from their site. It has about half as much error as the older version. However, it is still a substantial amount of error (max. of 2.28% for the new version compared to 5% for the old version). I wouldn't recommend using this code for the 6 series. I'm providing it here for anyone interested.

The updated code is a lot more convenient to use than the older version. It outputs to gnuplot rather than a postscript file. The output matches the coordinate locations of the original data sheet which is nice. I included all of the example input files that the author included in a different folder. I have a comparison file in there comparing the NACA 65A009 data points from the code to those of the original document.

Anthony

update; have since determined it is best to use the data points from NACA RM L51I12 for the 65A009 definition.
From: bemfarmer
4 Jan 2012   [#126]
Attached is another update for PropDesignGeo script, which includes mirror of the curve.

The mirror code is very similar to the arccenter code.

One peculiarity is that the Base pt / End pt line appears on the screen, until Done or Cancel are selected. ?????

// To Mirror curve, using the CoordinateFrame:
// Create a point Object list, of the Curve points.
var CurvePtList = factory.calculate();
// The same Coordinate leFrame with same Base pt, pt_leArccenter, can be used.
var factoryMirror = moi.command.createFactory( 'mirror' );
factoryMirror.setInput( 0, CurvePtList );
factoryMirror.setInput( 1, leFrame );
// Set End pt. (pt on y axis works fine.)
factoryMirror.setInput( 2, pt_teArccenter );
// Save the current curve pt mirror.
AirFoilfactories.push( factoryMirror );


Attachments:
PropDesignGeoOpA1_5_2012.7z

Image Attachments:
MirrorBaseAndEndPt_Visible.PNG 


Show messages:  1-6  …  47-66  67-86  87-106  107-126  127-146  147-166  167-186  …  207-223