How to use Python with Jw_cad (Part 2 Command explanation and operation)

How to use Python with Jw_cad (Part 2)

Part 1 explains how to create and execute a .bat file for the external transformation function of Jw_cad. In Part 2 this time, we will explain the actual movement with REM # ~~~ described in the external transformation file (.bat).

What is [REM # ~~~]?

As I mentioned a little in Part 1, it is a command that works only in Jw_cad.

The original meaning is to write REM ~~~ when leaving a comment in the batch file. It is used as a string that is neither displayed on the screen nor executed. In Jw_cad, it is said that the command operates in Jw_cad by combining REM and␣ #.

REM # ~~~ is explained below.

Explanation of [Basic REM # ~~~]

Command name Function / operation Remarks
REM ~~~ Jw_Display name on cad After REM#Is unnecessary
REM #jww JWW format declaration Can handle block figures, dimension figures, and character fonts.
REM #jw JW format declaration On the contrary to the above, the function is limited.
Maybe you don't use it much?
REM #cd JWC in the same location as the executable file_TEMP.TXT creation If not stated,
Jw_Created in the folder where cad is installed

Use the above basic command for hogehoge.bat created in Part 1

hogehoge.bat


@echo off
REM external transformation start(hello world!!)
REM #jww
REM #cd
echo hello world!! 
pause >nul

Start with [Selection.bat]

Type the following contents in Notepad, save as and save with range selection.bat.

Range selection.bat


@echo off
REM range selection
REM #cd
REM #jww 
REM #0
call notepad.exe JWC_TEMP.TXT
pause >nul 

The difference from hogehoge.bat is that REM # 0 is added on the 5th line and call notepad.exe JWC_TEMP.TXT is added on the 6th line. By adding REM # 0, open the external transformation range selection.bat and specify the ** No.0 reference point on Jw_cad. ** is displayed, and external transformation is executed based on any point.

call notepad.exe JWC_TEMP.TXT is a command to open JWC_TEMP.TXT before the external transformation is finished. 外部変形実行 The above screen is a diagram from selection of external transformation to range selection to opening of Notepad. External transformation → Range selection.bat → Click anywhere → Command prompt is displayed → JWC_TEMP.TXT opens.

Edit [JWC_TEMP.TXT] and reflect it on the drawing.

Execute range selection.bat executed in Operation of [external transformation file], and execute Display JWC_TEMP.TXT in Notepad. (Do not touch the command prompt until you save JWC_TEMP.TXT.)

Enter the coordinate data under # as described in JWC_TEMP.TXT below. Also, delete the hq on the first line of JWC_TEMP.TXT and save it by overwriting. If the command prompt remains on the screen, press the appropriate key on the keyboard. Then, ** Qiita ** with a frame will be written at any point clicked when executing external transformation.

JWC_TEMP.TXT


hk0
~~~~~abridgement~~~~~
#
-125 -40 125 -40
-125 60 125 60
-125 -40 -125 60
125 -40 125 60
cn0 100 100 0 2
ch -125 -40 250 0 "Qiita

Explanation of [JWC_TEMP.TXT] and [Flow to operation]

The following character string is described in JWC_TEMP.TXT. (The content changes depending on the environment.)

JWC_TEMP.TXT


hq
hk 0
hs 100 100 100 600 600 100 100 100 100 1 100 100 60 100 1 1
hcw 2 2.5 2.8 3 3.2 2.5 5 7 2 5
hch 2.5 3.2 3.5 3.8 4 2.5 5 7 2 5
hcd 0 0 0.5 0 0.5 0 0 0 0 0
hcc      2      2      2      2      2      2      2      2      8      9
hn -433.572606382979 -313.508776595745 701.030585106383 140.759042553192
lg9
ly0
lc2
lt1
cn0 100 100 0 2
cn"$<MS gothic>
#
-125 -40 125 -40
-125 60 125 60
-125 -40 -125 60
125 -40 125 60
cn0 100 100 0 2
ch -125 -40 250 0 "Qiita

Information (layer, scale, etc.) on CAD data is described in the first line from hq to#. [#【JWC_TEMP.TXT】を編集し図面上へ反映させる。] As I did, by writing the line coordinates and characters + coordinates below #, the lines and characters are reflected on the drawing. If hq in the first line remains, it is considered that the processing is not completed and it is not reflected in the drawing. Therefore, delete hq so that it will be reflected in the drawing.

Here, the movement of external deformation is expressed by chewing as follows. ** Press the external transformation command on Jw_cad ** → ** Select external transformation ** → ** Select on Jw_cad (range or point) ** → ** Start command prompt ** → ** Create JWC_TEMP.TXT * * → ** Added / edited / deleted hq to JWC_TEMP.TXT ** → ** Reflected in Jw_cad **.

This time, JWC_TEMP.TXT was written manually and copied and pasted, but if you process this part with Python, it will surely progress ... work ...

Summary

As a foundation for Python to work on this page as well Explained the startup of the external transformation .bat file, the REM command, and JWC_TEMP.TXT. Next, I would like to explain how to get arguments from CAD and pass them to python when executing external transformation. ~~ I'm tired. ~~

References / Software

Jw_cad page ← This is the official page of Jw_cad. Markdown notation cheat sheet ← I used it as a reference in how to write Qitta. JWW_SMPL.BAT search ← REM command is explained. I was allowed to refer to it.

Recommended Posts

How to use Python with Jw_cad (Part 2 Command explanation and operation)
Python: How to use async with
How to install and use pandas_datareader [Python]
python: How to use locals () and globals ()
How to use CUT command (with sample)
How to use Python zip and enumerate
How to use is and == in Python
How to utilize Python with Jw_cad (Part 1 What is external transformation)
How to measure execution time with Python Part 1
How to use tkinter with python in pyenv
[Python] How to use hash function and tuple.
How to measure execution time with Python Part 2
[Python] [Django] How to use ChoiceField and how to add options
python3: How to use bottle (2)
[Python] How to use list 1
How to upload with Heroku, Flask, Python, Git (Part 3)
How to use python interactive mode with git bash
How to use Python argparse
How to upload with Heroku, Flask, Python, Git (Part 1)
How to use Service Account OAuth and API with Google API Client for python
Python: How to use pydub
[Python] How to use checkio
How to upload with Heroku, Flask, Python, Git (Part 2)
[Python] How to use input ()
How to use Python lambda
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
How to use Python bytes
Easy to use Nifty Cloud API with botocore and python
How to use Realsense's Python wrapper PyRealsense with Jetson Nano
[Python] How to play with class variables with decorator and metaclass
[Introduction to Udemy Python 3 + Application] 36. How to use In and Not
[Python] Summary of how to use split and join functions
How to do Bulk Update with PyMySQL and notes [Python]
Comparison of how to use higher-order functions in Python 2 and 3
How to log in to AtCoder with Python and submit automatically
How to install and use Tesseract-OCR
[Python] How to use Pandas Series
How to use Requests (Python Library)
How to use SQLite in Python
How to use virtualenv with PowerShell
How to use MBDyn (command setting)
How to get started with Python
How to use .bash_profile and .bashrc
How to install and use Graphviz
[Python] How to use list 3 Added
How to use Mysql in python
Python: How to use pydub (playback)
How to use PubChem in Python
How to calculate date with python
[Automation with python! ] Part 2: File operation
[Python] How to use Typetalk API
How to authenticate with Django Part 2
How to authenticate with Django Part 3
[Python] What is a tuple? Explains how to use without tuples and how to use it with examples.
How to import CSV and TSV files into SQLite with Python
How to use functions in separate files Perl and Python versions
How to make a surveillance camera (Security Camera) with Opencv and Python
How to use Serverless Framework & Python environment variables and manage stages
How to use python put in pyenv on macOS with PyCall