Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
[2023/06/28] netDxf 3.0 Release
Browse files Browse the repository at this point in the history
[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.
  • Loading branch information
haplokuon committed Jun 27, 2023
1 parent 2dc2579 commit d53bd30
Show file tree
Hide file tree
Showing 256 changed files with 607 additions and 454 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
22 changes: 10 additions & 12 deletions TestDxfDocument/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
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
{
Expand Down Expand Up @@ -2230,7 +2228,7 @@ public static void TextMirror()

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;

Expand Down Expand Up @@ -3244,7 +3242,7 @@ private static void TestModelSpaceBlock()
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);

Expand Down Expand Up @@ -5699,7 +5697,7 @@ private static void MeshEntity()

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
Expand Down Expand Up @@ -6240,9 +6238,9 @@ private static void LinearDimensionTests()
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);
Expand Down Expand Up @@ -6744,7 +6742,7 @@ private static void TextAndDimensionStyleUsesAndRemove()
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);

Expand All @@ -6761,7 +6759,7 @@ private static void TextAndDimensionStyleUsesAndRemove()
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;
Expand Down Expand Up @@ -7272,7 +7270,7 @@ private static void Text()

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);
Expand Down Expand Up @@ -7762,7 +7760,7 @@ private static void WriteMText()
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");
Expand Down
42 changes: 25 additions & 17 deletions doc/Changelog.txt
Original file line number Diff line number Diff line change
@@ -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().
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -138,15 +146,15 @@
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.
* (fixed) LayerState containing a non existent layer will not be added.
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.
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion netDxf/AciColor.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/BezierCurve.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/BezierCurveCubic.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/BezierCurveQuadratic.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/Blocks/Block.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/Blocks/BlockAttributeDefinitionChangeEventArgs.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/Blocks/BlockEntityChangeEventArgs.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/Blocks/BlockRecord.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/Blocks/BlockTypeFlags.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/Blocks/EndBlock.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/BoundingRectangle.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/ClippingBoundary.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/ClippingBoundaryType.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion netDxf/Collections/ApplicationRegistries.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading

0 comments on commit d53bd30

Please sign in to comment.