榫卯智能化加工代码生成系统的开发 -...

9
DOI:10.13332/j.1000−1522.20180414 榫卯智能化加工代码生成系统的开发 1 关惠元 1 2 代鹏飞 3 (1. 南京林业大学家居与工业设计学院,江苏 南京 2100372. 中国运载火箭技术研究院,北京 1000763. 苏州铨木智能科技有限公司,江苏 苏州 215131) 摘要:目的】榫卯加工代码的制作是实现榫卯数控加工的关键,但传统数控编程存在难度大、效率低、过度依赖 CAM 件等问题,因此有必要开发一款高效的榫卯智能化加工代码生成系统。【方法】本研究首先利用成组技术对榫卯进行分 组,提取各组榫卯的尺寸参数,建立参数化的工件数据库。然后,通过对大量工艺经验和已有榫卯配合相关研究成果的函 数表达,实现了榫卯尺寸智能匹配。接着,利用模板技术建立了每一类榫卯零件的参数化加工代码模板,并组建了刀具路 径代码模块。运用表达式驱动算法完成对代码模板的实例化,由加工参数的变化带动模板内数值的变动,进而自动生成 NC 代码,实现了榫卯加工数控程序的参数化、模块化设计。最后,基于后处理原理,通过外接程序的方式完成坐标补偿 值的自动计算与添加,实现了加工代码后处理自动补偿。在此基础上,运用可视化的编程语言 VB 开发了一款榫卯智能 化加工代码生成系统。【结果】结合改良型粽角榫零件加工代码的制作,验证了系统的可行性。通过实际加工以及对被加 工零件尺寸的检验,验证了系统生成加工代码的准确性。【结论】本系统具有操作简单、质量稳定等特点,实现了榫卯加工 编程工序的简化和代码的自动生成,极大地提高了编程效率,有助于推动榫卯加工由经验型向知识型的转变。 关键词:榫卯;数控编程;智能化;参数化;模板技术 中图分类号:TS657 文献标志码:A 文章编号:1000−1522(2019)03−0134−09 引文格式:汤琳,关惠元,王宁,等. 榫卯智能化加工代码生成系统的开发 [J]. 北京林业大学学报,201941(3)134−142. Tang Lin, Guan Huiyuan, Wang Ning, et al. Development of intelligent programming system for numerical controlled mortise and tenon joint[J]. Journal of Beijing Forestry University, 2019, 41(3): 134−142. Development of intelligent programming system for numerical controlled mortise and tenon joint Tang Lin 1 Guan Huiyuan 1 Wang Ning 2 Dai Pengfei 3 (1. College of Furnishings and Industrial Design, Nanjing Forestry University, Nanjing 210037, Jiangsu, China; 2. China Academy of Launch Vehicle TechnologyBeijing 100076, China; 3. Suzhou Quanmu Technology Co. LTD., Suzhou 215131, Jiangsu, China) Abstract: [Objective] Code generation is the key to realize the numerical controlled (NC) machining of mortise and tenon joint, but the traditional NC programming is difficult, inefficient and over-dependent on CAM software. So it is necessary to develop an intelligent programming system for the numerical controlled mortise and tenon joint. [Method] Firstly, the joints were classified by group technology, and a parameterized artifact database was established based on the extraction of joints’ dimension parameters. Intelligent dimension matching was implemented by transforming plentiful process experience and existing research results into functions. Then, the standard NC code template of each joint was set up according to template technology, and these standard NC code templates constituted the module of toolpaths. We used expression algorithm to complete the instantiation of code templates. The change of machining parameters 收稿日期: 2018−12−18 修回日期: 2019−01−02 基金项目: 国家林业公益性行业科研专项(201204700202),江苏省高校优势学科建设工程资助项目 PAPD第一作者: 汤琳,博士生。主要研究方向:家具设计与工程。Email[email protected] 地址:210037 江苏省南京市玄武区龙蟠路 159 号南 京林业大学家居与工业设计学院。 责任作者: 关惠元,教授,博士生导师。主要研究方向:家具设计及理论、人体工程学、家具生产制造。Email[email protected] 址:同上。 本刊网址: http://j.bjfu.edu.cnhttp://journal.bjfu.edu.cn 41 卷第 3 Vol. 41No. 3 2019 3 JOURNAL OF BEIJING FORESTRY UNIVERSITY Mar. 2019

Transcript of 榫卯智能化加工代码生成系统的开发 -...

Page 1: 榫卯智能化加工代码生成系统的开发 - bjfu.edu.cnj.bjfu.edu.cn/fileBJLYDXXB/journal/article/bjlydxxb/2019/...2018/04/14  · Email:106330176@qq.com 地址:210037 江苏省南京市玄武区龙蟠路159号南

  DOI:10.13332/j.1000−1522.20180414

榫卯智能化加工代码生成系统的开发

汤    琳1      关惠元1      王    宁2      代鹏飞3

(1. 南京林业大学家居与工业设计学院,江苏 南京 210037;2. 中国运载火箭技术研究院,北京 100076;3. 苏州铨木智能科技有限公司,江苏 苏州 215131)

摘要:【目的】榫卯加工代码的制作是实现榫卯数控加工的关键,但传统数控编程存在难度大、效率低、过度依赖 CAM软

件等问题,因此有必要开发一款高效的榫卯智能化加工代码生成系统。【方法】本研究首先利用成组技术对榫卯进行分

组,提取各组榫卯的尺寸参数,建立参数化的工件数据库。然后,通过对大量工艺经验和已有榫卯配合相关研究成果的函

