Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20240225 mme multi leader rework #293

Merged
merged 14 commits into from
Mar 20, 2024
Merged
8 changes: 0 additions & 8 deletions ACadSharp/AttachmentType.cs

This file was deleted.

2 changes: 1 addition & 1 deletion ACadSharp/Entities/MultiLeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public class BlockAttribute
/// Block Content Connection Type
/// </summary>
[DxfCodeValue(176)]
public AttachmentType BlockContentConnection { get; set; }
public BlockContentConnectionType BlockContentConnection { get; set; }

#endregion

Expand Down
2 changes: 1 addition & 1 deletion ACadSharp/Entities/MultiLeaderPropertyOverrideFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public enum MultiLeaderPropertyOverrideFlags : int
/// <summary>
/// Override <see cref="MultiLeaderStyle.BlockContentConnection"/> property.
/// </summary>
BlockConnectionConnection = 0x800000,
BlockContentConnection = 0x800000,


/// <summary>
Expand Down
28 changes: 14 additions & 14 deletions ACadSharp/IO/DWG/DwgStreamReaders/DwgObjectReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2826,7 +2826,7 @@ private CadTemplate readMultiLeader()
//BL 90 Property Override Flags (int32)
mLeader.PropertyOverrideFlags = (MultiLeaderPropertyOverrideFlags)this._objectReader.ReadBitLong();
//BS 170 LeaderLineType (short)
mLeader.PathType = (MultiLeaderPathType)_objectReader.ReadBitShort();
mLeader.PathType = (MultiLeaderPathType)this._objectReader.ReadBitShort();
//CMC 91 Leade LineColor (Color)
mLeader.LineColor = _mergedReaders.ReadCmColor();
//H 341 LeaderLineTypeID (handle/LineType)
Expand Down Expand Up @@ -2872,7 +2872,7 @@ private CadTemplate readMultiLeader()
// 43 Block Content Rotation
mLeader.BlockContentRotation = this._objectReader.ReadBitDouble();
// 176 Block Content Connection Type
mLeader.BlockContentConnection = (AttachmentType)this._objectReader.ReadBitShort();
mLeader.BlockContentConnection = (BlockContentConnectionType)_objectReader.ReadBitShort();
// 293 Enable Annotation Scale/Is annotative
mLeader.EnableAnnotationScale = this._objectReader.ReadBit();

