/// <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; }
/// <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>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; }
/// <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; }
/// <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(); }
/// <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; }
/// <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(); }
/// <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(); }
/// <summary> /// Initializes a new instance of the <c>Layer</c> class. /// </summary> /// <param name="name">Layer name.</param> public Layer(string name) : base(DxfObjectCode.Layer) { if (string.IsNullOrEmpty(name)) throw (new ArgumentNullException("name")); this.name = name; this.color = AciColor.Default; this.lineType = LineType.Continuous; this.isVisible = true; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }
/// <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>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; }
/// <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; }
/// <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(); }
/// <summary> /// Initializes a new instance of the <c>PolyfaceMeshFace</c> class. /// </summary> /// <param name="vertexIndexes">Array of indexes to the vertex list of a polyface mesh that makes up the face.</param> public PolyfaceMeshFace(int[] vertexIndexes) : base(DxfObjectCode.Vertex) { if (vertexIndexes == null) throw new ArgumentNullException("vertexIndexes"); if (vertexIndexes.Length>4) throw new ArgumentOutOfRangeException("vertexIndexes", vertexIndexes.Length, "The maximun number of index vertexes in a face is 4"); this.flags = VertexTypeFlags.PolyfaceMeshVertex; this.vertexIndexes = vertexIndexes; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; }
/// <summary> /// Determines if a specified line type exists in the table. /// </summary> /// <param name="lineType">Line type to locate.</param> /// <returns>True if the specified line type exists or false in any other case.</returns> public bool ContainsLineType(LineType lineType) { return this.lineTypes.ContainsKey(lineType.Name); }
private LineType GetLineType(string name) { if (this.lineTypes.ContainsKey(name)) { return this.lineTypes[name]; } //just in case the line type has not been defined in the table section var lineType = new LineType(name); this.lineTypes.Add(lineType.Name, lineType); return lineType; }
/// <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; }
/// <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> /// 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; }
/// <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; }
/// <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; }
/// <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; }
/// <summary> /// Writes a new line type to the table section. /// </summary> /// <param name="tl">Line type.</param> public void WriteLineType(LineType tl) { if (this.version == DxfVersion.AutoCad12) if (tl.Name == "ByLayer" || tl.Name == "ByBlock") return; if (this.activeTable != StringCode.LineTypeTable) { throw new InvalidDxfTableException(this.activeTable, this.file); } this.WriteCodePair(0, tl.CodeName); this.WriteCodePair(5, tl.Handle); this.WriteCodePair(100, SubclassMarker.TableRecord); this.WriteCodePair(100, SubclassMarker.LineType); this.WriteCodePair(70, 0); this.WriteCodePair(2, tl); this.WriteCodePair(3, tl.Description); this.WriteCodePair(72, 65); this.WriteCodePair(73, tl.Segments.Count); this.WriteCodePair(40, tl.Legth()); foreach (float s in tl.Segments) { this.WriteCodePair(49, s); if (this.version != DxfVersion.AutoCad12) this.WriteCodePair(74, 0); } }