/// <summary> /// Initializes a new instance of the <c>PolylineVertex</c> class. /// </summary> /// <param name="location">Polyface mesh vertex <see cref="Vector3d">location</see>.</param> public PolyfaceMeshVertex(Vector3d location) : base(DxfObjectCode.Vertex) { this.flags = VertexTypeFlags.PolyfaceMeshVertex | VertexTypeFlags.Polygon3dMesh; this.location = location; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; }
/// <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(double x, double y, double z) : base(DxfObjectCode.Vertex) { this.flags = VertexTypeFlags.Polyline3dVertex; this.location = new Vector3(x, y, z); this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; }
/// <summary> /// Initializes a new instance of the <c>Polyline3dVertex</c> class. /// </summary> /// <param name="location">Polyline <see cref="Vector3">vertex</see> coordinates.</param> public Polyline3dVertex(Vector3 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>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> /// Initializes a new instance of the <c>PolylineVertex</c> class. /// </summary> public PolyfaceMeshVertex() : base(DxfObjectCode.Vertex) { this.flags = VertexTypeFlags.PolyfaceMeshVertex | VertexTypeFlags.Polygon3dMesh; this.location = Vector3d.Zero; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; }
/// <summary> /// Initializes a new instance of the <c>Layer</c> class. /// </summary> /// <param name="name">Layer name.</param> public Layer(string name) : base(name, DxfObjectCode.Layer) { this.color = AciColor.Default; this.lineType = LineType.Continuous; this.isVisible = true; this.plot = true; this.lineweight = Lineweight.Default; }
/// <summary> /// Initializes a new instance of the PolylineVertex class. /// </summary> /// <param name="x">X coordinate.</param> /// <param name="y">Y coordinate.</param> /// <param name="z">Z coordinate.</param> public PolyfaceMeshVertex(float x, float y, float z) : base(DxfObjectCode.Vertex) { this.flags = VertexTypeFlags.PolyfaceMeshVertex | VertexTypeFlags.Polygon3dMesh; this.location = new Vector3f(x, y, z); this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; }
/// <summary> /// Extract and convert geometry attributes from the netDXF entity /// </summary> /// <param name="entity"></param> /// <returns></returns> public static GeometryAttributes ExtractAttributes(netDxf.Entities.EntityObject entity) { AciColor color = entity.Color; if (color == null || color.IsByLayer) color = entity.Layer?.Color; return new GeometryAttributes( entity.Handle, entity.Layer?.Name, new ColourBrush(Convert(color))); }
/// <summary> /// Initializes a new instance of the <c>Arc</c> class. /// </summary> /// <param name="center">Arc <see cref="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 Hatch() : base(DxfObjectCode.Hatch) { this.entities = new List <IEntityObject>(); this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.normal = Vector3f.UnitZ; basePoint = Vector3d.Zero; }
/// <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> /// <param name="location">Point <see cref="Vector3f">location</see>.</param> public Point(Vector3f location) : base(DxfObjectCode.Point) { this.location = location; this.thickness = 0.25d; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.normal = Vector3f.UnitZ; }
/// <summary> /// Initializes a new instance of the <c>HatchGradientPattern</c> class as a default linear gradient. /// </summary> /// <param name="description">Description of the pattern (optional, this information is not saved in the dxf file). By default it will use the supplied name.</param> public HatchGradientPattern(string description = null) : base("SOLID", description) { this.color1 = AciColor.Blue; this.color2 = AciColor.Yellow; this.singleColor = false; this.gradientType = HatchGradientPatternType.Linear; this.tint = 1.0; this.centered = true; }
/// <summary> /// Initializes a new instance of the <c>Polyline3d</c> class. /// </summary> public Polyline3d() : base(DxfObjectCode.Polyline) { this.flags = PolylineTypeFlags.Polyline3D; this.vertexes = new List <Polyline3dVertex>(); 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>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>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>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>Point</c> class. /// </summary> public Point() : base(DxfObjectCode.Point) { this.location = Vector3d.Zero; this.thickness = 0.0f; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.normal = Vector3d.UnitZ; }
/// <summary> /// Initializes a new instance of the <c>HatchGradientPattern</c> class as a default linear gradient. /// </summary> /// <param name="description">Description of the pattern (optional, this information is not saved in the DXF file). By default it will use the supplied name.</param> public HatchGradientPattern(string description) : base("SOLID", description) { this.color1 = AciColor.Blue; this.color2 = AciColor.Yellow; this.singleColor = false; this.gradientType = HatchGradientPatternType.Linear; this.tint = 1.0; this.centered = true; }
/// <summary> /// Initializes a new instance of the <c>Hatch</c> class. /// </summary> /// <remarks> /// The hatch boundary paths must be on the same plane as the hatch. /// The normal and the elevation of the boundary paths will be omited (the hatch elevation and normal will be used instead). /// Only the x and y coordinates for the center of the line, ellipse, circle and arc will be used. /// </remarks> /// <param name="pattern"><see cref="HatchPattern">Hatch pattern</see>.</param> /// <param name="boundaryPaths">A list of <see cref="HatchBoundaryPath">boundary paths</see>.</param> public Hatch(HatchPattern pattern, List <HatchBoundaryPath> boundaryPaths) : base(DxfObjectCode.Hatch) { this.pattern = pattern; this.boundaryPaths = boundaryPaths; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.normal = Vector3.UnitZ; }
/// <summary> /// Initializes a new instance of the <c>Circle</c> class. /// </summary> /// <param name="center">Circle <see cref="Vector3d">center</see> in object coordinates.</param> /// <param name="radius">Circle radius.</param> /// <remarks>The center Z coordinate represents the elevation of the arc along the normal.</remarks> public Circle(Vector3d center, double radius) : base(DxfObjectCode.Circle) { this.center = center; this.radius = radius; this.thickness = 0.0f; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.normal = Vector3d.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> /// <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>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>HatchGradientPattern</c> class as a two color gradient. /// </summary> /// <param name="color1">Gradient <see cref="AciColor">color</see> 1.</param> /// <param name="color2">Gradient <see cref="AciColor">color</see> 2.</param> /// <param name="type">Gradient <see cref="HatchGradientPatternType">type</see>.</param> /// <param name="description">Description of the pattern (optional, this information is not saved in the DXF file). By default it will use the supplied name.</param> public HatchGradientPattern(AciColor color1, AciColor color2, HatchGradientPatternType type, string description) : base("SOLID", description) { this.color1 = color1 ?? throw new ArgumentNullException(nameof(color1)); this.color2 = color2 ?? throw new ArgumentNullException(nameof(color2)); this.singleColor = false; this.gradientType = type; this.tint = 1.0; this.centered = true; }
/// <summary> /// Initializes a new instance of the <c>HatchGradientPattern</c> class as a single color gradient. /// </summary> /// <param name="color">Gradient <see cref="AciColor">color</see>.</param> /// <param name="tint">Gradient tint.</param> /// <param name="type">Gradient <see cref="HatchGradientPatternType">type</see>.</param> /// <param name="description">Description of the pattern (optional, this information is not saved in the DXF file). By default it will use the supplied name.</param> public HatchGradientPattern(AciColor color, double tint, HatchGradientPatternType type, string description) : base("SOLID", description) { this.color1 = color ?? throw new ArgumentNullException(nameof(color)); this.color2 = this.Color2FromTint(tint); this.singleColor = true; this.gradientType = type; this.tint = tint; this.centered = true; }
/// <summary> /// Convert a netDXF AciColor to a Nucleus Colour /// </summary> /// <param name="color"></param> /// <returns></returns> public static Colour Convert(AciColor color) { if (color.Index == AciColor.Default.Index) { return(Colour.Black); } else { return(new Colour(color.R, color.G, color.B)); } }
/// <summary> /// Initializes a new instance of the <c>Layer</c> class. /// </summary> /// <param name="name">Layer name.</param> public Layer(string name) : base(name, DxfObjectCode.Layer, true) { this.reserved = name.Equals("0", StringComparison.OrdinalIgnoreCase); this.color = AciColor.Default; this.lineType = LineType.Continuous; this.isVisible = true; this.plot = true; this.lineweight = Lineweight.Default; this.transparency = new Transparency(0); }
/// <summary> /// Initializes a new instance of the <c>Line</c> class. /// </summary> public Line() : base(DxfObjectCode.Line) { this.startPoint = Vector3d.Zero; this.endPoint = Vector3d.Zero; this.thickness = 0.0f; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.normal = Vector3d.UnitZ; }
/// <summary> /// Initializes a new instance of the <c>Line</c> class. /// </summary> /// <param name="startPoint">Line <see cref="Vector3">start point.</see></param> /// <param name="endPoint">Line <see cref="Vector3">end point.</see></param> public Line(Vector3 startPoint, Vector3 endPoint) : base(DxfObjectCode.Line) { this.startPoint = startPoint; this.endPoint = endPoint; this.thickness = 0.0; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.normal = Vector3.UnitZ; }
/*Draw Point*/ public static void DrawPoint(netDxf.Entities.Point xPoint, Canvas mainCanvas) { double size = 15.0; AciColor myColor = xPoint.getColor(); Canvas canvas1 = DrawUtils.GetPoint(TypeConverter.ToMediaColor(myColor.ToColor()), size, 0); getMaxPt(xPoint.Position); Canvas.SetLeft(canvas1, xPoint.Position.X - size); Canvas.SetTop(canvas1, mainCanvas.Height - (xPoint.Position.Y + size)); mainCanvas.Children.Add(canvas1); }
///// <summary> ///// Layer properties plot style name. ///// </summary> //public string PlotStyleName //{ // get { return this.plotStyle; } // set { this.plotStyle = value; } //} #endregion #region public methods /// <summary> /// Copy the layer to the current layer state properties. /// </summary> /// <param name="layer">Layer from which copy the properties.</param> /// <param name="options">Layer properties to copy.</param> public void CopyFrom(Layer layer, LayerPropertiesRestoreFlags options) { if (!string.Equals(this.name, layer.Name, StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("Only a layer with the same name can be copied.", nameof(layer)); } this.flags = LayerPropertiesFlags.None; if (options.HasFlag(LayerPropertiesRestoreFlags.Hidden)) { if (!layer.IsVisible) { this.flags |= LayerPropertiesFlags.Hidden; } } if (options.HasFlag(LayerPropertiesRestoreFlags.Frozen)) { if (layer.IsFrozen) { this.flags |= LayerPropertiesFlags.Frozen; } } if (options.HasFlag(LayerPropertiesRestoreFlags.Locked)) { if (layer.IsLocked) { this.flags |= LayerPropertiesFlags.Locked; } } if (options.HasFlag(LayerPropertiesRestoreFlags.Plot)) { if (layer.Plot) { this.flags |= LayerPropertiesFlags.Plot; } } if (options.HasFlag(LayerPropertiesRestoreFlags.Linetype)) { this.linetype = layer.Linetype.Name; } if (options.HasFlag(LayerPropertiesRestoreFlags.Color)) { this.color = (AciColor)layer.Color.Clone(); } if (options.HasFlag(LayerPropertiesRestoreFlags.Lineweight)) { this.lineweight = layer.Lineweight; } if (options.HasFlag(LayerPropertiesRestoreFlags.Transparency)) { this.transparency = (Transparency)layer.Transparency.Clone(); } }
/// <summary> /// Initializes a new instance of the <c>PolylineVertex</c> class. /// </summary> /// <param name="x">X coordinate.</param> /// <param name="y">Y coordinate.</param> public PolylineVertex(float x, float y) : base(DxfObjectCode.Vertex) { this.flags = VertexTypeFlags.PolylineVertex; this.location = new Vector2f(x, y); 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>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>Vertex</c> class. /// </summary> /// <param name="position">Vertex <see cref="Vector3">location</see>.</param> public Vertex(Vector3 position) : base(DxfObjectCode.Vertex) { flags = VertexTypeFlags.PolylineVertex; this.position = position; layer = Layer.Default; color = AciColor.ByLayer; linetype = Linetype.ByLayer; bulge = 0.0; startWidth = 0.0; endWidth = 0.0; }
/// <summary> /// Initializes a new instance of the <c>Arc</c> class. /// </summary> /// <param name="center">Arc <see cref="netDxf.Vector3d">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(Vector3d center, double radius, double startAngle, double 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 = Vector3d.UnitZ; }
/// <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>HatchGradientPattern</c> class as a single color gradient. /// </summary> /// <param name="color">Gradient <see cref="AciColor">color</see>.</param> /// <param name="tint">Gradient tint.</param> /// <param name="type">Gradient <see cref="HatchGradientPatternType">type</see>.</param> /// <param name="description">Description of the pattern (optional, this information is not saved in the dxf file). By default it will use the supplied name.</param> public HatchGradientPattern(AciColor color, double tint, HatchGradientPatternType type, string description = null) : base("SOLID", description) { if (color == null) throw new ArgumentNullException("color"); this.color1 = color; this.color2 = this.Color2FromTint(tint); this.singleColor = true; this.gradientType = type; this.tint = tint; this.centered = true; }
/// <summary> /// Initializes a new instance of the <c>Solid</c> class. /// </summary> /// <param name="firstVertex">Solid <see cref="Vector3d">first vertex</see>.</param> /// <param name="secondVertex">Solid <see cref="Vector3d">second vertex</see>.</param> /// <param name="thirdVertex">Solid <see cref="Vector3d">third vertex</see>.</param> /// <param name="fourthVertex">Solid <see cref="Vector3d">fourth vertex</see>.</param> public Solid(Vector3d firstVertex, Vector3d secondVertex, Vector3d thirdVertex, Vector3d fourthVertex) : base(DxfObjectCode.Solid) { this.firstVertex = firstVertex; this.secondVertex = secondVertex; this.thirdVertex = thirdVertex; this.fourthVertex = fourthVertex; this.thickness = 0.0f; this.normal = Vector3d.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 = Vector3d.UnitZ; this.elevation = 0.0; 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 = Vector3d.UnitZ; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.order = 0; this.curvePoints = 30; this.elevation = 0.0; this.thickness = 0.0f; this.normal = Vector3d.UnitZ; }
/// <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; }
internal Layer(string name, bool checkName) : base(name, DxfObjectCode.Layer, checkName) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name), "The layer name should be at least one character long."); this.IsReserved = name.Equals(DefaultName, StringComparison.OrdinalIgnoreCase); this.color = AciColor.Default; this.linetype = Linetype.Continuous; this.isVisible = true; this.plot = true; this.lineweight = Lineweight.Default; this.transparency = new Transparency(0); }
/// <summary> /// Initializes a new instance of the <c>MTextFormattingOptions</c> class /// </summary> /// <param name="style">Current style of the <see cref="MText">multiline text</see> entity.</param> public MTextFormattingOptions(TextStyle style) { this.bold = false; this.italic = false; this.overline = false; this.underline = false; this.color = null; this.fontName = null; this.aligment = TextAligment.Default; this.heightFactor = 1.0; this.obliqueAngle = 0.0; this.characterSpaceFactor = 1.0; this.widthFactor = 1.0; this.style = style; }
/// <summary> /// Initializes a new instance of the <c>NurbsCurve</c> class. /// </summary> /// <param name="controlPoints">The nurbs curve <see cref="netDxf.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 = Vector3d.UnitZ; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.order = order; this.curvePoints = 30; this.elevation = 0.0; this.thickness = 0.0f; this.normal = Vector3d.UnitZ; }
/// <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>Text</c> class. /// </summary> public Text() : base(DxfObjectCode.Text) { this.value = string.Empty; this.basePoint = Vector3d.Zero; this.alignment = TextAlignment.BaselineLeft; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.normal = Vector3d.UnitZ; this.style = TextStyle.Default; this.rotation = 0.0f; this.height = 0.0f; this.widthFactor = 1.0f; this.obliqueAngle = 0.0f; }
protected EntityObject(EntityType type, string dxfCode) : base(dxfCode) { this.type = type; this.color = AciColor.ByLayer; this.layer = Layer.Default; this.lineType = LineType.ByLayer; this.lineweight = Lineweight.ByLayer; this.transparency = Transparency.ByLayer; this.lineTypeScale = 1.0; this.isVisible = true; this.normal = Vector3.UnitZ; this.reactors = new List<DxfObject>(); this.xData = new XDataDictionary(); this.xData.AddAppReg += this.XData_AddAppReg; this.xData.RemoveAppReg += this.XData_RemoveAppReg; }
/// <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>Face3D</c> class. /// </summary> /// <param name="firstVertex">3d face <see cref="Vector3d">first vertex</see>.</param> /// <param name="secondVertex">3d face <see cref="Vector3d">second vertex</see>.</param> /// <param name="thirdVertex">3d face <see cref="Vector3d">third vertex</see>.</param> /// <param name="fourthVertex">3d face <see cref="Vector3d">fourth vertex</see>.</param> public Face3d(Vector3d firstVertex, Vector3d secondVertex, Vector3d thirdVertex, Vector3d fourthVertex) : base(DxfObjectCode.Face3D) { this.firstVertex = firstVertex; this.secondVertex = secondVertex; this.thirdVertex = thirdVertex; this.fourthVertex = fourthVertex; this.edgeFlags = EdgeFlags.Visibles; this.layer = Layer.Default; this.color = AciColor.ByLayer; this.lineType = LineType.ByLayer; this.xData = new Dictionary<ApplicationRegistry, XData>(); }
/// <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="Vector3d">point</see>.</param> /// <param name="height">Text height.</param> /// <param name="style">Text <see cref="TextStyle">style</see>.</param> public Text(string text, Vector3d 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 = Vector3d.UnitZ; this.style = style; this.height = height; this.widthFactor = style.WidthFactor; this.obliqueAngle = style.ObliqueAngle; this.rotation = 0.0f; }
/// <summary> /// Initializes a new instance of the <c>MLineStyle</c> class. /// </summary> /// <param name="name">MLine style name.</param> /// <param name="elements">Elements of the multiline.</param> /// <param name="description">MLine style description (optional).</param> public MLineStyle(string name, IEnumerable<MLineStyleElement> elements, string description) : base(name, DxfObjectCode.MLineStyle, true) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException(nameof(name), "The multiline style name should be at least one character long."); if (elements == null) throw new ArgumentNullException(nameof(elements)); this.elements = new ObservableCollection<MLineStyleElement>(); this.elements.BeforeAddItem += this.Elements_BeforeAddItem; this.elements.AddItem += this.Elements_AddItem; this.elements.BeforeRemoveItem += this.Elements_BeforeRemoveItem; this.elements.RemoveItem += this.Elements_RemoveItem; this.elements.AddRange(elements); if (this.elements.Count < 1) throw new ArgumentOutOfRangeException(nameof(elements), this.elements.Count, "The elements list must have at least one element."); this.elements.Sort(); // the elements list must be ordered this.flags = MLineStyleFlags.None; this.description = string.IsNullOrEmpty(description) ? string.Empty : description; this.fillColor = AciColor.ByLayer; this.startAngle = 90.0; this.endAngle = 90.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; }