数表达,实现了榫卯尺寸智能匹配。接着,利用模板技术建立了每一类榫卯零件的参数化加工代码模板,并组建了刀具路

径代码模块。运用表达式驱动算法完成对代码模板的实例化,由加工参数的变化带动模板内数值的变动,进而自动生成

NC代码,实现了榫卯加工数控程序的参数化、模块化设计。最后,基于后处理原理,通过外接程序的方式完成坐标补偿

值的自动计算与添加,实现了加工代码后处理自动补偿。在此基础上,运用可视化的编程语言 VB开发了一款榫卯智能

化加工代码生成系统。【结果】结合改良型粽角榫零件加工代码的制作,验证了系统的可行性。通过实际加工以及对被加

工零件尺寸的检验,验证了系统生成加工代码的准确性。【结论】本系统具有操作简单、质量稳定等特点,实现了榫卯加工

编程工序的简化和代码的自动生成,极大地提高了编程效率,有助于推动榫卯加工由经验型向知识型的转变。

关键词:榫卯;数控编程;智能化;参数化;模板技术

中图分类号:TS657       文献标志码:A       文章编号:1000−1522(2019)03−0134−09

引文格式:汤琳,关惠元,王宁,等. 榫卯智能化加工代码生成系统的开发 [J]. 北京林业大学学报,2019,41(3):134−142.

Tang Lin,  Guan Huiyuan,  Wang Ning,  et  al.  Development  of  intelligent  programming system for  numerical  controlled mortise

and tenon joint[J]. Journal of Beijing Forestry University, 2019, 41(3): 134−142.

Development of intelligent programming system for numericalcontrolled mortise and tenon joint

Tang Lin1 Guan Huiyuan1 Wang Ning2 Dai Pengfei3

(1. College of Furnishings and Industrial Design, Nanjing Forestry University, Nanjing 210037, Jiangsu, China;

2. China Academy of Launch Vehicle Technology,Beijing 100076, China;

3. Suzhou Quanmu Technology Co. LTD., Suzhou 215131, Jiangsu, China)

Abstract: [Objective] Code  generation  is  the  key  to  realize  the  numerical  controlled  (NC)  machining  ofmortise and tenon joint, but the traditional NC programming is difficult,  inefficient and over-dependent onCAM software. So it is necessary to develop an intelligent programming system for the numerical controlledmortise  and  tenon  joint.  [Method]  Firstly,  the  joints  were  classified  by  group  technology,  and  aparameterized  artifact  database  was  established  based  on  the  extraction  of  joints ’  dimension  parameters.Intelligent dimension matching was implemented by transforming plentiful process experience and existingresearch results into functions.  Then, the standard NC code template of each joint was set up according totemplate  technology,  and  these  standard  NC code  templates  constituted  the  module  of  toolpaths.  We usedexpression algorithm to complete the instantiation of code templates. The change of machining parameters

  收稿日期: 2018−12−18   修回日期: 2019−01−02基金项目: 国家林业公益性行业科研专项(201204700202),江苏省高校优势学科建设工程资助项目 PAPD。第一作者: 汤琳,博士生。主要研究方向:家具设计与工程。Email:[email protected] 地址:210037 江苏省南京市玄武区龙蟠路 159号南

京林业大学家居与工业设计学院。

责任作者: 关惠元,教授,博士生导师。主要研究方向:家具设计及理论、人体工程学、家具生产制造。Email:[email protected] 地

址:同上。

本刊网址: http://j.bjfu.edu.cn;http://journal.bjfu.edu.cn

第 41 卷 第 3 期 北    京    林    业    大    学    学    报 Vol. 41,No. 32019 年 3 月 JOURNAL  OF  BEIJING  FORESTRY  UNIVERSITY Mar. ,2019

Page 2: 榫卯智能化加工代码生成系统的开发 - bjfu.edu.cnj.bjfu.edu.cn/fileBJLYDXXB/journal/article/bjlydxxb/2019/...2018/04/14  · Email:106330176@qq.com 地址:210037 江苏省南京市玄武区龙蟠路159号南

leaded to the change of values in NC code templates, so the NC codes can be programmed automatically, theparameterized and modularized NC programs can be achieved. Based on the principle of post-processing, thecompensation  of  NC  code  was  achieved  through  the  add-in  that  can  calculate  the  compensation  valueautomatically.  At  last,  on  the  basis  of  those  researches,  an  intelligent  programming  system  for  numericalcontrolled  mortise  and  tenon  joint  was  developed  by  the  visualization  program  VB.  [Result]  Combinedwith  the  actual  authoring  of  three-way  mitered  joint  part,  the  feasibility  of  the  system  was  verified.  Bychecking the dimensions of the processed part, the accuracy of the machining codes generated by the systemwas also verified. [Conclusion] This system is simple, stable and efficient. It can simplify the programmingprocess  and  generate  program  NC  codes  automatically.  The  system  is  helpful  to  transform  processing  ofmortise and tenon joint from experience type to knowledge-based type.Key words: mortise  and  tenon  joint;  NC  programming;  intelligentialize;  parameterization;  templatetechnology

榫卯是一种典型的模块化结构件,具有种类繁

多、尺寸多变、加工工艺相对固定等特点[1]。榫卯长

期以来一直是家具加工流程中最为耗时的工序之

一。近年来,随着实木家具生产向定制化、信息化方

向发展,数控设备也被广泛的应用于榫卯加工中。

现有榫卯数控加工使用的加工代码必须通过第三方

CAM软件生成,但市面上的 CAM软件大多缺乏专

用型,应用分散、独立[2],每次编程仍需手工重新输

入所有参数,造成编程工作重复性劳动多、效率低。

