[2023/06/28] netDxf 3.0 Release

[2023/06/28]
* Added the property WorkingFolder to DxfDocument.SupportFolders. When a file is loaded or saved, it will hold the full path where the file resides, by default it points to the current System.Environment.CurrentDirectory when the DxfDocument was created.
* Now you can change the Name and Style properties of LinetypeShapeSegment classes.
* Deleted the TextStyle constructors public TextStyle(string font) and public TextStyle(string fontFamily, FontStyle fontStyle), now you must also provide the table name.
* Deleted the ShapeStyle constructor public ShapeStyle(string file), now you must also provide the table name.
This commit is contained in:
haplokuon 2023-06-28 01:32:20 +02:00
Родитель 2dc25794c1
Коммит d53bd30849
256 изменённых файлов: 609 добавлений и 456 удалений

Просмотреть файл

@ -1,7 +1,7 @@
MIT License
Copyright (c) 2019-2022 Daniel Carvajal (haplokuon@gmail.com)
Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -37,8 +37,7 @@ public static void Main()
Are contained in the source code.
Well, at the moment they are just tests for the work in progress.
## Dependencies and distribution
Multitarget project, predefined frameworks for Net Framework 4.8, Net Standard 2.1, Net Core 3.1, NET 5.0, and NET 6.0.
Additionally the Net Standard 2.1 build requires a reference to the external library "System.Text.Encoding.CodePages".
Multitarget project, predefined frameworks for Net Framework 4.8 and NET 6.0.
## Compiling
Visual Studio 2022. The solution file is still usable by Visual Studio 2019 but it does not support NET 6.0.
netDxf is compatible with any net version from Net Framework 4.0.

Просмотреть файл

