POV-Ray : Newsgroups : povray.newusers : Problem with placing objects Server Time
14 May 2024 08:12:29 EDT (-0400)
  Problem with placing objects (Message 1 to 2 of 2)  
From: gharryh
Subject: Problem with placing objects
Date: 7 Jun 2013 17:55:01
Message: <web.51b255c3130fec16520168c30@news.povray.org>
I have written een scene that makes a form out of three objects, top, grnd and
bottom.
Rendering top and grnd works perfect, but when i include the bottompart all
shifts down.
I have looked for some time now where the fault might be but cant find it.
[code]
//

#version 3.6;
#declare black_al = color red .17 green .17 blue .17 ;
//#declare inc_testmode=true;                   // Uncomment for NOT showing
grid and axle

#include "colors.inc"   // Standard Color definitions
#include "textures.inc"   // Standard Texture definitions
#include "functions.inc"  // internal functions usable in user defined functions
// various metal colors, finishes and textures
// brass, copper, chrome, silver
#include "metals.inc"
#include "ExtraTextures.inc"

camera
{
 #local tt = 450;    //let's you change the distance easily
 location <-tt,tt,-tt>
 //location<0,5,-50>   //alternate location
 look_at <0,0,0>    //best to select the approximate centre of the object
 angle 30
}

light_source { <100, 100, -100> White}
light_source { <-100, 100, -100> White }
light_source { <-100, 100, 100> White }
light_source { <100, 100, 100> White }
background{Grey}


#ifndef(inc_testmode)

//Size of the Grid Plane (+/- span)
#local XYZ_span=80;

//Orientation axes
cylinder{<-XYZ_span,0,0><XYZ_span,0,0>0.25 pigment{Blue}} //X
cylinder{<0,-XYZ_span,0><0,XYZ_span,0>0.25 pigment{Red}}  //Y
cylinder{<0,0,-XYZ_span><0,0,XYZ_span>0.25 pigment{Yellow}} //Z

// Useful GRIDS:
#local XYZ_step= 5 ;          // axis increment
#local XYZ_cnt = 0;           //  loop counter
#local xyz_thick = 0.125;     // grid line thickness

// GRID PLANES: Remove comment begin/end to activate & select PLANES:
#while (XYZ_cnt <= XYZ_span)

 //cylinder{<-XYZ_span,0,XYZ_cnt><XYZ_span,0,XYZ_cnt>xyz_thick pigment{Blue}}
// Positive Z-Lines
 //cylinder{<-XYZ_span,0,-XYZ_cnt><XYZ_span,0,-XYZ_cnt>xyz_thick pigment{Blue}}
// Negative Z-Lines

 //cylinder{<0,XYZ_cnt,-XYZ_span><0,XYZ_cnt,XYZ_span>xyz_thick pigment{Red}}  //
Positive Y-Z Plane Lines
 //cylinder{<0,-XYZ_cnt,-XYZ_span><0,-XYZ_cnt,XYZ_span>xyz_thick pigment{Red}}
// Negative Y-Z Plane Lines

 //cylinder{<-XYZ_span,XYZ_cnt,0><XYZ_span,XYZ_cnt,0>xyz_thick pigment{Red}}  //
Positive Y-X Plane Lines
 //cylinder{<-XYZ_span,-XYZ_cnt,0><XYZ_span,-XYZ_cnt,0>xyz_thick pigment{Red}}
// Negative Y-X Plane Lines

 //cylinder{<XYZ_cnt,0,-XYZ_span><XYZ_cnt,0,XYZ_span>xyz_thick pigment{Yellow}}
// Positive X-Lines
 //cylinder{<-XYZ_cnt,0,-XYZ_span><-XYZ_cnt,0,XYZ_span>xyz_thick
pigment{Yellow}} // Negative X-Lines

 #local XYZ_cnt = XYZ_cnt+XYZ_step;
#end

#end

#macro spindle_grnd()

#end

#macro housing_grnd(L1)
#local HL = L1 - 16;  // Total lenght mines top and bottom plate
union   {
        difference      {
                cylinder{<0,0,0><0,HL,0>27.5 texture{black_rough_paint} }  //
The outer cylinder with a diameter off 55mm
                cylinder{<0,0.5,0><0,HL+.5,0>25.5 texture{Brushed_Aluminum} }
              // Create a tube
        }       translate <0,-HL,0> translate <0,-8,0>         // Move it to the
correct position
} // end union
#end

#macro housing_top()
union   {
 difference      {       // Create the outher ring
        union   {
                cylinder{<0,0,0><0,-8,0>27.5 texture{ Silver_Metal} }
                cylinder{<0,0,0><0,2.5,0>16 texture{ Silver_Metal} }
        } // end union
        cylinder{<0,2.55,0><0,-8.5,0>14.4 texture{Brushed_Aluminum} }
        cylinder{<0,0.55,0><0,-8.5,0>2.5 texture{Brushed_Aluminum}
translate<20,0,0> rotate<0,45,0> }
        cylinder{<0,0.55,0><0,-8.5,0>2.5 texture{Brushed_Aluminum}
translate<20,0,0> rotate<0,135,0> }
        cylinder{<0,0.55,0><0,-8.5,0>2.5 texture{Brushed_Aluminum}
translate<20,0,0> rotate<0,225,0> }
        cylinder{<0,0.55,0><0,-8.5,0>2.5 texture{Brushed_Aluminum}
translate<20,0,0> rotate<0,315,0> }
 } // end difference
difference      {       // Create the rubber seal
        cylinder{<0,2.25,0><0,-8,0>14.5 pigment{Cherry_Wood} }
        cylinder{<0,3,0><0,-8.5,0>14 pigment{Cherry_Wood} }
        } // end difference
difference      {       // Create inner ring
        cylinder{<0,2.5,0><0,-8,0>14 texture{ Silver_Metal} }
        cylinder{<0,3,0><0,-8.5,0>12.5 texture{ Silver_Metal} }
 }
difference      {       // Create the top seal
        cylinder{<0,2.35,0><0,-8,0>12.5 pigment{Brown} }
        cylinder{<0,3,0><0,-8.5,0>8 pigment{Brown} }
    }
difference      {       // Create the inner ring
        cylinder{<0,2.5,0><0,-8,0>8 texture{ Silver_Metal} }
        cylinder{<0,3,0><0,-8.5,0>6 texture{ Silver_Metal} }
        }
}
#end

#macro housing_bottom(L1, L2, L3, L4, D2, D3, D4)
difference      {
        box{<-L4/2,0,L4/2><L4/2,8,-L4/2> }
        cylinder{<0,0.5,0><0,-L3,0>D2/2 }
        cylinder{<0,-0.5,0><0,8.5,0>13 }
        cylinder{<0,8.5,0><0,-.5,0>D4/2 translate<D3/2,0,0> rotate<0,45,0> }
        cylinder{<0,8.5,0><0,-.5,0>D4/2 translate<D3/2,0,0> rotate<0,135,0> }
        cylinder{<0,8.5,0><0,-.5,0>D4/2 translate<D3/2,0,0> rotate<0,225,0> }
        cylinder{<0,8.5,0><0,-.5,0>D4/2 translate<D3/2,0,0> rotate<0,315,0> }
}       texture{ Silver_Metal} translate <0,-L1,0> translate <0,-8,0>
#end

#macro housing_complete(L1, L2, L3, L4, D2, D3, D4)
union   {
        housing_top()
        housing_grnd(L1)
        housing_bottom(L1,L2, L3, L4, D2, D3, D4)
}
#end

#macro RE55_NEMA23(L1, L2, L3, L4, D2, D3, D4)
        housing_complete(L1, L2, L3, L4, D2, D3, D4)
#end

// Create a RE55 planetary gearbox type NEMA 23 2 stages (1:42)
// L1=86, L2=25, L3=3, L4=60 D1=11 D2=38,1 D3=66,67 D4=5,5
RE55_NEMA23(86, 25, 3, 60, 38.1, 66.67, 5.5)
[/code]
Any help would be welcome


Post a reply to this message

From: William F Pokorny
Subject: Re: Problem with placing objects
Date: 8 Jun 2013 07:01:54
Message: <51b30f22$1@news.povray.org>
On 06/07/2013 05:50 PM, gharryh wrote:
> #macro housing_bottom(L1, L2, L3, L4, D2, D3, D4)
> difference      {
>          box{<-L4/2,0,L4/2><L4/2,8,-L4/2> }
>          cylinder{<0,0.5,0><0,-L3,0>D2/2 }
>          cylinder{<0,-0.5,0><0,8.5,0>13 }
>          cylinder{<0,8.5,0><0,-.5,0>D4/2 translate<D3/2,0,0> rotate<0,45,0> }
>          cylinder{<0,8.5,0><0,-.5,0>D4/2 translate<D3/2,0,0> rotate<0,135,0> }
>          cylinder{<0,8.5,0><0,-.5,0>D4/2 translate<D3/2,0,0> rotate<0,225,0> }
>          cylinder{<0,8.5,0><0,-.5,0>D4/2 translate<D3/2,0,0> rotate<0,315,0> }
> }       texture{ Silver_Metal} translate <0,-L1,0> translate <0,-8,0>
> #end

If you look near the #end statement just above, it appears your texture 
and translate statements are actually outside the difference {} so they 
will get applied in the final union {}.

Bill P.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.