数控加工程序的编制是一项综合要求较高的技术[3],

既要求操作人员能熟练操作 CAM软件,又要求操作

人员有丰富的加工经验,这与家具企业该类人才缺

乏的现状形成了尖锐的矛盾。此外,榫卯手工加工

阶段积累了大量工艺知识、工艺数据,却仍没有形成

统一的榫卯生产质量标准,榫卯数控加工程序质量

难以保证[4]。

基于以上现状,本研究利用分组技术、模板技术

以及参数化理论,研究了一种快速便捷,对编程人员

要求低,稳定可靠,与数控设备良好兼容的智能化编

程方法,并利用此方法,以 Visual Basic 6.0为支撑平

台,开发了一款面向榫卯数控加工编程的智能化系

统(Computer aided process planning,CAPP)。该系统

对于推动榫卯加工工艺智能化,提高榫卯加工的质

量和效率具有重要意义,这也符合我国木工数控设

备自动化处理技术专门化、智能化的趋势[5−6]。

1   系统的核心问题

1.1 榫卯尺寸的智能匹配

1.1.1    榫卯尺寸参数的提取

榫卯具有显著的模块化特征,通过成组技术,将

榫卯按结构和几何特征的相似性,逐级分组,然后对

影响榫卯形状的尺寸参数进行分类。图 1为榫卯尺

寸参数关系图,榫卯尺寸参数可分为材料参数、位置

参数、形状参数、配合参数 4类;其中自变量为必须

手动输入的参数,因变量为系统通过自动计算可得

到的参数。这种分类形式能有效减少需要手动计算

并输入的参数数量,降低误操作的几率。

1.1.2    基于材料的榫卯配合尺寸匹配

榫卯配合参数是影响榫卯强度的重要因素之

一,配合参数又与材料直接相关。关于这方面的研

究很多[7−10],但在实际加工的运用当中,大多数企业

是将一组配合量套用在所有材料上。这一方面是由

于企业对配合参数对榫卯强度的影响认知还不够,

另一方面是企业缺少既熟悉数控加工又了解木材特

性的人才。本系统建立了配合量与常见木材的函数

关系。当用户选定材料之后,系统将自动计算出最

佳配合量,并填入榫卯配合参数框中。为了更贴近

企业生产实际情况,配合参数框的建议值设置为可

修改模式,企业可根据生产条件适当调整配合参数。

1.1.3    基于工艺经验的榫卯尺寸参数判断

榫卯在实际加工中,还存在大量的工艺数据,这

些工艺数据掌握在少数工艺设计人员手中,没有得

到过整理分析。在实际生产中,新产品尺寸参数的

确定和优化主要依靠试加工摸索,浪费了人力物

力。本系统把这些分散的工艺数据统一成函数形

式,存入系统工艺数据库中。系统可以自动地进行

合法性验证。每个约束关系都是一个关系表达式,

因此,判断约束关系的问题,实质是表达式求值问

题 [11]。表 1为部分榫卯尺寸的工艺要求和函数表

达,系统利用这些工艺要求函数,对接收到的榫卯和

刀具尺寸参数先进行匹配和判断,如不符合工艺经

验要求将立即报错。

1.2 刀具路径代码模块的建立

1.2.1    标准加工代码文件的模块划分

通过对同一类榫卯结构的标准 NC代码结构和

内容的分析,发现同一类型榫卯的标准 NC代码具

第 3 期 汤    琳等:榫卯智能化加工代码生成系统的开发 135

Page 3: 榫卯智能化加工代码生成系统的开发 - bjfu.edu.cnj.bjfu.edu.cn/fileBJLYDXXB/journal/article/bjlydxxb/2019/...2018/04/14  · Email:106330176@qq.com 地址:210037 江苏省南京市玄武区龙蟠路159号南

有极大的相似性。因此可以采用模板技术,将同一

类榫卯的刀具路径抽象成一个模板,由加工参数的

变化带动模板内部分数值的变动。将这种规范化、

标准化的刀具路径模板进行存储,就形成了系统的

刀具路径模块库[12]。模板中包含静态和动态 2个部

分(图 2),静态对象是指模板中无需改变直接输出的

固定部分,例如代码文件首末尾预处理格式模块;动

态部分则是指会根据外部输入变化的部分,例如切

削运动模块,动态部分多通过变量或函数的方式进

行定制[13],是刀具路径模板里最重要的部分。对于

静态部分(预处理格式模块、刀具模块),可用基本指

令直接写入数据库,需要时进行调用;动态模块(切

削运动模块)则受加工参数影响,且变动频繁,因此

切削运动模块的模板化表述则是刀具路径代码模块

建立的难点和重点。

1.2.2    切削运动模块加工点数值参数化

结合机械加工一般流程,对榫卯加工切削运动

模块再进行流程提取,流程如表 2所示,为“刀具定

位→刀轴旋转→主轴转速确定→快进至工件表

面→加工→抬刀→退刀”。各类榫卯和零件的切削运

表 1    部分榫卯尺寸的工艺要求和函数表达

Tab. 1    Technological requirements and function expressions of mortise and tenon joint

工艺经验Process experience

函数表达Function expression

备注Remarks

榫眼宽度约为卯材厚的1/3.5 ~ 1/4Thickness of mortise is about 1/3.5−1/4 of material  D/4 ≤ A ≤ D/3.5 A为榫眼宽度,D为卯材厚

A is mortise width, and D is material thickness

榫眼宽度不小于铣刀直径Mortise width is not less than milling cutter diameter  A ≥ d d为铣刀直径

d is milling cutter diameter

双直榫榫间距不小于铣刀直径Spacing between two tenons is not less than thediameter of the milling cutter

 W3 ≥ d W3为双榫榫间距W3 is spacing between two tenons

粽角榫立料上两榫头间最小距离不小于铣刀直径Spacing between two tenons on vertical material ofthree-way mitered joint is not less than the diameterof the milling cutter

 a ≤ 1.414 2 × (W − W4 −W5 − W6 − b) − d

W4为左边距,W5为右边距,W6为榫偏置,a为榫头厚度,b为榫头宽度W4 is left margin, W5 is right margin, W6 is jointoffset, a is joint thickness, and b is joint width

 

自变量 Independent variable 因变量 Dependent variable

位置尺寸Position

dimension

上边距Top margin

下边距Bottom margin

左边距Left margin

右边距Right margin

榫卯尺寸Mortise andtenon joint

size

榫眼深度Mortise depth

榫眼宽度Mortise width

榫眼高度Mortise height

榫头长度Joint length

榫头厚度Joint thickness

榫头宽度Joint width

榫卯间距Mortise andtenon joint

spacing

材料尺寸Material size

材料Material

材料宽度Material width

材料厚度Materialthickness

材料长度Material length

配合尺寸Fit dimension

长度方向配合Fit tolerance inlength direction

宽度方向配合Fit tolerance inwidth direction

厚度方向配合Fit tolerance in

thickness direction

图 1    榫卯尺寸参数关系

Fig. 1    Dimension parameter relationship of mortise and tenon joint 

 136 北    京    林    业    大    学    学    报 第 41 卷    

Page 4: 榫卯智能化加工代码生成系统的开发 - bjfu.edu.cnj.bjfu.edu.cn/fileBJLYDXXB/journal/article/bjlydxxb/2019/...2018/04/14  · Email:106330176@qq.com 地址:210037 江苏省南京市玄武区龙蟠路159号南

动模块流程形式基本一致,区别在于加工环节。因

此,可以将除加工环节以外的其他环节的格式固定

下来,如刀具定位必有 G00、G90,主轴转速确定必

出现 S、M03,只对代码地址后变动的数值进行参数

化。确定需要进行参数化的对象为:主轴转速、进给

速度、加工点坐标等,参数化结果如图 3所示,其中

主轴转速和进给速度直接关联用户的输入值,加工

点坐标采用表达式驱动算法[12],表达式由榫卯尺寸

参数和刀具参数组成的函数表示,榫卯尺寸参数和

刀具参数的变动直接驱动加工点坐标值的变化。对

于榫卯加工中一些重复频率较高的加工工艺(如直

线补插、圆弧补插、深度加工等),可以通过结合固定

循环指令来完成编程,例如椭圆斜榫的切削就可以

通过“圆弧补插 + 深度判断”指令的循环使用来完成。

1.3 偏置补偿外接程序的建立

由于数控机床搭载的控制系统的不同,机床可

以识别并执行的代码形式也有所差别,因此必须对

标准 NC代码进行后处理。后处理主要分为 2部分,

即格式后处理和偏置补偿后处理[13−14]。格式后处理

一般是在标准 NC代码的前后添加或修改固定代码

行,参考 1.2.1内容,将固定代码行视为静态模块,直

接存入刀具路径模块库,需要时直接调用即可。另

一个部分则是偏置补偿,偏置补偿的原理是通过补

偿函数算得 X、Y、Z轴坐标值的补偿量,然后对每一

个刀路加工点进行补偿,使加工坐标系下各坐标点

与工件坐标系一致[15−16]。设 Ot、Xt、Yt、Zt 为加工坐标

系,坐标系原点为 Ot,则能被机床正确加工的坐标

值 Xt、Yt、Zt 为:

表 2    榫卯加工切削运动模块的一般流程和固定格式

Tab. 2    General workflow and fixed format for cutting motion module of mortise and tenon joint processing

        流程 Flow 固定格式 Fixed format

刀具定位 Cutter positioning G00 G90 X(…)/Y(…)

刀轴旋转 Cutter shaft rotation A(…)/B(…)/C(…)

主轴转速确定 Spindle speed determination S(…) M03

快进至工件表面 Fast forward to workpiece surface X(…)/Y(…)/Z(…)

加工 Processing G01/G02/G03 X(…)/Y(…)/Z(…) F(…)

抬刀 Cutter lifting G00 X(…)/Y(…)/Z(…)

退刀 Tool retracting G00 X(…)/Y(…)/Z(…)

注:(…)表示需要参数化的数值。Note: (…) means value that needs to be parameterized.

 

格式预处理模块(静态)Format preprocessing module (static module)

格式预处理模块(静态)Format preprocessing module (static module)

G40 G17 G94 G90 G71

G00 G53 Z-90.

G00 G90 G55 X0 A0 B0

Z0 Y0

M00

M15

G00 G53 Y10. Z-90.

T04 M06

G00 G90 X-253.55 Y45.597

A-45. B-90.

S8071 M03

Z99.09

X-234.458 Y26.505

G01 X-232.337 Y24.383 F5000.

X-158.416 Y98.304

X-118.416Y138.304

X-44.495 Y212.225

X-46.616 Y214.347

G00 X-65.708 Y233.438

G00 G53 Z-90.

M05

M16

M99

刀具准备模块(静态)Tool preprocessing module (static module)

切削运动模块(动态)Cutting motion module (dynamic module)

图 2    某榫孔加工 NC代码模块划分示意图

Fig. 2    Schematic diagram of NC code module division of one mortise 

第 3 期 汤    琳等:榫卯智能化加工代码生成系统的开发 137