@ -19,8 +19,6 @@ using FontStyle = netDxf.Tables.FontStyle;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using Vector2 = netDxf.Vector2;
using Vector3 = netDxf.Vector3;
namespace TestDxfDocument
{
@ -2230,7 +2228,7 @@ namespace TestDxfDocument
public static void ShapeMirror()
{
ShapeStyle style = new ShapeStyle("shape.shx");
ShapeStyle style = new ShapeStyle("MyShapeStyle", "shape.shx");
Shape shape1 = new Shape("MyShape", style);
shape1.ObliqueAngle = 20;
@ -3244,7 +3242,7 @@ namespace TestDxfDocument
private static void Shape()
{
// create the shape style from the file where the shape definitions are stored
ShapeStyle style = new ShapeStyle("shape.shx");
ShapeStyle style = new ShapeStyle("MyShapeStyle", "shape.shx");
// create the shape entity from the style where the same named "MyShape" is stored (name case is ignored)
Shape shape = new Shape("MyShape", style);
@ -5699,7 +5697,7 @@ namespace TestDxfDocument
private static void MTextEntity()
{
TextStyle style = new TextStyle("Arial");
TextStyle style = new TextStyle("MyTextStyle", "Arial", FontStyle.Regular);
MText text1 = new MText(Vector2.Zero, 10, 0, style);
// you can set manually the text value with all available formatting commands
@ -6240,9 +6238,9 @@ namespace TestDxfDocument
private static void TestingTrueTypeFonts()
{
DxfDocument dxfText = new DxfDocument();
TextStyle textStyle1 = new TextStyle(@"arial.ttf");
TextStyle textStyle2 = new TextStyle("arialbi.ttf");
TextStyle textStyle3 = new TextStyle(@"C:\Windows\Fonts\91118.ttf");
TextStyle textStyle1 = new TextStyle("MyTextStyle", "arial.ttf");
TextStyle textStyle2 = new TextStyle("MyTextStyle", "arialbi.ttf");
TextStyle textStyle3 = new TextStyle("MyTextStyle", "C:\\Windows\\Fonts\\91118.ttf");
textStyle3.Name = textStyle3.FontFamilyName;
Text text1 = new Text("testing", Vector2.Zero, 6, textStyle1);
Text text2 = new Text("testing", Vector2.Zero, 6, textStyle2);
@ -6744,7 +6742,7 @@ namespace TestDxfDocument
block.AttributeDefinitions.Add(attdef);
Insert insert = new Insert(block, new Vector2(5, 5));
insert.Attributes[0].Style = new TextStyle("Arial.ttf");
insert.Attributes[0].Style = new TextStyle("MyTextStyle", "Arial.ttf");
dxf.Entities.Add(insert);
@ -6761,7 +6759,7 @@ namespace TestDxfDocument
dxf.Entities.Add(line);
DimensionStyle myStyle = new DimensionStyle("MyStyle");
myStyle.TextStyle = new TextStyle("Tahoma.ttf");
myStyle.TextStyle = new TextStyle("MyTextStyle", "Tahoma.ttf");
myStyle.DimSuffix = "mm";
myStyle.LengthPrecision = 2;
double offset = 7;
@ -7272,7 +7270,7 @@ namespace TestDxfDocument
private static void WriteNoAsciiText()
{
TextStyle textStyle = new TextStyle("Arial.ttf");
TextStyle textStyle = new TextStyle("MyTextStyle", "Arial.ttf");
DxfDocument dxf = new DxfDocument();
dxf.DrawingVariables.LastSavedBy = "ЉЊЋЌЍжзицрлЯ";
//Text text = new Text("ÁÉÍÓÚ áéíóú Ññ àèìòù âêîôû", Vector2.Zero,10);
@ -7762,7 +7760,7 @@ namespace TestDxfDocument
xdata.XDataRecord.Add(XDataRecord.CloseControlString);
//text
TextStyle style = new TextStyle("Times.ttf");
TextStyle style = new TextStyle("MyTextStyle", "Times.ttf");
//TextStyle style = TextStyle.Default;
MText mText = new MText(new Vector3(3, 2, 0), 1.0f, 100.0f, style);
mText.Layer = new Layer("Multiline Text");

Просмотреть файл

@ -1,6 +1,14 @@
## Change history
### [2023/04/27]
### [3.0.0 - 2023/06/28]
[2023/06/28]
* Added the property WorkingFolder to DxfDocument.SupportFolders. When a file is loaded or saved, it will hold the full path where the file resides, by default it points to the current System.Environment.CurrentDirectory when the DxfDocument was created.
* Now you can change the Name and Style properties of LinetypeShapeSegment classes.
* Deleted the TextStyle constructors public TextStyle(string font) and public TextStyle(string fontFamily, FontStyle fontStyle), now you must also provide the table name.
* Deleted the ShapeStyle constructor public ShapeStyle(string file), now you must also provide the table name.
[2023/04/27]
* Removed the taget frameworks netstandard2.1, netcoreapp3.1, and net5.0. Manually edit the netDxf.proj if you need them.
* Reworked how the references to a TableObject are tracked. Now they are internally stored in a dictionary instead of a list. While this will make adding entities to the document a little slower removing them will be much faster. See the sample TableObjectReferences().
* Add the method GetReferences to classes that inherit from TableObject. It returns the same list as the GetReferences method of its respective collection. See the sample TableObjectReferences().
@ -9,7 +17,7 @@
* (fixed) Removing dimension entities with no associated block. This is the case of dimensions whick block has left null to force the program that loads the resulting DXF to generate its own dimension block.
* (fixed) Error when loading a closed periodic spline from a DXF without weights.
### [2023/03/05]
[2023/03/05]
* Changed the default target framework 'net45' for 'net48'. The library is compatible will all 4.x net framework versions.
* Renamed the constant 'NET45' with 'NET4X' in netDxf.csproj. This constant must be applicable when compiling against any net framework 4.x versions.
* Normalizing a zero vector will return the Zero vector instead of NaN.
@ -26,10 +34,10 @@
* (fixed) Workaround for possible bad formatted tolerance string representations.
* (fixed) The vectors that define the start and end angle for 3 point angular dimensions can be parallel. This restriction still true for angular 2 line dimensions.
### [2022/11/02]
[2022/11/02]
* Fixed a bug in the AciColor.FromHsl method, under certain circumstances the RGB values where not calculated correctly.
### [2022/11/01]
[2022/11/01]
* Workaround for bad DXF files that contain polyface with invalid geometry, they will be removed.
* Workaround for bad DXF files that contains entities without handles. This may derive in unexpected side effects.
* Workaround for bad DXF files lacking BLOCK_RECORD tables for the defined blocks. The default block record values will be given what may have other side effects.
@ -38,18 +46,18 @@
* Added NET 6.0 as a target framework.
* Updated netDxf solution for Visual Studio 2022. The solution file is still usable by Visual Studio 2019 but it does not support NET 6.0.
### [2022/05/27]
[2022/05/27]
* Added the Matrix3.Reflection method that builds a reflection matrix for a mirror plane that passes through the origin. See sample ReflectionMatrix().
* Added the Matrix4.Reflection method that builds a reflection matrix for a mirror plane that passes through an arbitrary point. See sample ReflectionMatrix().
* Corrected the comments in the Ellipse.Center property.
* (fixed) In the Ellipse.SetAxis method the validity checks must be performed with the arguments of the method not the actual major and minor axis of the ellipse.
### [2022/04/19]
[2022/04/19]
* Added more GTE classes. See the Samples for GTE classes
* Deleted the SplineVertex class. Now the Spline constructors take two lists: a Vector3 to define the controls points and a double array to define the weights.
* PolygonMesh entities are now capable to handle closed in U and/or V surfaces.
### [2022/04/10]
[2022/04/10]
* Added CalculateTangent for Quadratic and Cubic Bezier curves.
* Added PolygonMesh entity. See PolygonMesh() sample.
* Added the drawing variables SurfU and SurfV.
@ -58,17 +66,17 @@
* (fixed) Some issues when reading and writing attributes and attribute definitions, related with the fit and aligned Alignment property.
* (fixed) Attribute and AttributeDefinition properties IsBackward and IsUpsideDown were not written nor read.
### [2022/02/13]
[2022/02/13]
* Cleanup code when reading and writing some dimension style variables and overrides.
* (fixed) Issue when writing the header variable $DIMAPOST.
* (fixed) Some issues with reading and writing dimension style overrides.
### [2022/01/26]
[2022/01/26]
* The Polyline2D and Polyline3D Explode method will preserve the smooth type.
* Deleted the references to the ImageDefinitionReactor from the ImageDefinition they will be created when the DXF is saved.
* (fixed) Issues, introduced in the last two updates, when saving Polyline2D, Polyline3D, and PolyfaceMesh entities that were part of a Block.
### [2021/12/06]
[2021/12/06]
* Rename Face3d to Face3D.
* Rename Face3dEdgeFlags to Face3DEdgeFlags.
* Rename DxfDocument.Entities.Faces3d to DxfDocument.Entities.Faces3D.
@ -94,7 +102,7 @@
* The SmoothType (None, Quadratic, or Cubic) can now be set for Polyline2D entity (formerly LwPolyline) and Polyline3D (formerly Polyline).
* Updated the file "netDxf Documentation.chm".
### [2021/10/24]
[2021/10/24]
* The internal blocks that start with "*U" or "*T" can be safely renamed. They are internally created to represent dynamic blocks, arrays, and tables; although the information of those objects is lost when importing the DXF, the block that represent its graphical appearance is imported.
* PolyfaceMesh vertexes are now a list of Vector3. The additional information that the DXF requires will be generated when the file is saved.
* Deleted the PolyfaceMeshVertex class, there is no use for it anymore.
@ -115,7 +123,7 @@
* (fixed) Workaround for multiline styles with no name in bad formated DXF files.
* (fixed) The precision argument of the Arc.PolygonalVertexes method represents the number of vertexes genarated not the number of division, as it is the case of similar methods of other entities.
### [2021/09/18]
[2021/09/18]
* Leader entitities with less than two vertices will be deleted when loading a DXF file.
* (fixed) Changed the default DxfDocument comment to show that netDxf is licensed under MIT.
* (fixed) Possible out of range error for the LuPrec header variable when reading a DXF file. Out of range values will default to 4.
@ -124,10 +132,10 @@
* (fixed) The default linetype will be given to a layer state if the specified one in the DXF is not found.
* (fixed) Complex linetypes assigned to a layer were not properly initialized.
### [2021/06/20]
[2021/06/20]
* Loading AutoCad2000 (AC1015) or AutoCad2004 (AC1018) DXF files containing non-ASCII characters will work once again. Additionally the Net Standard 2.1 build requires a reference to the external library "System.Text.Encoding.CodePages".
### [2021/05/23]
[2021/05/23]
* Added two methods to the MathHelper class to transform object 2d coordinates to world coordinates given the entity normal and elevation.
* Added two methods to the MathHelper class to transform world coordinates to object 2d coordinates given the entity normal, they also return as an out parameter the average Z axis value of the transformed points.
* Deleted netDxf.nuspec file.
@ -138,7 +146,7 @@
Also a call to the Update method is not done automatically. It is needed to reflect the actual properties and style of the Leader, but there might be special cases when it is needed to have control over it.
See "AssignAnnotationToLeader()" sample.
### [2021/05/02]
[2021/05/02]
* Added netDxf.nuspec file.
* Ellipses with its major axis smaller than its minor axis are not allowed.
* Streams with not accessible Position property are not supported.
@ -146,7 +154,7 @@
This behaviour differs when the LayerState comes from an external LAS file, in the latter case the non existent layer is added to the document. This is to allow the LAS file to be used layers templates.
Additionally if the LayerState points to a non existent linetype, the default "Standard" will be assigned.
### [2021/03/27]
[2021/03/27]
* The netDxf library is now licensed under the MIT License.
* Updated solution file to Visual Studio 2019.
* netDxf targets multiple frameworks, predefined frameworks for Net Framework 4.5, Net Standard 2.1, Net Core 3.1, and NET 5.0.
@ -162,7 +170,7 @@
It doesn't seems to play any role, open a new issue at GitHub if non-ASCII characters does not show up correctly.
This will avoid the use of additional libraries to handle the encoding code pages.
### [2.4.2 - 2021/03/23]
### [2.4.2 - 2021/03/23]
* Now the ShapeStyle does not require the SHP file to read the shape information only the SHX must be present.
* The Insert Sync method will not modify any value assigned to the attribute Value property.
* (fixed) A couple errors when writing the style overrides of a dimension to the extended data.

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -202,10 +202,11 @@ namespace netDxf.Collections
LinetypeShapeSegment shapeSegment = (LinetypeShapeSegment) segment;
shapeSegment.Style = this.Owner.ShapeStyles.Add(shapeSegment.Style);
this.Owner.ShapeStyles.References[shapeSegment.Style.Name].Add(linetype);
if (!shapeSegment.Style.ContainsShapeName(shapeSegment.Name))
{
throw new ArgumentException("The linetype contains a shape segment which style does not contain a shape with the stored name.", nameof(linetype));
}
//TODO: shape names and indexes, require check to external SHX file
//if (!shapeSegment.Style.ContainsShapeName(shapeSegment.Name))
//{
// throw new ArgumentException("The linetype contains a shape segment which style does not contain a shape with the stored name.", nameof(linetype));
//}
}
}
@ -218,6 +219,7 @@ namespace netDxf.Collections
linetype.LinetypeSegmentAdded += this.Linetype_SegmentAdded;
linetype.LinetypeSegmentRemoved += this.Linetype_SegmentRemoved;
linetype.LinetypeTextSegmentStyleChanged += this.Linetype_TextSegmentStyleChanged;
linetype.LinetypeShapeSegmentStyleChanged += this.Linetype_ShapeSegmentStyleChanged;
this.Owner.AddedObjects.Add(linetype.Handle, linetype);
@ -275,6 +277,10 @@ namespace netDxf.Collections
item.Owner = null;
item.NameChanged -= this.Item_NameChanged;
item.LinetypeSegmentAdded -= this.Linetype_SegmentAdded;
item.LinetypeSegmentRemoved -= this.Linetype_SegmentRemoved;
item.LinetypeTextSegmentStyleChanged -= this.Linetype_TextSegmentStyleChanged;
item.LinetypeShapeSegmentStyleChanged -= this.Linetype_ShapeSegmentStyleChanged;
return true;
}
@ -335,6 +341,13 @@ namespace netDxf.Collections
this.Owner.TextStyles.References[e.NewValue.Name].Add(sender);
}
private void Linetype_ShapeSegmentStyleChanged(Linetype sender, TableObjectChangedEventArgs<ShapeStyle> e)
{
this.Owner.ShapeStyles.References[e.OldValue.Name].Remove(sender);
e.NewValue = this.Owner.ShapeStyles.Add(e.NewValue);
this.Owner.ShapeStyles.References[e.NewValue.Name].Add(sender);
}
#endregion
}
}

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -39,6 +39,7 @@ namespace netDxf.Collections
#region private fields
private readonly List<string> folders;
private string workingFolder;
#endregion
@ -50,15 +51,7 @@ namespace netDxf.Collections
public SupportFolders()
{
this.folders = new List<string>();
}
/// <summary>
/// Initializes a new instance of <c>SupportFolders</c> class.
/// </summary>
/// <param name="capacity">Initial capacity of the list.</param>
public SupportFolders(int capacity)
{
this.folders = new List<string>(capacity);
this.workingFolder = Environment.CurrentDirectory;
}
/// <summary>
@ -71,8 +64,22 @@ namespace netDxf.Collections
{
throw new ArgumentNullException(nameof(folders));
}
this.folders = new List<string>();
this.AddRange(folders);
this.folders = new List<string>(folders);
this.workingFolder = Environment.CurrentDirectory;
}
#endregion
#region public properties
/// <summary>
/// Gets or sets the base folder to resolver relative paths of external references.
/// </summary>
/// <remarks>By default it points to the current System.Environment.CurrentDirectory when the DxfDocument was created.</remarks>
public string WorkingFolder
{
get { return this.workingFolder; }
set { this.workingFolder = value; }
}
#endregion
@ -87,21 +94,29 @@ namespace netDxf.Collections
/// <remarks>If the specified file already exists it return the same value, if neither it cannot be found in any of the support folders it will return an empty string.</remarks>
public string FindFile(string file)
{
string foundFile = string.Empty;
string currentDirectory = Environment.CurrentDirectory;
Environment.CurrentDirectory = this.workingFolder;
if (File.Exists(file))
{
return file;
foundFile = Path.GetFullPath(file);
}
string name = Path.GetFileName(file);
foreach (string folder in this.folders)
{
string newFile = string.Format("{0}{1}{2}", folder, Path.DirectorySeparatorChar, name);
if (File.Exists(newFile))
{
return newFile;
foundFile = Path.GetFullPath(newFile);
}
}
return string.Empty;
Environment.CurrentDirectory = currentDirectory;
return foundFile;
}
#endregion

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -139,7 +139,7 @@ namespace netDxf
/// </summary>
/// <param name="drawingVariables"><see cref="HeaderVariables">Drawing variables</see> of the document.</param>
public DxfDocument(HeaderVariables drawingVariables)
: this(drawingVariables, true, new List<string>())
: this(drawingVariables, new List<string>())
{
}
@ -149,7 +149,7 @@ namespace netDxf
/// <param name="drawingVariables"><see cref="HeaderVariables">Drawing variables</see> of the document.</param>
/// <param name="supportFolders">List of the document support folders.</param>
public DxfDocument(HeaderVariables drawingVariables, IEnumerable<string> supportFolders)
: this(drawingVariables, true, supportFolders)
: this(drawingVariables, true, new SupportFolders(supportFolders))
{
}
@ -159,10 +159,10 @@ namespace netDxf
/// <param name="drawingVariables"><see cref="HeaderVariables">Drawing variables</see> of the document.</param>
/// <param name="createDefaultObjects">Check if the default objects need to be created.</param>
/// <param name="supportFolders">List of the document support folders.</param>
internal DxfDocument(HeaderVariables drawingVariables, bool createDefaultObjects, IEnumerable<string> supportFolders)
internal DxfDocument(HeaderVariables drawingVariables, bool createDefaultObjects, SupportFolders supportFolders)
: base("DOCUMENT")
{
this.supportFolders = new SupportFolders(supportFolders);
this.supportFolders = supportFolders;
this.buildDimensionBlocks = false;
this.comments = new List<string> { "DXF file generated by netDxf https://github.com/haplokuon/netDxf, Copyright(C) Daniel Carvajal, Licensed under MIT" };
this.Owner = null;
@ -504,20 +504,22 @@ namespace netDxf
/// On Debug mode it will raise any exception that might occur during the whole process.
/// </remarks>
public static DxfDocument Load(string file, IEnumerable<string> supportFolders)
{
{
Stream stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
FileInfo fileInfo = new FileInfo(file);
SupportFolders folders = new SupportFolders(supportFolders) { WorkingFolder = fileInfo.DirectoryName };
DxfReader dxfReader = new DxfReader();
#if DEBUG
DxfDocument document = dxfReader.Read(stream, supportFolders);
DxfDocument document = dxfReader.Read(stream, folders);
stream.Close();
#else
DxfDocument document;
try
{
document = dxfReader.Read(stream, supportFolders);
document = dxfReader.Read(stream, folders);
}
catch (DxfVersionNotSupportedException)
{
@ -568,14 +570,14 @@ namespace netDxf
public static DxfDocument Load(Stream stream, IEnumerable<string> supportFolders)
{
DxfReader dxfReader = new DxfReader();
#if DEBUG
DxfDocument document = dxfReader.Read(stream, supportFolders);
DxfDocument document = dxfReader.Read(stream, new SupportFolders(supportFolders));
#else
DxfDocument document;
try
{
document = dxfReader.Read(stream, supportFolders);
document = dxfReader.Read(stream, new SupportFolders(supportFolders));
}
catch (DxfVersionNotSupportedException)
{
@ -622,11 +624,18 @@ namespace netDxf
{
FileInfo fileInfo = new FileInfo(file);
this.name = Path.GetFileNameWithoutExtension(fileInfo.FullName);
DxfWriter dxfWriter = new DxfWriter();
Stream stream = File.Create(file);
string workingFolder = fileInfo.DirectoryName;
if (!string.IsNullOrEmpty(workingFolder))
{
this.supportFolders.WorkingFolder = workingFolder;
}
#if DEBUG
dxfWriter.Write(stream, this, isBinary);
stream.Close();
@ -892,6 +901,11 @@ namespace netDxf
Shape shape = (Shape) entity;
shape.Style = this.shapeStyles.Add(shape.Style, assignHandle);
this.shapeStyles.References[shape.Style.Name].Add(shape);
//TODO: shape names and indexes, require check to external SHX file
//if (!shape.Style.ContainsShapeName(shape.Name))
//{
// throw new ArgumentException("The shape name " + shape.Name + " is not defined in the associated shape style " + shape.Style.Name + ".");
//}
shape.StyleChanged += this.Shape_StyleChanged;
break;
case EntityType.Point:

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -80,7 +80,7 @@ namespace netDxf.Entities
this.center = center;
if (radius <= 0)
{
throw new ArgumentOutOfRangeException(nameof(radius), radius, "The circle radius must be greater than zero.");
throw new ArgumentOutOfRangeException(nameof(radius), radius, "The arc radius must be greater than zero.");
}
this.radius = radius;
this.startAngle = MathHelper.NormalizeAngle(startAngle);
@ -100,7 +100,7 @@ namespace netDxf.Entities
Tuple<Vector2, double, double, double> data = MathHelper.ArcFromBulge(startPoint, endPoint, bulge);
if (data.Item2 <= 0)
{
throw new ArgumentOutOfRangeException(nameof(radius), radius, "The circle radius must be greater than zero.");
throw new ArgumentOutOfRangeException(nameof(radius), radius, "The arc radius must be greater than zero.");
}
this.center = new Vector3(data.Item1.X, data.Item1.Y, 0.0) ;
this.radius = data.Item2;

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -59,7 +59,7 @@ namespace netDxf.Entities
/// Initializes a new instance of the <c>ArcLengthDimension</c> class.
/// </summary>
/// <param name="arc"><see cref="Arc">Arc</see> to measure.</param>
/// <param name="offset">Distance between the measured arc and the dimension line.</param>
/// <param name="offset">Distance between the center of the measured arc and the dimension line.</param>
public ArcLengthDimension(Arc arc, double offset)
: this(arc, offset, DimensionStyle.Default)
{
@ -69,7 +69,7 @@ namespace netDxf.Entities
/// Initializes a new instance of the <c>ArcLengthDimension</c> class.
/// </summary>
/// <param name="arc">Angle <see cref="Arc">arc</see> to measure.</param>
/// <param name="offset">Distance between the measured arc and the dimension line.</param>
/// <param name="offset">Distance between the center of the measured arc and the dimension line.</param>
/// <param name="style">The <see cref="DimensionStyle">style</see> to use with the dimension.</param>
public ArcLengthDimension(Arc arc, double offset, DimensionStyle style)
: base(DimensionType.ArcLength)
@ -100,7 +100,7 @@ namespace netDxf.Entities
/// </summary>
/// <param name="startPoint">Arc start point, the start point bulge must be different than zero.</param>
/// <param name="endPoint">Arc end point.</param>
/// <param name="offset">Distance between the measured arc and the dimension line.</param>
/// <param name="offset">Distance between the center of the measured arc and the dimension line.</param>
public ArcLengthDimension(Polyline2DVertex startPoint, Polyline2DVertex endPoint, double offset)
: this(startPoint.Position, endPoint.Position, startPoint.Bulge, offset)
{
@ -113,7 +113,7 @@ namespace netDxf.Entities
/// <param name="startPoint">Arc start point.</param>
/// <param name="endPoint">Arc end point.</param>
/// <param name="bulge">Bulge value.</param>
/// <param name="offset">Distance between the measured arc and the dimension line.</param>
/// <param name="offset">Distance between the center of the measured arc and the dimension line.</param>
public ArcLengthDimension(Vector2 startPoint, Vector2 endPoint, double bulge, double offset)
: this(startPoint, endPoint, bulge, offset, DimensionStyle.Default)
{
@ -125,13 +125,13 @@ namespace netDxf.Entities
/// <param name="startPoint">Arc start point.</param>
/// <param name="endPoint">Arc end point.</param>
/// <param name="bulge">Bulge value.</param>
/// <param name="offset">Distance between the measured arc and the dimension line.</param>
/// <param name="offset">Distance between the center of the measured arc and the dimension line.</param>
/// <param name="style">The <see cref="DimensionStyle">style</see> to use with the dimension.</param>
public ArcLengthDimension(Vector2 startPoint, Vector2 endPoint, double bulge, double offset, DimensionStyle style)
: base(DimensionType.ArcLength)
{
// This is the result of how the ArcLengthDimension is implemented in the DXF, although it is no more than other kind of dimension
// for some reason it is considered its own entity. Its code 0 instead is "ARC_DIMENSION" instead of "DIMENSION" as it is in the rest of dimension entities.
// for some reason it is considered its own entity. Its code 0 is "ARC_DIMENSION" instead of "DIMENSION" as it is in the rest of dimension entities.
this.CodeName = DxfObjectCode.ArcDimension;
Tuple<Vector2, double, double, double> arcData = MathHelper.ArcFromBulge(startPoint, endPoint, bulge);
@ -151,7 +151,7 @@ namespace netDxf.Entities
/// <param name="radius">Arc radius.</param>
/// <param name="startAngle">Arc start angle in degrees.</param>
/// <param name="endAngle">Arc end angle in degrees.</param>
/// <param name="offset">Distance between the measured arc and the dimension line.</param>
/// <param name="offset">Distance between the center of the measured arc and the dimension line.</param>
public ArcLengthDimension(Vector2 center, double radius, double startAngle, double endAngle, double offset)
: this(center, radius, startAngle, endAngle, offset, DimensionStyle.Default)
{
@ -164,16 +164,20 @@ namespace netDxf.Entities
/// <param name="radius">Arc radius.</param>
/// <param name="startAngle">Arc start angle in degrees.</param>
/// <param name="endAngle">Arc end angle in degrees.</param>
/// <param name="offset">Distance between the measured arc and the dimension line.</param>
/// <param name="offset">Distance between the center of the measured arc and the dimension line.</param>
/// <param name="style">The <see cref="DimensionStyle">style</see> to use with the dimension.</param>
public ArcLengthDimension(Vector2 center, double radius, double startAngle, double endAngle, double offset, DimensionStyle style)
: base(DimensionType.ArcLength)
{
// This is the result of how the ArcLengthDimension is implemented in the DXF, although it is no more than other kind of dimension
// for some reason it is considered its own entity. Its code 0 instead is "ARC_DIMENSION" instead of "DIMENSION" as it is in the rest of dimension entities.
// for some reason it is considered its own entity. Its code 0 is "ARC_DIMENSION" instead of "DIMENSION" as it is in the rest of dimension entities.
this.CodeName = DxfObjectCode.ArcDimension;
this.center = center;
if (radius <= 0)
{
throw new ArgumentOutOfRangeException(nameof(radius), radius, "The arc radius must be greater than zero.");
}
this.radius = radius;
this.startAngle = MathHelper.NormalizeAngle(startAngle);
this.endAngle = MathHelper.NormalizeAngle(endAngle);
@ -261,7 +265,7 @@ namespace netDxf.Entities
if (this.offset < 0)
{
return 360 - angle;
return 360.0 - angle;
}
return angle;
}

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2023 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@ -109,7 +109,7 @@ namespace netDxf.Entities
/// </summary>
/// <param name="vertexes">Multiline <see cref="Vector2">vertex</see> location list in object coordinates.</param>
/// <param name="scale">Multiline scale.</param>
/// <param name="isClosed">Sets if the multiline is closed (default: false).</param>
/// <param name="isClosed">Sets if the multiline is closed (default: false).</param>
public MLine(IEnumerable<Vector2> vertexes, double scale, bool isClosed)
: this(vertexes, MLineStyle.Default, scale, isClosed)
{
@ -132,7 +132,7 @@ namespace netDxf.Entities
/// <param name="vertexes">MLine <see cref="Vector2">vertex</see> location list in object coordinates.</param>
/// <param name="style">MLine <see cref="MLineStyle">style.</see></param>
/// <param name="scale">MLine scale.</param>
/// <param name="isClosed">Sets if the multiline is closed (default: false).</param>
/// <param name="isClosed">Sets if the multiline is closed (default: false).</param>
public MLine(IEnumerable<Vector2> vertexes, MLineStyle style, double scale, bool isClosed)
: base(EntityType.MLine, DxfObjectCode.MLine)
{
@ -502,10 +502,10 @@ namespace netDxf.Entities
double cos = Math.Cos(angleMiter - (MathHelper.HalfPI + angleDir));
for (int j = 0; j < this.style.Elements.Count; j++)
{
double distance = (this.style.Elements[j].Offset + reference)/cos;
double distance = (this.style.Elements[j].Offset + reference) / cos;
distances[j] = new List<double>
{
distance*this.scale,
distance * this.scale,
0.0
};
}

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Просмотреть файл

@ -1,7 +1,7 @@
#region netDxf library licensed under the MIT License
//
// netDxf library
// Copyright (c) 2019-2021 Daniel Carvajal (haplokuon@gmail.com)
// Copyright (c) Daniel Carvajal (haplokuon@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше