processParser/demoPage.md
2025-06-13 15:35:51 +08:00

40 KiB
Raw Blame History

解析器 刀库设置 指令设置 输入
    </div>
  </div>
  <div>
    代码
    <TreeSelect v-model:value="codeSelectVal" @change="codeChange" tree-node-filter-prop="label"
      :tree-data="codeOptions" class="typeSelect">
    </TreeSelect>
    指令
    <Input style="width: 100px;" @change="codeStrChange" v-model:value="codeStr" />
    <span v-show="help" style="color:red">
      <template v-if="needParam && codeStr != 'Mark'">
        该指令为内置方法。无法在此处调用
      </template>
      <template v-else>
        解析器对应的代码已配置的指令为 {{ help }}
      </template>

    </span>
    <span v-show="needParam">参数</span>
    <Input v-show="needParam" style="width: 300px;" v-model:value="param" />
  </div>

  <div style="margin-top: 20px;">
    <span>
      加工刀路数据测试---主程序CKnifeMove 测试
      <Button @click="showTest2 = !showTest2">{{ showTest2 ? '隐藏' : '显示' }}</Button>
      <!-- <span>范例数据:{x:100,y:100,z:0,dir:1,f:8000,r:0,i:0}</span> -->
    </span>
    <Form v-if="showTest2" class="form" :model="formModel">
      <FormItem class="formItem" label="x">
        <Input v-model:value="formModel.x" /><span>x坐标</span>
      </FormItem>
      <FormItem class="formItem" label="y">
        <Input v-model:value="formModel.y" /><span>y坐标</span>
      </FormItem>
      <FormItem class="formItem" label="z">
        <Input v-model:value="formModel.z" /><span>z坐标</span>
      </FormItem>
      <FormItem class="formItem" label="dir">
        <Input v-model:value="formModel.dir" /><span>使用的G代码编号,<br>例如1 = G1,目前仅支持0-3 即 G0、G1、G2、G3</span>
      </FormItem>
      <FormItem class="formItem" label="f">
        <Input v-model:value="formModel.f" /><span>速度</span>
      </FormItem>
      <FormItem class="formItem" label="r">
        <Input v-model:value="formModel.r" /><span>圆弧半径</span>
      </FormItem>
      <FormItem class="formItem" label="i">
        <Input v-model:value="formModel.i" /><span>IJK模式的i,圆心相对起点的X坐标偏移</span>
      </FormItem>
      <FormItem class="formItem" label="j">
        <Input v-model:value="formModel.j" /><span>IJK模式的i,圆心相对起点的Y坐标偏移</span>
      </FormItem>
      <FormItem class="formItem" label="k">
        <Input v-model:value="formModel.k" /><span>IJK模式的i,圆心相对起点的Z坐标偏移</span>
      </FormItem>
      <FormItem class="formItem" style="float: right;">
        <Button @click="processIn(formModel)">刀路数据输入</Button>
      </FormItem>
    </Form>
  </div>

  <div style="margin-top: 20px;">
    <!-- <Button @click="checkProcessData">数据转换</Button> -->
    <Tooltip placement="top">
      <template #title>
        <span>该测试的数据源为内置数据</span>
      </template>
      <div>
        <Button @click="finalTest">完整数据测试</Button>
        <Button @click="exportTest">导出测试</Button>
        <!-- <Button @click="exportTest1">压力导出测试</Button> -->
      </div>
    </Tooltip>

  </div>
  <div>
    <span>测试数据 </span>
    <div style="display: flex;">
      <div v-if="parserMain._device">
        机台宽
        <Input class="typeSelect1" v-model:value="parserMain._device.boardWidth" />
      </div>
      <div v-if="parserMain._device">
        机台长
        <Input class="typeSelect1" v-model:value="parserMain._device.boardLength" />
      </div>
      <div v-if="parserMain._device">
        机台高
        <Input class="typeSelect1" v-model:value="parserMain._device.boardHeight" />
      </div>
    </div>
    <div style="display: flex;">
      <div>
        水平原点
        <TreeSelect v-model:value="boardLocation" @change="boardLocationSelectChange" tree-node-filter-prop="label"
          :tree-data="boardLocationOptions" class="typeSelect1"></TreeSelect>
      </div>
      <div v-if="parserMain._device">
        垂直原点
        <TreeSelect v-model:value="parserMain._device.originZ0Position" tree-node-filter-prop="label"
          :tree-data="options1" class="typeSelect1"></TreeSelect>
      </div>
      <div>
        纵轴轴向
        <TreeSelect v-model:value="widthSideAxis" @change="widthSideAxisSelectChange" tree-node-filter-prop="label"
          :tree-data="SideAxisOptions" class="typeSelect1"></TreeSelect>
      </div>
      <div>
        横轴轴向
        <TreeSelect v-model:value="lengthSideAxis" @change="lengthSideAxisSelectChange"
          tree-node-filter-prop="label" :tree-data="SideAxisOptions" class="typeSelect1"></TreeSelect>
      </div>
      <div v-if="parserMain._device">
        垂直轴向
        <TreeSelect v-model:value="parserMain._device.heightAxis" tree-node-filter-prop="label"
          :tree-data="heightSideAxisOptions" class="typeSelect1"></TreeSelect>
      </div>
    </div>
    <div style="display: flex;">
      <div v-if="parserMain._device">
        是否空行处理
        <Switch v-model:checked="parserMain._device.isFilterEmptyLine"></Switch>
        <!-- <Input class="typeSelect1" v-model:value="parserMain._device.boardWidth" /> -->
      </div>
      <div v-if="parserMain._device">
        是否显示注释
        <Switch v-model:checked="parserMain._device.isNcFileComment"></Switch>
      </div>
      <div v-if="parserMain._device">
        空行插入前缀
        <Switch v-model:checked="parserMain._device.isNcLinePrefixEnabled"></Switch>
        <Input class="typeSelect1" v-model:value="parserMain._device.ncLinePrefix" />
      </div>
      <div v-if="parserMain._device">
        空行插入后缀
        <Switch v-model:checked="parserMain._device.isNcLineSuffixEnabled"></Switch>
        <Input class="typeSelect1" v-model:value="parserMain._device.ncLineSuffix" />
      </div>
      <div v-if="parserMain._device">
        精简指令
        <Switch v-model:checked="parserMain._device.isUseSimpleCode"></Switch>
      </div>
      <div v-if="parserMain._device">
        换刀后精简
        <Switch v-model:checked="parserMain._device.isSimpleFirstCode"></Switch>
      </div>
      <div v-if="parserMain._device">
        圆弧反转
        <Switch v-model:checked="parserMain._device.reverseArcCode"></Switch>
      </div>
    </div>
    <div style="display: flex; flex-wrap: wrap;">
      <div style="margin:auto 0;">NC标识符----:</div>
      <div v-if="parserMain._device">
        G0
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeFreeMove" />
      </div>
      <div v-if="parserMain._device">
        G1
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeLineInterpolation" />
      </div>
      <div v-if="parserMain._device">
        G2
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeClockwiseArcInterpolation" />
      </div>
      <div v-if="parserMain._device">
        G3
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeAnticlockwiseArcInterpolation" />
      </div>
      <!-- <div v-if="parserMain._device">
        X
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeAxisX" />
      </div>
      <div v-if="parserMain._device">
        Y
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeAxisY" />
      </div>
      <div v-if="parserMain._device">
        Z
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeAxisZ" />
      </div>
      <div v-if="parserMain._device">
        F
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeSpeed" />
      </div>
      <div v-if="parserMain._device">
        I
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeIncrementAxisX" />
      </div>
      <div v-if="parserMain._device">
        J
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeIncrementAxisY" />
      </div>
      <div v-if="parserMain._device">
        K
        <Input class="typeSelect2" v-model:value="parserMain._device.NcCodeIncrementAxisZ" />
      </div> -->
    </div>
    <Button @click="testDataSubmit">输出</Button>
    <span style="color: red;">说明G代码支持大小写兼容 ,指令可以参考指令设置,换刀指令:【TD】【TN】,G2、G3 圆弧指令输入R则优先为R模式 否则根据IJK值生成代码</span>
    <!-- <Button @click="testFileExportSubmit">导出测试</Button> -->
    <div class="testDataBox">
      <Textarea class="testData" v-model:value="testData1"></Textarea>
      <Tooltip>
        <template #title>
          <span>范例</span>
        </template>

        <Textarea class="testData" :disabled="true" v-model:value="testData"></Textarea>
      </Tooltip>

    </div>

  </div>