Page 5: 榫卯智能化加工代码生成系统的开发 - bjfu.edu.cnj.bjfu.edu.cn/fileBJLYDXXB/journal/article/bjlydxxb/2019/...2018/04/14  · Email:106330176@qq.com 地址:210037 江苏省南京市玄武区龙蟠路159号南

Xt = X0+X偏

Yt = Y0+Y偏

Zt = Z0+Z偏

(1)

式中:X0、Y0、Z0 为工件坐标系下标准坐标值,X偏、

Y偏、Z偏为通过补偿函数得到的坐标补偿数值。

以 CB型五轴机床为例,通过五轴工装补偿原

理,可以得到该型加工坐标系原点 Ot 偏置量 X偏、

Y偏、Z偏为:X偏 = Xt−X0 = S +X+Y sinC−

X cosC−S cos BcosC+Lsin BcosCY偏 = Yt−Y0 = Y −Y cosC−

X sinC−S cos BsinC+Lsin BsinCZ偏 = Zt−Z0 = S sin B+Lcos B

(2)

式中:X为 B轴中心到 A轴中心在 X轴方向上的偏

置,mm;Y为 B轴中心到 A轴中心在 Y轴方向上的

偏置,mm;S为刀轴摆动中心到 B轴中心在 X方向

上面的偏置,mm;L为刀尖中心点到 B轴中心在

Z轴方向上的偏置,mm,即刀具摆长(无 RTCP功能

时,为刀长 + 摆长);B为 B轴旋转角度,°;C为 C轴

旋转角度,°。偏置补偿的功能,通过外接程序的形式来实

现。外接程序接收到用户输入的机床偏置参数,自

动计算 X、Y、Z坐标补偿量,并将补偿量传回主系统

的刀具路径代码模块中,再通过式(1),计算并得到

机床可正确加工的坐标值。

2   系统开发设计

2.1 系统的构成与工作流程

2.1.1    系统构成

图 4为榫卯自动化加工代码生成系统的功能模

块划分。榫卯自动化加工代码生成系统主要由 3大模块及其子模块组成,其中普通用户有权限对输入

功能模块和数据输出功能模块进行操作,而数据库

模型只对工程师开放权限,普通用户无权查看和修

改。选用 Visual Basic 6.0作为用户界面开发工具,

以它的脚本语言 VBScript为编程工具,在 Win7上编程实现。

2.1.2    系统工作流程

图 5为系统的工作流程图。

① 进入榫卯管理子系统,选择榫卯类型,系统

调取刀路模块库中相应刀具路径模板;输入榫卯尺

寸参数,系统将参数自动存储到工件数据库对应参

 

G00 G90 X(−W1−W2−0.5ΔA1−A1+0.5d1). Y(−W+W4+0.5ΔB1−0.5B1+d1−0.1+0.577(H01+1))

A0.0 B0.0

S18113 M03

Z(D+30)

Z(D+1)

G01 Y(−W+W4+0.5ΔB1+0.5B1) Z(D) F8000

X(−W1−W2−0.5ΔA1−A1−0.5d1) Z(D−H01−1)

Y(−W+W4+0.5ΔB1+B1−0.5A1) Z(D−H01−1.5)

X(−W1−W2−0.5ΔA1−0.5d1) Z(D−6−0.5d1)

Y(−W+W4+0.5ΔB1+0.5A1) Z(D−6)

X(−W1−W2−0.5ΔA1−A1+0.5d1) Y(−W+W4+0.5ΔB1+0.5B1)

Y(−W+W4+0.5ΔB1+0.5B1+0.5)

Y(−W+W4+0.5ΔB1+B1−0.5A1)

G00 Z(D+1)

Y(−W+W4+0.5ΔB1+0.5A1) Z(D)

G01 Y(−W+W4+0.5ΔB1+0.5B1) Z(D−2H02+1)

X(−W1−W2−0.5ΔA1−0.5d1) Z(D−2H02)

Y(−W+W4+0.5ΔB1+ 0.5B1+0.05)

G01 Z(D+1)

G00 Z(D+30)

刀具定位Cutter positioning刀轴旋转

Cutter shaft determination 主轴转速确定Rotation spindle speed 刀具定位

Cutter positioning rotation 快进至工件表面Fast forward to workpiece surface rotation

加工Processing rotation

抬刀Cutter lifting

退刀Tool retract

W. 材料宽度/mm; D. 材料厚度/mm; W1. 边距/mm; W2. 榫偏置/mm; W4. 榫肩/mm; A1. 榫眼宽度/mm; B1. 榫眼高度/mm; d1. 刀号为 1的铣刀的

直径/mm; H01. 刀号为 1的铣刀每次下刀深度/mm; H02. 刀号为 2的铣刀每次下刀深度/mm; ΔA1. 榫眼宽度与榫头厚度方向配合量/mm; ΔB1.榫眼高度与榫头宽度方向配合量/mm。W, material width/mm; D, material thickness/mm; W1, margin/mm; W2, offset of mortise/mm; W4, shoulderof mortise/mm; A1, width of mortise/mm; B1, height of mortise/mm; d1, diameter of the milling cutter with cutter No. 1/mm; H01, per cutting depth ofmilling cutter  with cutter  No.  1/mm; H02,  per  cutting depth of  milling cutter  with cutter  No.  2/mm; ΔA1,  fit  between the width of  mortise  and thethickness of tenon/mm; ΔB1, fit between the height of mortise and the width of tenon/mm.

图 3    切削运动模块加工点数值参数化

Fig. 3    Numerical parameterization of working points in cutting movement module 

 138 北    京    林    业    大    学    学    报 第 41 卷    

