Skip to content

DWG import drops the vertical justification of attributes (TC, MC, BC and the like drawn on the baseline) #2411

Open

Description

@TimothyLeeAdams

When CADCraft 0.13.0 reads a DWG, an attribute justified Top, Middle or Bottom with center or right alignment loses the vertical part of its justification. It's drawn with its baseline on the alignment point. The same file read as DXF is correct, and plain TEXT with the same justification is correct in both. So my guess is the DWG reader (acadrust?) isn't reading the attribute's vertical alignment. Saving writes the loss back into the file.

Repro

The attached attr-offset.dwg (cadcraft-repro-attr-justification.zip) was made in AutoCAD 2023 through its .NET API, starting from a new drawing. Block ATTRS has one attribute per justification, each on a small cross that marks its alignment point (height 2, Arial). Block TEXTS has plain TEXT with the same justifications.

cadcraft-cli run attr-offset.dwg --cmd 'plot {"layout":"SHEET","path":"attr-offset.pdf"}'

Each attribute's offset from AutoCAD's plot, in drawing units (+ is up), measured from the PDF text boxes:

Justification Offset
TC, TR +2.00
MC, MR +1.00
BC, BR -0.58
TL, ML, BL, L, C, R, M 0.00

Plain TEXT is within 0.01 for every justification. Read from AutoCAD's DXFOUT of the same file, every attribute is within 0.1. The left-aligned attributes come out right only because their insertion point already includes the vertical shift.

What CADCraft writes back for two of them (cadcraft-cli convert attr-offset.dwg out.dxf):

ATTRIB J_MC   72=1, no 74    10=(11.829, 12.0)   11=(14.0, 12.0)
ATTRIB J_ML   no 72 or 74    10=(0.0, 11.0)

In AutoCAD's file, J_MC is MiddleCenter with position (11.827, 11.0) and alignment (14, 12). After cadcraft-cli convert attr-offset.dwg out.dwg, AutoCAD reads J_MC as BaseCenter at (14, 12), so the attribute moves in AutoCAD as well.

Where it shows up

Device tags in a project drawing sat 0.04" to 0.05" high in a 1:32 viewport and touched their symbols.

Environment

CADCraft 0.13.0 and 0.14.0 (cadcraft-cli, macOS 26.5 on Apple silicon); 0.14.0 gives identical output. Reference: AutoCAD 2023 on Windows 11.

AutoCAD 2023
CADCraft 0.13.0

Activity

  1. ticket-craft commented on Oct 28, 2026

    @ticket-craft

    This is being worked on in #1591.

    Possibly related: #2229, #342 and #1050.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions