Skip to content

Commit

Permalink
Merge pull request #436 from DomCR/pdf-project-branch
Browse files Browse the repository at this point in the history
Pdf project branch
  • Loading branch information
DomCR authored Sep 4, 2024
2 parents b32e7a9 + 006f5f5 commit 5cb5b42
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 22 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ ACadSharp allows to read or create CAD files using .Net and also extract or modi
- Extract/Modify the geometric information from the different [entities](https://help.autodesk.com/view/OARX/2021/ENU/?guid=GUID-7D07C886-FD1D-4A0C-A7AB-B4D21F18E484) in the model
- Control over the table elements like Blocks, Layers and Styles, allows you to read, create or modify the different tables

For pdf export check :construction: [ACadSharp.Pdf](https://github.com/DomCR/ACadSharp.Pdf) :construction:.

#### Compatible Dwg/Dxf versions:

| | DxfReader | DxfWriter | DwgReader | DwgWriter |
Expand Down
57 changes: 35 additions & 22 deletions src/ACadSharp/Objects/Layout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
using ACadSharp.Entities;
using ACadSharp.Tables;
using CSMath;
using System;
using System.Collections.Generic;
using System.Linq;

namespace ACadSharp.Objects
{
/// <summary>
/// Represents a <see cref="Layout"/> object
/// Represents a <see cref="Layout"/> object.
/// </summary>
/// <remarks>
/// Object name <see cref="DxfFileToken.ObjectLayout"/> <br/>
/// Dxf class name <see cref="DxfSubclassMarker.Layout"/>
/// Object name <see cref="DxfFileToken.ObjectLayout"/>. <br/>
/// Dxf class name <see cref="DxfSubclassMarker.Layout"/>.
/// </remarks>
[DxfName(DxfFileToken.ObjectLayout)]
[DxfSubClass(DxfSubclassMarker.Layout)]
Expand All @@ -32,7 +33,7 @@ public class Layout : PlotSettings
public override string SubclassMarker => DxfSubclassMarker.Layout;

/// <summary>
/// Layout name
/// Layout name.
/// </summary>
[DxfCodeValue(1)]
public override string Name
Expand All @@ -48,79 +49,79 @@ public override string Name
}

/// <summary>
/// Layout flags
/// Layout flags.
/// </summary>
[DxfCodeValue(70)]
public LayoutFlags LayoutFlags { get; set; }

/// <summary>
/// Tab order.This number is an ordinal indicating this layout's ordering in the tab control that is attached to the drawing window. Note that the “Model” tab always appears as the first tab regardless of its tab order
/// Tab order. This number is an ordinal indicating this layout's ordering in the tab control that is attached to the drawing window. Note that the “Model” tab always appears as the first tab regardless of its tab order.
/// </summary>
[DxfCodeValue(71)]
public int TabOrder { get; set; }

/// <summary>
/// Minimum limits for this layout (defined by LIMMIN while this layout is current)
/// Minimum limits for this layout (defined by LIMMIN while this layout is current).
/// </summary>
[DxfCodeValue(10, 20)]
public XY MinLimits { get; set; } = new XY(-20.0, -7.5);

/// <summary>
/// Maximum limits for this layout(defined by LIMMAX while this layout is current)
/// Maximum limits for this layout(defined by LIMMAX while this layout is current).
/// </summary>
[DxfCodeValue(11, 21)]
public XY MaxLimits { get; set; } = new XY(277.0, 202.5);

/// <summary>
/// Insertion base point for this layout(defined by INSBASE while this layout is current)
/// Insertion base point for this layout(defined by INSBASE while this layout is current).
/// </summary>
[DxfCodeValue(12, 22, 32)]
public XYZ InsertionBasePoint { get; set; }

/// <summary>
/// Minimum extents for this layout(defined by EXTMIN while this layout is current)
/// Minimum extents for this layout(defined by EXTMIN while this layout is current).
/// </summary>
[DxfCodeValue(14, 24, 34)]
public XYZ MinExtents { get; set; } = new XYZ(25.7, 19.5, 0.0);

/// <summary>
/// Maximum extents for this layout(defined by EXTMAX while this layout is current)
/// Maximum extents for this layout(defined by EXTMAX while this layout is current).
/// </summary>
[DxfCodeValue(15, 25, 35)]
public XYZ MaxExtents { get; set; } = new XYZ(231.3, 175.5, 0.0);

/// <summary>
/// Layout elevation
/// Layout elevation.
/// </summary>
[DxfCodeValue(146)]
public double Elevation { get; set; }

/// <summary>
/// UCS origin
/// UCS origin.
/// </summary>
[DxfCodeValue(13, 23, 33)]
public XYZ Origin { get; set; } = XYZ.Zero;

/// <summary>
/// UCS X-axis
/// UCS X-axis.
/// </summary>
[DxfCodeValue(16, 26, 36)]
public XYZ XAxis { get; set; } = XYZ.AxisX;

/// <summary>
/// UCS Y-axis
/// UCS Y-axis.
/// </summary>
[DxfCodeValue(17, 27, 37)]
public XYZ YAxis { get; set; } = XYZ.AxisY;

/// <summary>
/// Orthographic type of UCS
/// Orthographic type of UCS.
/// </summary>
[DxfCodeValue(76)]
public OrthographicType UcsOrthographicType { get; set; }

/// <summary>
/// The associated paper space block table record
/// The associated paper space block table record.
/// </summary>
[DxfCodeValue(DxfReferenceType.Handle, 330)]
public BlockRecord AssociatedBlock
Expand All @@ -139,7 +140,7 @@ internal set
}

/// <summary>
/// Viewport that was last active in this layout when the layout was current
/// Viewport that was last active in this layout when the layout was current.
/// </summary>
[DxfCodeValue(DxfReferenceType.Handle, 331)]
public Viewport Viewport
Expand All @@ -158,23 +159,34 @@ internal set
}

/// <summary>
/// UCS Table Record if UCS is a named UCS
/// UCS Table Record if UCS is a named UCS.
/// </summary>
/// <remarks>
/// If not present, then UCS is unnamed
/// If not present, then UCS is unnamed.
/// </remarks>
[DxfCodeValue(DxfReferenceType.Handle, 345)]
public UCS UCS { get; set; }

/// <summary>
/// UCSTableRecord of base UCS if UCS is orthographic (<see cref="UcsOrthographicType"/> is non-zero)
/// UCSTableRecord of base UCS if UCS is orthographic (<see cref="UcsOrthographicType"/> is non-zero).
/// </summary>
/// <remarks>
/// If not present and <see cref="UcsOrthographicType"/> is non-zero, then base UCS is taken to be WORLD
/// If not present and <see cref="UcsOrthographicType"/> is non-zero, then base UCS is taken to be WORLD.
/// </remarks>
[DxfCodeValue(DxfReferenceType.Handle, 346)]
public UCS BaseUCS { get; set; }

/// <summary>
/// If true, the layout is a paper space.
/// </summary>
public bool IsPaperSpace
{
get
{
return !this.Name.Equals(ModelLayoutName, StringComparison.InvariantCultureIgnoreCase);
}
}

//333 Shade plot ID

public IEnumerable<Viewport> Viewports
Expand All @@ -201,6 +213,7 @@ public Layout(string name, string blockName) : base()
this._blockRecord = new BlockRecord(blockName);
}

/// <inheritdoc/>
public override CadObject Clone()
{
Layout clone = (Layout)base.Clone();
Expand Down

0 comments on commit 5cb5b42

Please sign in to comment.