Page 6: 榫卯智能化加工代码生成系统的开发 - bjfu.edu.cnj.bjfu.edu.cn/fileBJLYDXXB/journal/article/bjlydxxb/2019/...2018/04/14  · Email:106330176@qq.com 地址:210037 江苏省南京市玄武区龙蟠路159号南

 

榫卯自动化加工代码生成系统Intelligent programming system for numerical

controlled mortise and tenon joint

用户输入模块User input module

核心模块Kernle module

代码输出模块Code output module

榫卯尺寸参数输入

Mortise and tenon jointdimension parameter

input

刀具尺寸参数输入

Tool dimension parameter

input

机床补偿参数输入Machine

compensation parameter

input

刀路模块库Tool pathmodule library

加工代码文件输出Process code file

output

工艺文件输出

Process file

output

用户权限User rights

用户权限User rights

后处理补偿函数

Post-processing compensation

functions

刀具库Tool

library

工件数据库Artifact database

榫卯尺寸智能匹配Intelligent dimension

matching of mortise and tenon joint

工程师权限Engineer rights

图 4    榫卯自动化加工代码生成系统功能模块

Fig. 4    Functional modules of automatic programming system for numerical controlled mortise and tenon joint 

 

开始Begin

榫卯类型选择Mortise and tenon

type selection

榫卯零件尺寸输入Mortise and tenon dimension input

是否满足零件尺寸限定要求Whether meet the part

dimensional requirement

刀具选择Tool selection

刀具参数输入Tool parameter input

是否满足刀具尺寸限定要求Whether meet the tool

dimensional requirement

机床类型选择Machine tool type selection

机床工装误差参数输入Input of machine

tool error parameters

生成加工文件Process code files

generation

结束End

是Yes

零件尺寸报错Artifact part

size error

否No

否No

是Yes

工件数据库Artifact database

刀具库Tool library

后处理补偿函数Post-processing compensation

functions

生成工艺文件Process files

generation

刀具尺寸报错Tool part size error

1

2

3

4

刀路模块库Tool path module

library

刀路模块库Tool path

module library

刀路模块库Tool path

module library榫卯尺寸智能匹配Intelligent dimension matching of mortise and tenon

joint

① 榫卯管理子系统 Subsystem of mortise and tenon joint management;② 刀具管理子系统 Subsystem of tool management;③ 机床管理子系统

Subsystem of machine tool management;④ 代码输出模块 File output module

图 5    榫卯智能化加工代码生成系统流程图

Fig. 5    Flow chart of intelligent programming system for numerical controlled mortise and tenon joint 

第 3 期 汤    琳等:榫卯智能化加工代码生成系统的开发 139

Page 7: 榫卯智能化加工代码生成系统的开发 - bjfu.edu.cnj.bjfu.edu.cn/fileBJLYDXXB/journal/article/bjlydxxb/2019/...2018/04/14  · Email:106330176@qq.com 地址:210037 江苏省南京市玄武区龙蟠路159号南

数代码地址,同时通过核心模块中的榫卯尺寸智能

匹配子模块,快速判断输入的尺寸是否符合工艺要

求。如不符合,系统自动报错,并要求重新输入参

数。如符合,系统自动完成剩余尺寸参数的填写,并

对刀具路径模板中加工点坐标函数进行赋值。

② 进入刀具管理子系统,选择刀具类型,输入

刀具参数(每次下刀深度、主轴深度、进给速度等),

系统自动将参数自动存储到刀具数据库对应参数代

码地址,同时通过核心模块中的榫卯尺寸智能匹配

子模块,快速判断输入的尺寸是否符合工艺要求。

如不符合,系统报错;如符合,系统不报错,并再一次

对刀具路径模板中加工点坐标函数以及主轴转速、

进给速度进行赋值。

③ 进入机床管理子系统,选择机床类型,系统

根据机床类型,调取刀具路径代码模块中对应的预

处理格式,填写至已经调用的刀具路径模板首末尾;

然后输入工装误差参数,系统调用外部坐标值补偿

程序,将接收到的误差参数存储到外部程序相应代

码地址,补偿程序自动计算 X、Y、Z坐标补偿量,并

将补偿量传回主系统,完成对加工点坐标数值的补偿。

通过以上 3步,系统完成了榫卯加工代码的智

能化生成。

④进入代码输出模块,该模块可以以文本格式,

对系统生成的加工代码文件以及加工工艺文件,进

行输出和保存。

2.2 用户输入模块

用户输入功能模块由榫卯尺寸参数输入、刀具

尺寸参数输入和机床偏置参数输入 3个子功能模块

组成。3种参数的输入界面构成了系统界面的主要

部分。用户依次选择参数类型并输入参数值。参数

输入界面设计以图文结合为主,简洁直观,便于用户

理解,降低操作难度。图 6为榫卯自动化加工代码

生成系统的榫卯尺寸参数输入界面,为了提高交互

设计的可视性,添加了弹窗效果,对参数进行名词解释。

2.3 系统核心模块

核心模块包含工件数据库、刀具库、榫卯尺寸智

能匹配、刀路模块库和后处理补偿函数这 5部分。

工件数据库存储各类型榫卯参数代码,用于将用户

输入的榫卯尺寸参数值存储至对应参数代码地址;

刀具库中存储各类型刀具参数代码,用于将用户输

入的刀具参数存储至对应参数代码地址;榫卯尺寸

智能匹配中存储有尺寸匹配函数,用于榫卯尺寸参

数的计算和判断;刀路模块库存储有各组榫卯零件