</div>
<div class="code">
  <div class="tool">
    <Button @click="clearTextarea">clear</Button>
  </div>
  <Textarea class="codeTextarea" :disabled="codeTextareaDisable" v-model:value="output"></Textarea>
</div>
<Modal v-model:open="showOrderConfig" :title="'指令设置--' + deviceOptions.find(e => e.value == deviceSelectVal)?.label"
  :width="1000" @cancel="clearOrderSetting" @ok="orderConfigSubmit">
  <div class="modelContent" v-if="orderSettingArr">

    <template v-for="(orderSetting, i) in orderSettingArr">
      <div>
        <span>{{ orderSetting.label }}</span>
        <Button @click="add(orderSetting, i)" style="float: right;" type="primary" shape="circle">
          <template #icon>
            <PlusOutlined />
          </template>
        </Button>
        <Table :data-source="orderSetting.orderArr" :columns="columns" :pagination="false">
          <template #bodyCell="{ column, record: _record, index }">
            <template v-if="column.key === 'name'">
              <Input :disabled="true" v-model:value="orderSettingArr[i].orderArr[index].name"></Input>
            </template>
            <template v-if="column.key === 'value'">

              <Textarea v-if="orderSettingArr[i].orderArr[index].type != 'function'"
                v-model:value="orderSettingArr[i].orderArr[index].value"></Textarea>
              <span v-else>
                内置指令,无法修改
              </span>
            </template>
            <template v-if="column.key === 'action' && orderSettingArr[i].orderArr[index].type != 'function'">
              <span @click="remove(orderSetting, i, column, _record, index)"
                style="color:red;cursor: pointer;">移除</span>
            </template>
          </template>
        </Table>
      </div>
    </template>
  </div>
