Ahah,  I think I have it sorted now.  Your idea about a static class
put me on the right track.

It needs a little tweaking to get right, but here is my code:

[code]
package {
        import flash.display.*;
        import flash.geom.Vector3D;

        import away3d.arcane;
        import away3d.extrusions.*;
        import away3d.materials.*;
        import away3d.core.utils.*;
        import away3d.core.base.*;

        public class RoundTube {

                public function RoundTube():void {
                        //super();
                }

                //draw round tube
                public static function drawRoundTube(radius:Number,
thickness:Number, depth:Number):Mesh {
                        var profile:Array = [
                                new Vector3D(-radius, depth, 0),
                                new Vector3D(-radius, 0, 0)
                        ];

                        var roundTube:LatheExtrusion = new 
LatheExtrusion(profile);
                        roundTube.subdivision = 18;
                        roundTube.thickness = thickness;
                        roundTube.centerMesh = false;
                        roundTube.revolutions = 1;
                        roundTube.bothsides = false;

                        //flips the model over
                        roundTube.rotationX = -90;

                        var wMaterial:WireColorMaterial = new 
WireColorMaterial(0x373737);
                        wMaterial.wireColor = 0x373737;
                        roundTube.material = wMaterial;

                        return(roundTube);

                        trace("model complete");

                }


        }
}
[/code]

Thanks for your help.



On Apr 1, 3:28 pm, Melanikus <[email protected]> wrote:
> Hiya,
>
> What you describe is probably exacly what I need to do.  This is
> mostly my inexperience with AS3 showing. I am just having a problem
> making the class return the LatheExtrusion as a Mesh that I can then
> pick up on and display.
>
> I just need a Class that I can use to generate a LatheExtrusion
> multiple times.
>
> var model01:RoundTube = new RoundTube(10, 2, 300);
> var model02:RoundTube = new RoundTube(10, 5, 150);
> var model03:RoundTube = new RoundTube(14, 2, 60);
>
> I'll continue to slog on.  I have a few more things I can try.  I'll
> let you know if I get anywhere.
>
> Thanks.
>
> On Apr 1, 2:29 pm, Fabrice3D <[email protected]> wrote:
>
> > why don't you explain what you want to do exactly.
> > this class extends Object3D and has a mesh generator build a mesh, which is 
> > already extending Object3D...
>
> > simply make a static class that returns you an instance LatheExtrusion as 
> > Mesh
>
> > in your main code simply import this class
> > and say
>
> > var myTube:Mesh = MagicTubeMaker.pleaseDoYourThing(depth, thickness, etc);
>
> > On Apr 1, 2011, at 3:11 PM, Melanikus wrote:
>

Reply via email to