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);
TempEntities represent a powerful tool since they are natively supported, but they involve a few limitations that are listed below:
- They are neither affected by light nor by shadows effects (e.g they are drawn always in displayType.Flat);
- 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);
- They are not customizable (e.g every derived entity will be treated as the default base entity);
- They need to be regenerated before added to the Tempentities list;
- Only IFace and ICurve are supported (this excludes BlockReference, Picture, PlanarEntity and PointCloud);
- Attributes are not supported;
- They are not selectable;
- The zoom fit ignores them.