(参考)Quick-Info ? ezdxf 0.8.8 documentation
(参考)Tutorials
(参考)第36回#オープンCAE勉強会@関西
まずは,NotFoundErrorから
C:\Users\xxx\PycharmProjects\untitled4\venv\Scripts\python.exe C:/Users/xxx/.PyCharmCE2018.2/config/scratches/getdxf.py
Traceback (most recent call last):
File "C:/Users/xxx/.PyCharmCE2018.2/config/scratches/getdxf.py", line 1, in
import ezdxf
ModuleNotFoundError: No module named 'ezdxf'
Process finished with exit code 1
ezdxfをインストールした後、次のエラー
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
if not is_dxf_file(filename):
with io.open(filename, errors='ignore') as fp:
OSError: [Errno 22] Invalid argument: 'C:\temp\901-layerari.dxf'
Process finished with exit code 1
python - pythonで簡単なランチャーを作ろうと思うのですがopen関数を使うとエラーが出てしまいます。 - スタック・オーバーフロー
print_entity not defined
C:\Users\xxx\PycharmProjects\untitled4\venv\Scripts\python.exe C:/Users/xxx/.PyCharmCE2018.2/config/scratches/getdxf.py
Traceback (most recent call last):
File "C:/Users/xxx/.PyCharmCE2018.2/config/scratches/getdxf.py", line 10, in module
print_entity(e)
NameError: name 'print_entity' is not defined
Process finished with exit code 1
not all arguments converted during string formatting
C:\Users\xxx\PycharmProjects\untitled4\venv\Scripts\python.exe C:/Users/xxx/.PyCharmCE2018.2/config/scratches/getdxf.py
Traceback (most recent call last):
LINE on layer: 0
File "C:/Users/xxx/.PyCharmCE2018.2/config/scratches/getdxf.py", line 12, in module
print_entity(e)
File "C:/Users/xxx/.PyCharmCE2018.2/config/scratches/getdxf.py", line 3, in print_entity
print("start point: %s\n" % e.dxf.start)
TypeError: not all arguments converted during string formatting
Process finished with exit code 1
以下で何となく動いている。
# (例)input file=C:/temp/tadasiidxf901.dxf
def print_entity(e):
print("Line: ", e.dxf.start,e.dxf.end)
import ezdxf
dwg =ezdxf.readfile("C:/temp/tadasiidxf901.dxf")
msp = dwg.modelspace()
for e in msp:
if e.dxftype() == 'LINE':
print_entity(e)
# entity query for all LINE entities in model space
# for e in msp.query('LINE'):
# print_entity(e)
20220821
WARNING: You are using pip version 21.1.1; however, version 22.2.2 is available.
You should consider upgrading via the 'c:\users\xxx\appdata\local\programs\python\python38\python.exe -m pip install --upgrade pip' command.