Search code examples
c#eyeshot

How to change position of Mesh.CreateBox


What is the way to set the Position (x, y, z) after create a mesh on create

  var pb1 = Mesh.CreateBox(8000, 400, 300);
  pb1.Color = Color.FromArgb(255, (byte)rand.Next(255), (byte)rand.Next(255), (byte)rand.Next(255));
  pb1.ColorMethod = colorMethodType.byEntity;
  pb1.Translate(0, 0, 0);

so i want set to x=0, y=400, z=0

SelectedEntity.Translate(0, 400, 0)

dosent work it set always to another position


Solution

  • You need to call model1.Entities.Regen() to see the effect of your changes. After the Translate() call, the Entity.RegenMode changes to regenType.RegenAndCompile status. The Model.Entities.Regen() call loops over all items of the Model.Entities collection and resolves their status to regenType.NotNeeded. regenType.NotNeeded status means that what you see is the actual position of the entity.