Menu

Semi-Cylinder

Help
Sergio
2017-05-24
2017-05-25
  • Sergio

    Sergio - 2017-05-24

    Is there a way of creating an object more or less like a semi Cylinder using the basic objects (without meshes)
    I think that is possible with super ellipsoid but maybe there is something simpler

     
  • Jerome.D (BeanzMaster)

    Hi what do you mean by "more or less like a semi Cylinder" ?

     
  • Sergio

    Sergio - 2017-05-25

    Hi ... sorry for the bad wording. I was refering to a figure like attached. I found how to do it using TGLExtrusionSolid sample cutoutstar just changing the equation for the points

     
  • Jerome.D (BeanzMaster)

    Cool can you give your sample code ?

     
  • Sergio

    Sergio - 2017-05-26

    Here is the part of the code where the cilinder and semi cilynder are
    . See attachment

                       Const    heigthGenerator=2.0;  lengthGenerator=7;
    

    var SCG1:TGLExtrusionSolid; I:interger; L_SF ... dimensions

    ///// the semi cilynder

                    MAKE_a_EXTRUSION(true,SCG1,'SCG1', L_SF[40]+ L_SF[41] ,0.5*heigthGenerator,0.8*L_SF[46]  ,clrred , 0.8 ,
                                   2*L_SF[41],  1, 0, 0,   0,  0,  1,    0,  0,   0,  true    ,0);
                    with SCG1.Contours do
                    begin
                      with Add.Nodes do
                         for i:=0 to 16 do    // 8 = numero de intervalos para desenhar semicirculo
                          begin
                             AddNode(heigthGenerator*sin ( i*(PI/8) ),heigthGenerator*cos (i*(PI/8) ), 5);
                          end;
                      SCG1.StructureChanged;
                    end;                         }
    
                       SCG1 := TGLExtrusionSolid.CreateAsChild(DC1);
                       with SCG1  do
                       begin
                         name:= 'SCG1';
                         Position.AsVector := VectorMake(L_SF[40] ,0.7*heigthGenerator,0.7*L_SF[46]);
                         Material.FrontProperties.Emission.Color:=clrRed   ;
                         Material.FrontProperties.diffuse.alpha:=0.8 ;      // 0.3
                         Material.BlendingMode := bmTransparency ;
                         Height := lengthGenerator;
                         Direction.AsVector := VectorMake(1, 0, 0 );
                         Up.AsVector        := VectorMake(0, 1, 0);
                         pitchAngle:= 0;
                         rollAngle := 0;
                         turnAngle := 0;
                         visible:= true;
                          Stacks:=16;
                          Material.MaterialLibrary := GLMaterialLibrary1 ;
                          Material.LibMaterialName := 'LibMaterial2' ;
                          GLMaterialLibrary1.Materials[3].shader:= GLOutlineShader1;
                          StructureChanged ;
                       end ;
                      with SCG1.Contours do
                       begin
                        with Add.Nodes do
                           for i:=0 to 8 do    // 8 = numero de intervalos para desenhar semicirculo
                            begin
                              AddNode(heigthGenerator*cos ( i*(PI/8) ),heigthGenerator*sin (i*(PI/8) ), 0);
                            end;
                        SCG1.StructureChanged;
                       end;
    
           //////////////////////////////////////// /red cilynder
    
                       ReactorA:= TGLAnnulus.CreateAsChild(DC1);
                 with ReactorA do
                  begin
                    Direction.SetVector(1, 0, 0);
                    Up.SetVector(0, 0, 1);
                    Height:=L_SF[17];
                    BottomRadius:=0.5*L_SF[9] ; BottomInnerRadius:=0.3*L_SF[9] ;
                    TopRadius   :=0.5*L_SF[9] ; TopInnerRadius   :=0.3*L_SF[9]; ;
                    Position.SetPoint(L_SF[40]   ,L_SF[9],L_SF[46]+L_SF[20]+L_SF[21]+L_SF[22]+L_SF[23]+0.5*L_SF[17] );
                    Scale.SetVector(1,1,1);
                    Stacks:=3;
                    Visible := True;
                    Material.FrontProperties.Emission.Color:=clrred   ;
                    Material.FrontProperties.diffuse.alpha:=0.8 ;      // 0.8
                    Material.BlendingMode := bmTransparency ;// Material.BlendingMode := bmOpaque;
                    Material.MaterialLibrary := GLMaterialLibrary1 ;
                    Material.LibMaterialName := 'LibMaterial2' ;
                    GLMaterialLibrary1.Materials[3].shader:= GLOutlineShader1;
                    StructureChanged;
                  end;
    
     
  • Sergio

    Sergio - 2017-05-26

    I forgot the attachment

    Please replace the above . Part was wrong

                       SCG1 := TGLExtrusionSolid.CreateAsChild(DC1);
                       with SCG1  do
                       begin
                         name:= 'SCG1';
                         Position.AsVector := VectorMake(L_SF[40] ,0.7*heigthGenerator,0.7*L_SF[46]);
                         Material.FrontProperties.Emission.Color:=clrRed   ;
                         Material.FrontProperties.diffuse.alpha:=0.8 ;      // 0.3
                         Material.BlendingMode := bmTransparency ;
                         Height := lengthGenerator;
                         Direction.AsVector := VectorMake(1, 0, 0 );
                         Up.AsVector        := VectorMake(0, 1, 0);
                         pitchAngle:= 0;
                         rollAngle := 0;
                         turnAngle := 0;
                         visible:= true;
                          Stacks:=16;
                          Material.MaterialLibrary := GLMaterialLibrary1 ;
                          Material.LibMaterialName := 'LibMaterial2' ;
                          GLMaterialLibrary1.Materials[3].shader:= GLOutlineShader1;
                          StructureChanged ;
                       end ;
                      with SCG1.Contours do
                       begin
                        with Add.Nodes do
                           for i:=0 to 8 do    // 8 = numero de intervalos para desenhar semicirculo
                            begin
                              AddNode(heigthGenerator*cos ( i*(PI/8) ),heigthGenerator*sin (i*(PI/8) ), 0);
                            end;
                        SCG1.StructureChanged;
                       end;
    
                  end;
    
     
  • Jerome.D (BeanzMaster)

    Thanks Sergio i'll make a sample whit that :D

     
  • Sergio

    Sergio - 2017-05-27

    Great .It would be great to see something as the single colored semi cilinder.png above

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.