Repository navigation
Replies: 1 comment
|
The symbol type isn't in a separate group code. It is part of the content string, group code 1: for e in msp.query("TOLERANCE"): e.g. {\Fgdt;j}%%v{\Fgdt;n}0.1{\Fgdt;m}%%vAThe characters inside {\Fgdt;...} are glyphs of AutoCAD's gdt.shx font. %%v separates the frame boxes and ^J starts a second row. The geometric characteristic is the first \Fgdt glyph of each row: char symbol char symbol import re for e in msp.query("TOLERANCE"):
Entities inside a block definition are stored in block coordinates, relative to the block's base point. The position you see in AutoCAD comes from the INSERT (block reference) that places the block: its insert point, scale, rotation and extrusion. So you have to go through the INSERT entities in modelspace, not doc.blocks. doc.blocks only holds the definitions, which is why every base point is (0, 0, 0). Option A: let ezdxf transform everything into WCS, including nested blocks: from ezdxf import disassemble for e in disassemble.recursive_decompose(msp): for ins in msp.query("INSERT"): Tested: a TEXT at (5, 0) inside a block inserted at (100, 50) prints (105, 50); the same block inserted at (200, 50) with 90° rotation prints (200, 55). |
Uh oh!
There was an error while loading. Please reload this page.
my dwg file has some mechanical drawing symbol, as show below
now i can read some info through
if entity.dxftype() == 'TOLERANCE': print(f'==============TOLERANCE type START==================') print('entity.dxf.__dict__: ', entity.__dict__) xdata = entity.xdata.data print('xdata: ', xdata) print(f"position: {entity.dxf.insert}") print(f'--------------TOLERANCE type END--------------')console out like
==============TOLERANCE type START================== entity.dxf.__dict__: {'doc': <ezdxf.document.Drawing object at 0x7edc4170de10>, 'dxf': <ezdxf.entities.dxfns.DXFNamespace object at 0x7edc40833710>, 'appdata': None, 'reactors': None, 'extension_dict': None, 'xdata': <ezdxf.entities.xdata.XData object at 0x7edc41524c10>, 'proxy_graphic': None} xdata: {'ACAD': [DXFTag(1001, 'ACAD'), DXFTag(1000, 'DSTYLE'), DXFTag(1002, '{'), DXFTag(1070, 147), DXFTag(1040, 0.5625), DXFTag(1070, 340), DXFTag(1005, '815'), DXFTag(1070, 140), DXFTag(1040, 2.2817), DXFTag(1002, '}')]} position: (375.2867461217207, -68.91774163891198, 0.0) --------------TOLERANCE type END--------------but how can i know which specific type is it, i means how can i distinct it is Concentricity or Position or Perpendicularity? i try to distinct by group code, but i didn't find corresponding group code.
All reactions