3D

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
Yfke
Posts: 14
Joined: Friday 13 April, 2018 - 10:54

3D

Post by Yfke »

Hi!

I would like to move products in slow motion by a conveyor from one server to the other, without this being at the expense of calculations with realtime
Does anyone know if this is possible?

I also would like to assign different product colours, to different routing products. I can change the colour of all products in 3D, but not specific once based on difference in label values. Does anyone know how to fix this?

Thanks in advance!

Kind regards,
Yfke
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: 3D

Post by HarryBunnik »

Ha Yfke,

Here you have to help me since I'm not sure what you exactly want.

What do you mean by: "move products in slow motion by a conveyor from one server to the other, without this being at the expense of calculations with real-time"? If you move a product over a conveyor, it will cost time, so it will affect your overall process time in the simulation.

In case you're worrying that this animation is costing too much calculation speed and will slow down your model, you can use pressing the space bar (within the 2D or 3D animation window) to freeze the animation. In that case, the effects will be minimal.

Also here I need a bit more information what you want. You can create a case statement:

Case(
Label([Product1], i) - Label([Product2], i),
{Answer 1}
Color(i) := ColorRed,
{Answer 2}
Color(i) := ColorBlue,
{Answer 3}
Color(i) := ColorGreen,
{Answer 4}
Color(i) := ColorPurple
)

but I'm not sure if that is doing what you have in mind.

I hope it helps you or that you can give me a bit more information.

Gr. Harry
Yfke
Posts: 14
Joined: Friday 13 April, 2018 - 10:54

Re: 3D

Post by Yfke »

Hi Harry,

Everytime when a product leaves a server, I would like to change to colour in 3D if the label called "type" is equal to 1.
I added in the trigger to exit of the server the following code:
If(Label([Rush], i) := 1, Icon(i) := IconByName([circlered]))
Yfke
Posts: 14
Joined: Friday 13 April, 2018 - 10:54

Re: 3D

Post by Yfke »

On this way, the colour of the icon will be changed. But not in 3D. Do you know how I can change colours of product in 3D? I hope it is clear now.
Yfke
Posts: 14
Joined: Friday 13 April, 2018 - 10:54

Re: 3D

Post by Yfke »

Sorry, I ment the label "Rush" instead of the label "Type", of course.
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: 3D

Post by HarryBunnik »

Ha Yfke,

One option would be to change the 3D visualization of the product to a cube (so not a carton box, barrel, ...). Of these more basic objects, you can change the color relatively easy using:

color(i) := ColorRed.

If it is really important to keep the carton box, we can have another look at it, but that will be a bit more complicated. Then you need to have access to the atom editor, where you can update the 3D code (double clicking in the 3Ddraw code field will bring forward the original code from the library atom, after answer yes to the question if you want to inherit the code). Here you can add at the beginning some code to draw a basic ball over the product. Likely that is also one of the basic options of the product, so we can simply copy the code standing there to the beginning (before the case statement, not higher since that code is manipulating the location of the product.

{** Ball **}
Do(
c.CenterPoint := Max(c.DrawXsize / 2, Max(c.DrawYsize / 2, zSize / 2)),
Ball( c.CenterPoint, c.CenterPoint, c.CenterPoint, c.CenterPoint, 180, 360, 0, 0, 0, Color)
),

Then you'll have to alter the Z-location of the ball to ensure that it is drawn floating over the product. And perhaps play a bit with the size of the ball.
And the same code as given earlier for the cube will be enough to change the color of the ball as well while keeping the carton box or any other 3D model.

I hope it helps you further,

Gr. Harry
Yfke
Posts: 14
Joined: Friday 13 April, 2018 - 10:54

Re: 3D

Post by Yfke »

Thanks Harry,

I figured it out with your suggestions
Post Reply