刀具路径的参数化模板以及各类格式预处理格式;

后处理补偿是外接程序,存储有各类机床坐标值补

偿函数,用于接收机床偏置参数,自动计算和传回坐

标补偿值。核心模块只对工程师开放管理权限,避

免普通用户误操作引起系统出错。

2.4 代码输出模块

代码输出模块包括加工代码文件输出功能和工

艺文件输出两大功能。图 7为数据输出功能模块的

界面,用户选定目标零件,根据需要选择输出文件的

类型。

3   系统验证

3.1 系统运行验证

分别点击并进入榫卯尺寸输入界面、刀具参数

输入界面和机床偏置参数输入界面,填写参数值,系

统运行流畅。图 8例示了部分参数设置界面,即榫

卯尺寸输入界面、刀具参数输入界面、机床偏置参数

输入界面和生成的 NC代码结果部分截图。

3.2 零件加工效果验证

3.2.1    验证对象

选用组成改良型粽角榫的 3根材料中的大边作

为加工对象,验证系统自动生成的加工代码的实际

加工效果。图 9为改良型粽角榫大边的模型和尺寸图。

3.2.2    零件加工效果检验

搭载苏州铨木智能有限公司研发的 FAM1414S

 

图 6    榫卯参数输入功能界面的弹窗效果

Fig. 6    Popups on interface of parameters input functional modules 

 

图 7    系统文件输出功能模块界面

Fig. 7    System interface of file output functional modules 

 140 北    京    林    业    大    学    学    报 第 41 卷    

Page 8: 榫卯智能化加工代码生成系统的开发 - bjfu.edu.cnj.bjfu.edu.cn/fileBJLYDXXB/journal/article/bjlydxxb/2019/...2018/04/14  · Email:106330176@qq.com 地址:210037 江苏省南京市玄武区龙蟠路159号南

端面加工单元,进行实际加工验证。图 10为一次装

夹后加工出的改良型粽角榫大边试件。

3.2.3    验证结果与分析

实际加工大边试件各尺寸与模型尺寸对比如表 3所示。由表 3可知:实际加工值和目标值的误差值均

控制在 0.1 mm以内,达到了家具生产的加工要求。

表 3    实际加工大边试件各尺寸与模型尺寸对比

Tab. 3    Size contrasts of actual value of the long side and model value mm

尺寸编号 Size No. a b L D E F G H

模型尺寸值 Model size value 8.00 8.10 22.20 13.00 8.10 6.00 22.00 13.00

实际加工尺寸值 Actual size value 8.04 8.03 22.16 13.09 8.04 6.01 22.05 13.08

误差 Error 0.04 − 0.07 − 0.04 0.09 − 0.06 0.01 0.05 0.08

注:误差为实际加工尺寸值减去模型尺寸值。Note: actual size value minus model size value is error.

 

a 榫卯尺寸输入界面Interface of mortise and tenon joint dimensions input

b 刀具参数输入界面

Interface of cutter parameters input

c 机床偏置参数输入界面

Interface of machine tool offset parameters inputd 生成的NC代码结果部分截图

Portion of NC codes

图 8    部分参数输入界面和 NC代码

Fig. 8    Part NC codes and parameter input interfaces 

 

F

E

D

L

H

G

ab

40

40

单位:mmUnit:mm

a为上边距,b为榫头厚度,L为榫头宽度,D为榫头长度,E为榫眼

宽度,F为边距,G为榫眼高度,H为榫眼深度。a is top margin,b isjoint thickness, L is joint width, D is joint length,E is mortise width, Fis margin, G is mortise height, and H is mortise depth.

图 9    改良型粽角榫大边模型和尺寸图

Fig. 9    Model and dimensional drawing of improved three-way miteredjoint’s long edge

 

 

图 10    实际加工的改良型粽角榫大边试件

Fig. 10    Actual machining specimen of improved three-way miteredjoint’s long edge

 

第 3 期 汤    琳等:榫卯智能化加工代码生成系统的开发 141

Page 9: 榫卯智能化加工代码生成系统的开发 - bjfu.edu.cnj.bjfu.edu.cn/fileBJLYDXXB/journal/article/bjlydxxb/2019/...2018/04/14  · Email:106330176@qq.com 地址:210037 江苏省南京市玄武区龙蟠路159号南

因此,榫卯自动化加工代码生成系统的准确性进一

步得到了验证。

4   结  论

(1)利用成组技术,将榫卯进行分组并提取各组

榫卯尺寸参数,建立榫卯尺寸参数与材料和工艺经

验的函数关系,完成了榫卯尺寸参数的智能匹配;根

据模板技术,建立标准化刀具路径模块库,实现了以

参数驱动刀具路径;基于偏置补偿后处理的原理,实

现了以外部程序模块调用的形式对标准坐标值进行

补偿的功能。为开发智能编程提供了技术支持。

(2)开发了一款榫卯智能化加工代码生成系统,

系统具备榫卯尺寸、刀具、机床偏置等基本参数,匹

配并计算参数结果,输出 NC代码等功能。实现了榫

卯加工代码的智能化编制。使数控编程摆脱了对

CAM软件的依赖,从原理上解决了数控编程重复性

劳动率高的问题,并降低了榫卯数控编程的难度,也

为进一步研究数字化改良榫卯的性能提供了条件。

(3)通过一种改良型粽角榫零件的实际加工,验

证了该系统的可行性和生成代码的准确性。

参 考 文 献薛坤. 传统家具榫卯结构的性能与设计进化研究 [D]. 南京: 南

京林业大学, 2013: 44−45.

Xue  K.  Analysis  on  the  structural  performance  of  traditional