</Modal>
<Modal v-model:open="showKnifeConfig" :title="'设置刀库'" :width="1000" @ok="KnifeConfigSubmit">
  <div class="modelContent">
    <Button style="float:right" @click="addKnife">新增刀具</Button>
    <Table :data-source="knifeListTableData" :columns="columns_knife" :scroll="{ x: 1500, y: 300 }">
      <template #bodyCell="{ column, record: _record, index }">
        <template v-if="column.key === 'knifeName' || column.key === 'knifeType'">
          <Input v-model:value="knifeListTableData[index][column.key]"></Input>
        </template>
        <template
          v-if="['diameter', 'length', 'stepDepth', 'offsetX', 'offsetY', 'offsetZ', 'axiosX', 'axiosY'].includes(column.key?.toString())">
          <InputNumber v-model:value="knifeListTableData[index][column.key]" />
        </template>
        <template
          v-else-if="column.key == 'knifeStartCode' || column.key == 'knifeStopCode' || column.key == 'axisStartCode' || column.key == 'axisStopCode'">
          <Textarea v-model:value="knifeListTableData[index][column.key]"></Textarea>
        </template>
        <template
          v-else-if="['isEnabled', 'isAxisStartCodePostpost', 'isAxisStartCodePrepost'].includes(column.key?.toString())">
          <Checkbox v-model:checked="knifeListTableData[index][column.key]" />
        </template>
        <template v-else-if="column.key === 'action'">
          <span @click="removeKnife(_record, index)" style="color:red;cursor: pointer;">移除</span>
        </template>
      </template>
    </Table>
  </div>
</Modal>