Drawing entities above all others entities using TempEntities

It is common the need to draw an entity that will be shown above all other entities. For this task, there is not a univocal answer and there are different solutions that can be implemented based on the working context. For one of them, you can use the approach shown here.

Here, we discuss the possibility to use our TempEntities to achieve this task. 

Here is a sample code:

Brep brp1 = Brep.CreateBox(10, 10, 10);
model1.Entities.Add(brp1, Color.Green);
Joint jt = new Joint(Point3D.Origin, 5, 2);
jt.Regen(1);
model1.TempEntities.Add(jt, Color.Red);
Mesh arrow = Mesh.CreateArrow(Point3D.Origin, new Vector3D(0, 1, 1), 3, 7, 5, 3, 12,Mesh.natureType.Plain, Mesh.edgeStyleType.Free);
arrow.Translate(-10,-10,-10);
arrow.Regen(0.1);
model1.TempEntities.Add(arrow,Color.Yellow);

  

mceclip0.png

TempEntities represent a powerful tool since they are natively supported, but they involve a few limitations that are listed below:

  1. They are neither affected by light nor by shadows effects (e.g they are drawn always in displayType.Flat); 
  2. The textures are not supported within TempEntitites. (e.g only the base color of the entity is supported, Multicolor mesh will be shown with a single color);
  3. They are not customizable (e.g every derived entity will be treated as the default base entity);
  4. They need to be regenerated before added to the Tempentities list;
  5. Only IFace and ICurve are supported (this excludes BlockReference, Picture, PlanarEntity and PointCloud);
  6. Attributes are not supported;
  7. They are not selectable;
  8. The zoom fit ignores them.

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.