Chinese  furniture  and  the  design  improvement  of  mortise  and

tenon  joint[D].  Nanjing:  Nanjing  Forestry  University,  2013:

44−45.

[  1  ]

赵凯, 王晓兵, 李耀华. 基于 PowerMILL平台智能化数控自动

编程技术研究 [J].  CAD/CAM与制造业信息化 ,  2014(9):

35−38.

Zhao  K,  Wang  X  B,  Li  Y  H.  Study  on  intelligent  automatic

programming  technology  based  on  the  PowerMILL[J].  Digital

Manufacturing Industry, 2014(9): 35−38.

[  2  ]

张端, 王双永. 木构件模块化加工参数化设计[J]. 木材加工机

械, 2015, 26(5):27−29.

Zhang R, Wang S Y. Parametric design on modular machining of

wood components[J]. Wood Processing Machinery, 2015, 26(5):

27−29.

[  3  ]

项前. 可重构的纺织品智能工艺设计与虚拟加工方法及应用研

究 [D]. 上海: 东华大学, 2011: 16−17.

Xiang  Q.  Research  and  application  on  method  of  reconfigurable

textile  intelligent  process  planning  and  virtual  machining[D].

Shanghai: Donghua University, 2011: 16−17.

[  4  ]

严婕, 林彬彬, 朱礼智, 等. 数控加工机床与加工中心在家具制

造业中的应用[J]. 林业机械与木工设备, 2014, 24(6):56−57.

Yan  J,  Lin  B  B,  Zhu  L  Z,  et  al.  Application  of  CNC machining

lathes  and  machining  centers  in  the  furniture  manufacturing

industry[J].  Forestry  Machinery  &  Woodworking  Equipment,

2014, 24(6): 56−57.

[  5  ]

马岩. 我国数控木工机械的发展现状及自动化技术的研发方向

[J]. 林业机械与木工设备, 2012, 40(1):4−9.

[  6  ]

Ma  Y.  Development  status  of  China ’s  CNC  woodworking

machinery  and  the  development  direction  of  automation

technology[J].  Forestry Machinery & Woodworking Equipment,

2012, 40(1): 4−9.

胡文刚, 白珏, 关惠元. 一种速生材榫接合节点增强方法[J]. 北

京林业大学学报, 2017, 39(4):101−107.

Hu  W  G,  Bai  J,  Guan  H  Y.  Investigation  on  a  method  of

increasing  mortise  and  tenon  joint  strength  of  a  fast  growing

wood[J].  Journal  of  Beijing  Forestry  University,  2017,  39(4):

101−107.

[  7  ]

张远群, 王文宁. 小径材家具榫卯结构的强度研究[J]. 林产工

业, 2013, 43(4):24−27.

Zhang  Y  Q,  Wang  W  N.  Strength  investigation  of  mortise  and

tenon  joint  in  small-diameter  logs  furniture[J].  China  Forest

Products Industry, 2013, 43(4): 24−27.

[  8  ]

Efe H, Zhang J L, Erdil Y Z, et al. Moment capacity of traditional

and alternative T-type end to side grain furniture joints[J]. Forest

Products Journal, 2005, 55(5): 45−52.

[  9  ]

钟世禄, 关惠元. 椭圆榫过盈配合量与木材密度的关系[J]. 林

业科技开发, 2007(2):57−59.

Zhong  S  L,  Guan  H  Y.  Relationship  between  optmial  value  of

interference  fit  and  wood  density  in  oval  tenon  joint[J].  Journal

of Forestry Engineering, 2007(2): 57−59.

[10]

蒋占四. 基于 Modelica模型的参数优化及推理求解研究 [D].

武汉: 华中科技大学, 2008.

Jiang  Z  S.  Parameter  optimization  and  inference  solving  for

models  based  on  Modelica[D].  Wuhan:  Huazhong  University  of

Science and Technology, 2008.

[11]

曹卫东 , 阎春平 , 郭奉民 . 基于成组技术和标准模板的滚齿

CNC自 动 编 程 [J]. 计 算 机 集 成 制 造 系 统 ,  2015,  21(1):

195−203.

Cao  W  D,  Yan  C  P,  Guo  F  M.  CNC  gear  bobbing  automatic

programming  based  on  group  technology  and  standard

template[J].  Computer  Integrated  Manufacturing Systems,  2015,

21(1): 195−203.

[12]

Sakamoto S, Inasaki I. Analysis of generating motion for five-axis

machining  centers[J].  Transactions  of  the  Japan  Society  of

Mechanical Engineers Series C, 1993, 59: 1553−1559.

[13]

Cheng H Y, She C H. Studies on the combination of the forward

and  reverse  postprocessor  for  multi-axis  machine  tools[C]//

Proceeding  of  the  institution  of  mechanical  engineers,  part  B.

England: IME, 2002: 77.

[14]

郑飂默. 基于通用运动模型的五轴机床后置处理[J]. 计算机集

成制造系统, 2010, 16(5):1006−1011.

Zheng L M. Postprocessor based on generalized kinematics model

of  five-axis  machine  tools[J].  Computer  Integrated  Manufac-

turing Systems, 2010, 16(5): 1006−1011.

[15]

李庄. 五轴机床运动学通用建模理论研究及应用 [D]. 成都: 西

南交通大学, 2013.

Li  Z.  Kinematic  generic  modeling  theory  for  five-axis  machine

tool[D]. Chengdu: Southwest Jiaotong University, 2013.

[16]

(责任编辑    吴 娟    责任编委    赵广杰)

 142 北    京    林    业    大    学    学    报 第 41 卷