Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <c>PolyfaceMeshFace</c> class.
 /// </summary>
 /// <remarks>
 /// By default the face is made up of three vertexes.
 /// </remarks>
 public PolyfaceMeshFace()
     : base(DxfObjectCode.Vertex)
 {
     this.flags = VertexTypeFlags.PolyfaceMeshVertex;
     this.vertexIndexes = new int[3];
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
 }
Exemple #2
0
 /// <summary>
 /// Intitializes a new instance of the <c>Attribute</c> class.
 /// </summary>
 /// <param name="definition"><see cref="AttributeDefinition">Attribute definition</see>.</param>
 /// <param name="value">Attribute value.</param>
 public Attribute(AttributeDefinition definition, object value)
     : base(DxfObjectCode.Attribute)
 {
     this.definition = definition;
     this.value = value;
     this.color = definition.Color;
     this.layer = definition.Layer;
     this.lineType = definition.LineType;
 }
 /// <summary>
 /// Initializes a new instance of the <c>PolylineVertex</c> class.
 /// </summary>
 public PolyfaceMeshVertex()
     : base(DxfObjectCode.Vertex)
 {
     this.flags = VertexTypeFlags.PolyfaceMeshVertex | VertexTypeFlags.Polygon3dMesh;
     this.location = Vector3f.Zero;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <c>Polyline3dVertex</c> class.
 /// </summary>
 /// <param name="location">Polyline <see cref="Vector3f">vertex</see> coordinates.</param>
 public Polyline3dVertex(Vector3f location)
     : base(DxfObjectCode.Vertex)
 {
     this.flags = VertexTypeFlags.Polyline3dVertex;
     this.location = location;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <c>PolyfaceMesh</c> class.
 /// </summary>
 public PolyfaceMesh()
     : base(DxfObjectCode.Polyline)
 {
     this.flags = PolylineTypeFlags.PolyfaceMesh;
     this.faces = new List<PolyfaceMeshFace>();
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.endSequence = new EndSequence();
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <c>Point</c> class.
 /// </summary>
 public Point()
     : base(DxfObjectCode.Point)
 {
     this.location = Vector3f.Zero;
     this.thickness = 0.0f;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
 }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <c>Polyline3d</c> class.
 /// </summary>
 /// <param name="vertexes">3d polyline <see cref="Polyline3dVertex">vertex</see> list.</param>
 public Polyline3d(List<Polyline3dVertex> vertexes)
     : base(DxfObjectCode.Polyline)
 {
     this.flags = PolylineTypeFlags.Polyline3D;
     this.vertexes = vertexes;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.endSequence = new EndSequence();
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <c>Polyline3d</c> class.
 /// </summary>
 /// <param name="vertexes">3d polyline <see cref="Polyline3dVertex">vertex</see> list.</param>
 /// <param name="isClosed">Sets if the polyline is closed</param>
 public Polyline3d(List<Polyline3dVertex> vertexes, bool isClosed)
     : base(DxfObjectCode.Polyline)
 {
     this.flags = isClosed ? PolylineTypeFlags.ClosedPolylineOrClosedPolygonMeshInM | PolylineTypeFlags.Polyline3D : PolylineTypeFlags.Polyline3D;
     this.vertexes = vertexes;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.endSequence = new EndSequence();
 }
Exemple #9
0
 /// <summary>
 /// Initializes a new instance of the <c>Circle</c> class.
 /// </summary>
 public Circle()
     : base(DxfObjectCode.Circle)
 {
     this.center = Vector3f.Zero;
     this.radius = 1.0f;
     this.thickness = 0.0f;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
 }
Exemple #10
0
 /// <summary>
 /// Initializes a new instance of the <c>Line</c> class.
 /// </summary>
 public Line()
     : base(DxfObjectCode.Line)
 {
     this.startPoint = Vector3f.Zero;
     this.endPoint = Vector3f.Zero;
     this.thickness = 0.0f;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
 }
Exemple #11
0
 /// <summary>
 /// Initializes a new instance of the <c>PolylineVertex</c> class.
 /// </summary>
 /// <param name="location">Polyline <see cref="Vector2f">vertex</see> coordinates.</param>
 public PolylineVertex(Vector2f location)
     : base(DxfObjectCode.Vertex)
 {
     this.flags = VertexTypeFlags.PolylineVertex;
     this.location = location;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.bulge = 0.0f;
     this.beginThickness = 0.0f;
     this.endThickness = 0.0f;
 }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the <c>Solid</c> class.
 /// </summary>
 /// <param name="firstVertex">Solid <see cref="Vector3f">first vertex</see>.</param>
 /// <param name="secondVertex">Solid <see cref="Vector3f">second vertex</see>.</param>
 /// <param name="thirdVertex">Solid <see cref="Vector3f">third vertex</see>.</param>
 /// <param name="fourthVertex">Solid <see cref="Vector3f">fourth vertex</see>.</param>
 public Solid(Vector3f firstVertex, Vector3f secondVertex, Vector3f thirdVertex, Vector3f fourthVertex)
     : base(DxfObjectCode.Solid)
 {
     this.firstVertex = firstVertex;
     this.secondVertex = secondVertex;
     this.thirdVertex = thirdVertex;
     this.fourthVertex = fourthVertex;
     this.thickness = 0.0f;
     this.normal = Vector3f.UnitZ;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
 }
 /// <summary>
 /// Initializes a new instance of the <c>Polyline</c> class.
 /// </summary>
 /// <param name="vertexes">Polyline <see cref="LightWeightPolylineVertex">vertex</see> list in object coordinates.</param>
 /// <param name="isClosed">Sets if the polyline is closed</param>
 public LightWeightPolyline(List<LightWeightPolylineVertex> vertexes, bool isClosed)
     : base(DxfObjectCode.LightWeightPolyline)
 {
     this.vertexes = vertexes;
     this.isClosed = isClosed;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
     this.elevation = 0.0f;
     this.thickness = 0.0f;
     this.flags = isClosed ? PolylineTypeFlags.ClosedPolylineOrClosedPolygonMeshInM : PolylineTypeFlags.OpenPolyline;
 }
Exemple #14
0
 /// <summary>
 /// Initializes a new instance of the <c>NurbsCurve</c> class.
 /// </summary>
 public NurbsCurve()
 {
     this.controlPoints = new List<NurbsVertex>();
     this.normal = Vector3f.UnitZ;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.order = 0;
     this.curvePoints = 30;
     this.elevation = 0.0f;
     this.thickness = 0.0f;
     this.normal = Vector3f.UnitZ;
 }
Exemple #15
0
 /// <summary>
 /// Initializes a new instance of the <c>Arc</c> class.
 /// </summary>
 /// <param name="center">Arc <see cref="SharpDxf.Vector3f">center</see> in object coordinates.</param>
 /// <param name="radius">Arc radius.</param>
 /// <param name="startAngle">Arc start angle in degrees.</param>
 /// <param name="endAngle">Arc end angle in degrees.</param>
 /// <remarks>The center Z coordinate represents the elevation of the arc along the normal.</remarks>
 public Arc(Vector3f center, float radius, float startAngle, float endAngle)
     : base(DxfObjectCode.Arc)
 {
     this.center = center;
     this.radius = radius;
     this.startAngle = startAngle;
     this.endAngle = endAngle;
     this.thickness = 0.0f;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
 }
Exemple #16
0
        /// <summary>
        /// Initializes a new instance of the <c>Block</c> class.
        /// </summary>
        /// <param name="name">Block name.</param>
        public Block(string name)
            : base(DxfObjectCode.Block)
        {
            if (string.IsNullOrEmpty(name))
                throw (new ArgumentNullException("name"));

            this.name = name;
            this.basePoint = Vector3f.Zero;
            this.layer = Layer.Default;
            this.attributes = new Dictionary<string, AttributeDefinition>();
            this.entities = new List<IEntityObject>();
            this.record=new BlockRecord(name);
            this.end = new BlockEnd(this.layer);
        }
Exemple #17
0
 /// <summary>
 /// Initializes a new instance of the <c>NurbsCurve</c> class.
 /// </summary>
 /// <param name="controlPoints">The nurbs curve <see cref="SharpDxf.Entities.NurbsVertex">control point</see> list.</param>
 /// <param name="order">The nurbs curve order.</param>
 public NurbsCurve(List<NurbsVertex> controlPoints, int order)
 {
     if (controlPoints.Count<order)
         throw new ArgumentOutOfRangeException("order",order,"The order of the curve must be less or equal the number of control points.");
     this.controlPoints = controlPoints;
     this.normal = Vector3f.UnitZ;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.order = order;
     this.curvePoints = 30;
     this.elevation = 0.0f;
     this.thickness = 0.0f;
     this.normal = Vector3f.UnitZ;
 }
Exemple #18
0
 /// <summary>
 /// Initializes a new instance of the <c>Text</c> class.
 /// </summary>
 public Text()
     : base(DxfObjectCode.Text)
 {
     this.value = string.Empty;
     this.basePoint = Vector3f.Zero;
     this.alignment = TextAlignment.BaselineLeft;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
     this.style = TextStyle.Default;
     this.rotation = 0.0f;
     this.height = 0.0f;
     this.widthFactor = 1.0f;
     this.obliqueAngle = 0.0f;
 }
Exemple #19
0
 /// <summary>
 /// Initializes a new instance of the <c>Ellipse</c> class.
 /// </summary>
 /// <param name="center">Ellipse <see cref="Vector3f">center</see> in object coordinates.</param>
 /// <param name="majorAxis">Ellipse major axis.</param>
 /// <param name="minorAxis">Ellipse minor axis.</param>
 /// <remarks>The center Z coordinate represents the elevation of the arc along the normal.</remarks>
 public Ellipse(Vector3f center, float majorAxis, float minorAxis)
     : base(DxfObjectCode.Ellipse)
 {
     this.center = center;
     this.majorAxis = majorAxis;
     this.minorAxis = minorAxis;
     this.startAngle = 0.0f;
     this.endAngle = 360.0f;
     this.rotation = 0.0f;
     this.curvePoints = 30;
     this.thickness = 0.0f;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
 }
Exemple #20
0
        /// <summary>
        /// Initializes a new instance of the <c>Insert</c> class.
        /// </summary>
        /// <param name="block">Insert block definition.</param>
        /// <param name="insertionPoint">Insert <see cref="Vector3f">point</see>.</param>
        public Insert(Block block, Vector3f insertionPoint)
            : base(DxfObjectCode.Insert)
        {
            if (block == null)
                throw new ArgumentNullException("block");

            this.block = block;
            this.insertionPoint = insertionPoint;
            this.scale = new Vector3f(1.0f, 1.0f, 1.0f);
            this.rotation = 0.0f;
            this.normal = Vector3f.UnitZ;
            this.layer = Layer.Default;
            this.color = AciColor.ByLayer;
            this.lineType = LineType.ByLayer;
            this.attributes = new List<Attribute>();
            foreach (AttributeDefinition attdef in block.Attributes.Values)
            {
                this.attributes.Add(new Attribute(attdef));
            }
            this.endSequence = new EndSequence();
        }
Exemple #21
0
 /// <summary>
 /// Determines if a specified layer exists in the table.
 /// </summary>
 /// <param name="layer">Layer to locate.</param>
 /// <returns>True if the specified layer exists or false in any other case.</returns>
 public bool ContainsLayer(Layer layer)
 {
     return this.layers.ContainsKey(layer.Name);
 }
Exemple #22
0
 /// <summary>
 /// Initializes a new instance of the <c>EndSequence</c> class.
 /// </summary>
 public EndSequence()
     : base(DxfObjectCode.EndSequence)
 {
     this.layer = Layer.Default;
 }
Exemple #23
0
        private Layer GetLayer(string name)
        {
            if (this.layers.ContainsKey(name))
            {
                return this.layers[name];
            }

            //just in case the layer has not been defined in the table section
            var layer = new Layer(name);
            this.layers.Add(layer.Name, layer);
            return layer;
        }
Exemple #24
0
 /// <summary>
 /// Initializes a new instance of the <c>Polyline</c> class.
 /// </summary>
 /// <param name="vertexes">Polyline <see cref="PolylineVertex">vertex</see> list in object coordinates.</param>
 public Polyline(List<PolylineVertex> vertexes)
     : base(DxfObjectCode.Polyline)
 {
     this.vertexes = vertexes;
     this.isClosed = false;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
     this.elevation = 0.0f;
     this.thickness = 0.0f;
     this.flags = PolylineTypeFlags.OpenPolyline;
     this.endSequence = new EndSequence();
 }
 /// <summary>
 /// Intitializes a new instance of the <c>AttributeDefiniton</c> class.
 /// </summary>
 /// <param name="id">Attribute identifier, the parameter <c>id</c> string cannot contain spaces.</param>
 public AttributeDefinition(string id)
     : base(DxfObjectCode.AttributeDefinition)
 {
     if (id.Contains(" "))
         throw new ArgumentException("The id string cannot contain spaces", "id");
     this.id = id;
     this.flags = AttributeFlags.Visible;
     this.text = string.Empty;
     this.value = null;
     this.basePoint = Vector3f.Zero;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.style = TextStyle.Default;
     this.alignment = TextAlignment.BaselineLeft;
     this.height = this.style.Height == 0 ? 1.0f : this.style.Height;
     this.widthFactor = this.style.WidthFactor;
     this.rotation = 0.0f;
     this.normal = Vector3f.UnitZ;
 }
 /// <summary>
 /// Initializes a new instance of the <c>Polyline</c> class.
 /// </summary>
 public LightWeightPolyline()
     : base(DxfObjectCode.LightWeightPolyline)
 {
     this.vertexes = new List<LightWeightPolylineVertex>();
     this.isClosed = false;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
     this.elevation = 0.0f;
     this.flags = PolylineTypeFlags.OpenPolyline;
 }
Exemple #27
0
 /// <summary>
 /// Initializes a new instance of the <c>Text</c> class.
 /// </summary>
 /// <param name="text">Text string.</param>
 /// <param name="basePoint">Text base <see cref="Vector3f">point</see>.</param>
 /// <param name="height">Text height.</param>
 /// <param name="style">Text <see cref="TextStyle">style</see>.</param>
 public Text(string text, Vector3f basePoint, float height, TextStyle style)
     : base(DxfObjectCode.Text)
 {
     this.value = text;
     this.basePoint = basePoint;
     this.alignment = TextAlignment.BaselineLeft;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
     this.style = style;
     this.height = height;
     this.widthFactor = style.WidthFactor;
     this.obliqueAngle = style.ObliqueAngle;
     this.rotation = 0.0f;
 }
Exemple #28
0
 /// <summary>
 /// Initializes a new instance of the <c>Arc</c> class.
 /// </summary>
 public Arc()
     : base(DxfObjectCode.Arc)
 {
     this.center = Vector3f.Zero;
     this.radius = 0.0f;
     this.startAngle = 0.0f;
     this.endAngle = 0.0f;
     this.thickness = 0.0f;
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
     this.normal = Vector3f.UnitZ;
 }
Exemple #29
0
 /// <summary>
 /// Initializes a new instance of the <c>PolylineVertex</c> class.
 /// </summary>
 /// <param name="x">X coordinate.</param>
 /// <param name="y">Y coordinate.</param>
 /// <param name="z">Z coordinate.</param>
 public Polyline3dVertex(float x, float y, float z)
     : base(DxfObjectCode.Vertex)
 {
     this.flags = VertexTypeFlags.Polyline3dVertex;
     this.location = new Vector3f(x, y, z);
     this.layer = Layer.Default;
     this.color = AciColor.ByLayer;
     this.lineType = LineType.ByLayer;
 }
Exemple #30
0
 /// <summary>
 /// Initializes a new instance of the <c>BlockEnd</c> class.
 /// </summary>
 public BlockEnd(Layer layer)
     : base(DxfObjectCode.BlockEnd)
 {
     this.layer = layer;
 }