Gerber 文件格式(一):RS-274X 语法

从《Gerber文件格式简介》中我们已经知道,Gerber文件的编码可以是ASCII、EBCDIC、EIA、ISO 码等。但RS-274X肯定是ASCII码的,并且是7位ASCII码。

从某种意义上来说,RS-274X文件(一般后缀为GBX,GBR等)是一种脚本文件,它用于指示光绘机进行各种绘制或运动形为。

对于不同的应用,对RS-274X文件可能需要被转换成PDF,DXF或BMP等,其中转换成BMP过程,我们称之为栅格化,事实上,将RS-274X在屏幕上显示就是栅格化的过程。

 

一、字符编码

ASCII 7bit

二、数据块(Data Blocks)

RS-274X 文件是由数据块组成的,每个数据块都是以(*) 结尾,每个数据块都包括了一个或多个参数,如示例

X0Y0D02*
X10000Y0DO1*

为了增强可读性,建议相关的数据块在一行(因为一个数据块可以在多行),

三、数据类型

数据类型主要包括以下几种类型,坐标数据(Coordinate Data),功能指令(Function Codes) ,参数(Parameters)

四、坐标数据

坐标数据主要是定义在平面的中点数据,在RS274D的术语中称为地址。

坐标数据可能是:

1)X和Y坐标定义的点,

2)相对于X,Y方向的便移量数据,称为I,J数据

FS(Format Specification) 格式定义指示了数字如何被解释的。

坐标系采用右手坐标系。

坐标是模态(modal) 的,如果一个X被忽略,则X将保留上一次的X坐标值,如果在当前层的第一个X被忽略,因为没有上一次的X的坐标值,那么X坐标将被视为零。类似地,Y坐标也是这样处理的。

偏移量不是模态上的,如果I或J被忽略,则缺省值为零。

注意:

GERBER的读者有时候会错误地处理缺省值零。为了清晰和鲁棒性,推荐总是显式地指定第一个坐标(即便就是零,也显式指定),这样就不用考虑缺省的零。

示例:

1:  X100Y200* 点 (+100, +200)
2:  Y-300* 点 (+100, -300)
3:  I200J100* 平移 (+200, +100)
4:  X300Y200I150J50* 点(+300, +200) 且 平移(+150, +50)
5:  X+100I-50* 点 (+100, +200) 且 平移 (-50, 0)

 

五、功能指令(Function Codes):

功能指令描述的是如何解析相关联的坐标数据。如,画一条线或画一个圆。(通常,但不是所有,这些代码是延续已经过时的RS-274D的格式,它们被称为字(words)或代码(codes))。

G74*

每个指令都会影响到其后的数据块,直到遇到另外一个相同类型的代码或生成新层时结束。我们称这种持续性的活动为模态(modal)。例如G02指示的是顺时针圆弧插补(CCI, clockwise circular interpolation)。在遇到另外一个插补指令或生成新层之前,该指令后的所有坐标数据都被解释为顺时针圆弧插补。指令的细节描述后序再讨论。

六、参数 (Parameters)

参数定义了整个图像或单层的各种特征。它们被用于解释其他的数据类型,(通常,这些参数被称为Mass 参数)。控制整个图像的参数通常会放在文件的开始处。产生新层的参数被放置在文件恰当的位置。参数由两个字符加一个或多个紧随其后的可选修改符组成。参数的限定符号为“%”.每个包含在数据块内的参数必须以“*”结束。并且参数限定符必须立即跟在块结束符后面,不允许插入空格。

例如:

%FSLAX23Y23*%

参数必须是在成对的参数限定符内,限定符内可以放一个或多个参数,两个限定符之间最大的字符数为4096个。

例如:

%SFA1.0B1.0*ASAXBY*%

为了提高可读性,两个参数间允许换行,如:

%SFA1.0B1.0*

ASAXBY*%

当然,为了简化和可读性,推荐每行是只设置一个参数。与参数联合的所有数值都使用显式的小数点,如果不使用小数点,数值应当认为是整数。

参数的语法为:

%参数指令<必选修饰符>[可选修饰符]% 

语法说明
参数指令 (parameter code)两个字符的指令,如AD,AM,FS等
必选修饰符(required modifiers)必须是完整的定义
可选修饰符(optional modifiers)依赖必选修饰符的定义

 

 

转载于:https://www.cnblogs.com/begincsdn/archive/2012/07/07/2580279.html

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
and debugged. Its widespread availability allows PCB professionals to exchange image drill and route securely and efficiently. The RS-274X format is simple, compact and unequivocal. It is easy to interpret. It describes an image with very high precision. It is complete: one single file describes an image. It is portable and easy to debug by its use of printable 7-bit ASCII characters. A well-constructed RS-274X file precisely defines the PCB image data and the functions of the different image elements. Unfortunately, poorly constructed or simply erroneous RS-274X files also circulate, sometimes leading to unjustified criticism of the format itself. Errors may be due to a misunderstanding of the format. With more than 25 years experience in CAM software we at Ucamco know which areas are most often misunderstood. This revision of the RS-274X specification explains these areas more clearly. Other files are not invalid but poorly constructed. Especially troublesome are painted or stroked pads and copper planes. Poorly constructed files take longer to process, require more manual work and increase the risk of errors. This revision of the RS-274X specification recommends constructions to make RS-274X files safer and more efficient, and hence fabrication more reliable, faster and cheaper. A few words must be said about RS-274-D or Standard Gerber. This format was developed to drive NC machine tools and was used for Gerber vector plotters in the 1960s and 1970s. It is not an image description format. It is amazing that it is still used. It is like using teletype paper tape to transfer text documents. We call on industry experts and professional organizations to discourage the use of the obsolete RS-274-D format. Although other data transfer formats have come into the market, they have not displaced RS-274X. The reason is simple. More than 90% of the problems in data transfer are due not to limitations in the RS-274X format but to poor practices and, worse, the use of RS-274

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值