Voeg een polyline toe
Contents
[
Hide
]Hoe een polyline toe te voegen
Probleem: Hoe een polyline toe te voegen (CADNET-1349).
Tips: Hiervoor kun je CadPolyline gebruiken en Cad3DPoint-objecten eraan toevoegen. Voor 2D kun je ook CadLwPolyline en Cad2DPoint gebruiken en de polyline vervolgens aan tekenobjecten toevoegen.
Voorbeeld:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CadPolyline polyline = new CadPolyline(); | |
polyline.ChildObjects.Add(new Cad3DVertex(){LocationPoint = new Cad3DPoint(-5, -5, 0)}); | |
polyline.ChildObjects.Add(new Cad3DVertex() { LocationPoint = new Cad3DPoint(-5, 10, 0) }); | |
polyline.ChildObjects.Add(new Cad3DVertex() { LocationPoint = new Cad3DPoint(20, 10, 0) }); | |
polyline.ChildObjects.Add(new Cad3DVertex() { LocationPoint = new Cad3DPoint(20, -5, 0) }); | |
polyline.Flag = CadPolylineFlag.CLOSED_POLY; | |
List<CadBaseEntity> entities = new List<CadBaseEntity>(); | |
entities.Add(polyline); | |
cadImage.Entities = entities.ToArray(); | |
cadImage.UpdateSize(); | |
Or for 2D polyline | |
CadLwPolyline cadLwPolyline = new CadLwPolyline(); | |
cadLwPolyline.Coordinates = new List<Cad2DPoint>(); | |
cadLwPolyline.Coordinates.Add(new Cad2DPoint(-5d, -5d)); | |
cadLwPolyline.Coordinates.Add(new Cad2DPoint(-5d, 10d)); | |
cadLwPolyline.Coordinates.Add(new Cad2DPoint(20d, 10d)); | |
cadLwPolyline.Coordinates.Add(new Cad2DPoint(20d, -5d)); | |
cadLwPolyline.Flag = CadLwPolylineFlag.Closed; | |
cadLwPolyline.ConstantWidth = 0.1; | |
List<CadBaseEntity> entities = new List<CadBaseEntity>(); | |
entities.Add(cadLwPolyline); | |
cadImage.Entities = entities.ToArray(); | |
cadImage.UpdateSize(); |