Expand Down Expand Up @@ -2953,7 +2953,7 @@ private MultiLeaderAnnotContext readMultiLeaderAnnotContext(CadMLeaderTemplate t

// Common
// BD 40 Overall scale
annotContext.OverallScale = this._objectReader.ReadBitDouble();
annotContext.ScaleFactor = _objectReader.ReadBitDouble();
// 3BD 10 Content base point
annotContext.ContentBasePoint = this._objectReader.Read3BitDouble();
// BD 41 Text height
Expand All @@ -2969,23 +2969,23 @@ private MultiLeaderAnnotContext readMultiLeaderAnnotContext(CadMLeaderTemplate t
// BS 176 Text align type (0 = left, 1 = center, 2 = right)
annotContext.TextAlignment = (TextAlignmentType)this._objectReader.ReadBitShort();
// BS 177 Attachment type (0 = content extents, 1 = insertion point).
annotContext.AttachmentType = (AttachmentType)this._objectReader.ReadBitShort();
annotContext.BlockContentConnection = (BlockContentConnectionType)this._objectReader.ReadBitShort();
// B 290 Has text contents
annotContext.HasTextContents = this._objectReader.ReadBit();
if (annotContext.HasTextContents)
{
// TV 304 Text label
annotContext.TextLabel = this._textReader.ReadVariableText();
// 3BD 11 Normal vector
annotContext.Normal = this._objectReader.Read3BitDouble();
annotContext.TextNormal = this._objectReader.Read3BitDouble();
// H 340 Text style handle (hard pointer)
template.AnnotContextTextStyleHandle = this.handleReference();
// 3BD 12 Location
annotContext.Location = this._objectReader.Read3BitDouble();
annotContext.TextLocation = this._objectReader.Read3BitDouble();
// 3BD 13 Direction
annotContext.Direction = this._objectReader.Read3BitDouble();
// BD 42 Rotation (radians)
annotContext.Rotation = this._objectReader.ReadBitDouble();
annotContext.TextRotation = this._objectReader.ReadBitDouble();
// BD 43 Boundary width
annotContext.BoundaryWidth = this._objectReader.ReadBitDouble();
// BD 44 Boundary height
Expand All @@ -2997,7 +2997,7 @@ private MultiLeaderAnnotContext readMultiLeaderAnnotContext(CadMLeaderTemplate t
// CMC 90 Text color
annotContext.TextColor = this._objectReader.ReadCmColor();
// BS 171 Alignment (1 = left, 2 = center, 3 = right)
annotContext.TextAlignment = (TextAlignmentType)this._objectReader.ReadBitShort();
annotContext.TextAttachmentPoint = (TextAttachmentPointType)this._objectReader.ReadBitShort();
// BS 172 Flow direction (1 = horizontal, 3 = vertical, 6 = by style)
annotContext.FlowDirection = (FlowDirectionType)this._objectReader.ReadBitShort();
// CMC 91 Background fill color
Expand Down Expand Up @@ -3042,13 +3042,13 @@ private MultiLeaderAnnotContext readMultiLeaderAnnotContext(CadMLeaderTemplate t
// H 341 AcDbBlockTableRecord handle (soft pointer)
template.AnnotContextBlockRecordHandle = this.handleReference();
// 3BD 14 Normal vector
annotContext.Normal = this._objectReader.Read3BitDouble();
annotContext.BlockContentNormal = this._objectReader.Read3BitDouble();
// 3BD 15 Location
annotContext.Location = this._objectReader.Read3BitDouble();
annotContext.BlockContentLocation = this._objectReader.Read3BitDouble();
// 3BD 16 Scale vector
annotContext.BlockContentScale = this._objectReader.Read3BitDouble();
// BD 46 Rotation (radians)
annotContext.Rotation = this._objectReader.ReadBitDouble();
annotContext.BlockContentRotation = this._objectReader.ReadBitDouble();
// CMC 93 Block color
annotContext.BlockContentColor = this._objectReader.ReadCmColor();
// BD (16) 47 16 doubles containing the complete transformation
Expand Down Expand Up @@ -3275,7 +3275,7 @@ private CadTemplate readMultiLeaderStyle()
mLeaderStyle.TextAngle = (TextAngleType)this._objectReader.ReadBitShort();

} // END IF IsNewFormat OR DXF file
// BS 176 Text alignment type
// BS 176 Text alignment type
mLeaderStyle.TextAlignment = (TextAlignmentType)this._objectReader.ReadBitShort();
// CMC 93 Text color
mLeaderStyle.TextColor = this._mergedReaders.ReadCmColor();
Expand All @@ -3288,8 +3288,8 @@ private CadTemplate readMultiLeaderStyle()
// B 297 Always align text left
mLeaderStyle.TextAlignAlwaysLeft = this._objectReader.ReadBit();
}// END IF IsNewFormat OR DXF file
// BD 46 Align space
mLeaderStyle.AlignSpace = this._objectReader.ReadBitDouble();
// BD 46 Align space
mLeaderStyle.AlignSpace = _objectReader.ReadBitDouble();
// H 343 Block handle (hard pointer)
template.BlockContentHandle = this.handleReference();
// CMC 94 Block color
Expand Down
32 changes: 21 additions & 11 deletions ACadSharp/Objects/MultiLeaderAnnotContext.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using ACadSharp.Attributes;
using ACadSharp.Entities;
using ACadSharp.Tables;

using CSMath;
Expand Down Expand Up @@ -33,7 +34,7 @@ public partial class MultiLeaderAnnotContext : CadObject
/// Overall scale
/// </summary>
[DxfCodeValue(40)]
public double OverallScale { get; set; }
public double ScaleFactor { get; set; }

/// <summary>
/// Content base point
Expand Down Expand Up @@ -90,7 +91,7 @@ public partial class MultiLeaderAnnotContext : CadObject
/// --> MLeader.BlockContentConnectionType
/// </summary>
[DxfCodeValue(177)]
public AttachmentType AttachmentType { get; set; }
public BlockContentConnectionType BlockContentConnection { get; set; }

/// <summary>
/// Has text contents
Expand All @@ -107,8 +108,8 @@ public partial class MultiLeaderAnnotContext : CadObject
/// <summary>
/// Normal vector
/// </summary>
[DxfCodeValue(11)]
public XYZ Normal { get; set; }
[DxfCodeValue(11, 21, 31)]
public XYZ TextNormal { get; set; }

/// <summary>
/// Text style handle (hard pointer)
Expand All @@ -120,7 +121,7 @@ public partial class MultiLeaderAnnotContext : CadObject
/// Location
/// </summary>
[DxfCodeValue(12, 22, 32)]
public XYZ Location { get; set; }
public XYZ TextLocation { get; set; }

/// <summary>
/// Direction
Expand All @@ -132,7 +133,7 @@ public partial class MultiLeaderAnnotContext : CadObject
/// Rotation (radians)
/// </summary>
[DxfCodeValue(42)]
public double Rotation { get; set; }
public double TextRotation { get; set; }
DomCR marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Boundary width
Expand Down Expand Up @@ -166,6 +167,8 @@ public partial class MultiLeaderAnnotContext : CadObject

// BS 171 Alignment (1 = left, 2 = center, 3 = right)
// see above: TextAlignment
[DxfCodeValue(171)]
public TextAttachmentPointType TextAttachmentPoint { get; set; }

/// <summary>
/// Flow direction
Expand Down Expand Up @@ -260,18 +263,25 @@ public partial class MultiLeaderAnnotContext : CadObject

// These fields read from DWG are stored into the
// Normal and Location property (see above).
//3BD 14 Normal vector
//3BD 15 Location
[DxfCodeValue(14, 24, 34)]
public XYZ BlockContentNormal { get; set; }

/// <summary>
/// Location
/// </summary>
[DxfCodeValue(15, 25, 35)]
public XYZ BlockContentLocation { get; set; }
/// <summary>
/// Scale vector
/// </summary>
[DxfCodeValue(16)]
public XYZ BlockContentScale { get; set; }
mme1950 marked this conversation as resolved.
Show resolved Hide resolved

// This field read from DWG are stored into the
// Rotation property (see above).
//BD 46 Rotation (radians)
/// <summary>
/// Rottaion (radians)
/// </summary>
[DxfCodeValue(46)]
public double BlockContentRotation { get; set; }

/// <summary>
/// Block color
Expand Down
6 changes: 3 additions & 3 deletions ACadSharp/Objects/MultiLeaderAnnotContextClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public LeaderRoot() { }
/// <summary>
/// Attachment direction
/// </summary>
public TextAttachmentDirectionType AttachmentDirection { get; internal set; }
public TextAttachmentDirectionType AttachmentDirection { get; set; }

public object Clone()
{
Expand Down Expand Up @@ -135,7 +135,7 @@ public LeaderLine() { }
/// <summary>
/// Points of leader line
/// </summary>
public IList<XYZ> Points { get; set; } = new List<XYZ>();
public IList<XYZ> Points { get; } = new List<XYZ>();

/// <summary>
/// Break info count
Expand All @@ -150,7 +150,7 @@ public LeaderLine() { }
/// <summary>
/// Start/end point pairs
/// </summary>
public IList<StartEndPointPair> StartEndPoints { get; set; }
public IList<StartEndPointPair> StartEndPoints { get; } = new List<StartEndPointPair>();

/// <summary>
/// Leader line index.
Expand Down
Loading
Loading