Показать сообщение отдельно
Старый 19.09.2008, 00:11   #23
Satex
VIP
 
Аватар для Satex
 
Регистрация: 09.12.2007
Сообщений: 101
Сказал(а) спасибо: 21
Поблагодарили 876 раз(а) в 64 сообщениях
Вес репутации: 385
Satex - просто великолепная личностьSatex - просто великолепная личностьSatex - просто великолепная личностьSatex - просто великолепная личностьSatex - просто великолепная личностьSatex - просто великолепная личностьSatex - просто великолепная личность
По умолчанию

Цитата:
Сообщение от npp007 Посмотреть сообщение
хочу макросы написать, не знаю как, есть какая-нибудь литература?
Сам ищу. Если вдруг нароешь чего - поделись пожалуйста.
В штатном хелпе Xilog всё очень скудно описано:

Help file 6.3 Macros



6.3 Macros

A macro is a special type of subprogram, the name of which is a true and real language instruction. The same instructions available in Xilog Plus are macros: for example, the boring B instruction which, even though it produces complex functions, is viewed by the program as a simple command. The macros are collected into groups in the instructions toolbar; both the group macros and individual macros are represented graphically by bitmap images.

► To write a macro it is possible to use the macro editor which can be selected from the OpTIONS/MACRO EDITORmenu. The macro editor can be used as text editor, but some functions that are available in the text editor are not active (for example, displaying suction cup editor).

► After having selected macro editor, proceed with creating a new parametric type program. Once the program is created, when it is time to save, Xilog Plus will ask for the program to be associated with a bitmap image (BMP extension), that must measure 120 x 90 pixel. The bitmap, which can be produced with any type of drawing program, must graphically represent the functions performed by the macro. The macro will be saved with a PGM extension (for example, HINGE.PGM).

► To properly integrate the macro in the programming environment thereby making it available in the instructions toolbar, it is necessary to define a macro group to which it must belong. For example, the Xilog Plusinstructions XB, XBO and XBR are macros that belong to the boring group, which is represented in the instructions toolbar with a bitmap image. To define a new macro group and activate a new macro as its element, the following operations must be performed:

1.create a new folder inside folder FXC (that is located inside folder SCM GROUP/XILOG PLUS), and the name must not contain extensions (for example, “DOOR”);
2.produce a bitmap image that measures 32 x 32 pixel, which graphically represent the group and has the same name as the folder (for example, “DOOR.BMP”) and leave it inside the folder FXC;
3.copy the PGM file that represents the macro previous created (like, for example, “HINGE.PGM”) into the relative folder of the group to which it belongs (for example, the folder DOOR created inside the folder FXC).
4.restart Xilog Plus editor.

Macro groups created in this manner can include up to 100 macros; the maximum number of groups is 40.

WARNING



The contents of the folder …\FXC\PRIVATE must not be changed!


The programming of a macro follows the same rules that govern a normal parametric program, including the possibility or recalling subprograms or other macros; however, it is necessary to observe some special directives described below:

Header

The fields DX, DY and DZ must be set to zero, while field /, normally indicating the tooling, must have the following format:

"<shortcut>,<parameters>,<description index>,<description>"

·<shortcut> is a pair of characters used for quickly selecting the Fixed Cycle from the general instruction list. The first character must be a number between 5 and 9, and the second character must be a letter of the alphabet.
·<parameters> is the list of parameters for the macro.
·<description index> must be set to zero.
·<description> is the string that describes the macro.

Examples:

H DX0 DY0 DZ0 *MM /"9p,XYZDT,0,DOOR TYPE 08"

Macro parameters

Parameters are data that the user must pass to the macro in order for it to perform the function for which it was written.
The parameters are to be selected among those contained in the following list. Some have a set meaning, which must be maintained, others are free, but may have a recommended meaning.

X
Free (coordinate X)
Y
Free (coordinate Y)
Z
Free (coordinate Z)
A
Angle of rotation
H
Free (coordinate H)
E
Free (hood position)
I
Free (coordinate I)
J
Free (coordinate J)
V
Approach speed
S
Spindle rotation speed
T
Tools list
F
Machining face
C
Tool correction
K
Incremental
P
Panel reference
Q
Free (quadrant)
R
Free (repetitions)
x
Free (final position X, step in X, ...)
y
Free (final position Y, step in Y, ...)
a
Free
B
Free (angle, ...)
r
Free (radius, ...)
D
Free (diameter, out machining range, ...)
s
Free (step, ...)
l
Free (length, ...)
G
Free (direction of circular milling, direction of multiple tool, ...)
L
Free (length, ...)
N
Subprogram name


The parameters may be indicated in any order. If the value for a parameter is missing in macro call assigns the corresponding parameter the value foreseen by the macro.

Using the parameters

From within the Fixed Cycle, it is possible to read the value of the parameters using the reserved variables pX, pY, pZ, pA, pH, pE, pI, pJ, pV, pS, pT, pF, pC pK, pP, pQ, pR, px, py, pa, pB, pr, pD, ps, pl, pG, pL, pN, called p variables.
All p variables (except pT) may also be used in expressions, as long as their status has been
defined, otherwise the result is not evaluated. To know the status of a p variable, you can use the NDEF operator, which returns True (1) if the variable has not been defined, and False (0) otherwise.

Examples:

H DX0 DY0 DZ0 *MM /"9p,XYZDT,0,DOOR TYPE 08"
L FOOT=100 ;the foot to use if the value of parameter X has not been specified
IF NDEF pX GOTO TESTpY
L FOOT=pX ;foot passed as value of parameter X
.TESTpY
...

Special Variables

In the macro there are some special read-only variables that can be used also in the expressions:

X
Current Coordinate X
Y
Current Coordinate Y
Z
Current Coordinate Z
C
Current radius correctio
Cp
Programmed radius correction
F
Current face


Examples:

L oldF = F
L curC = C
L QY = Y+32
B X=X Y=QY Z=Z

Special instructions

Some special instructions are available:

PRINT “message”
displays the message
C=<variable>
assigns the radius correction type
F=<variable>
assigns the face


Examples:

F=oldF
C=curC

IF NOT NDEF pX GOTO Beginning
PRINT “value of parameter X missing”
GOTO End
.Beginning
...
.End

Tool management and ^ operator

The special variable T contains the current tools. Using the ^ operator, is possible to:

1.cancel the tools in T
2.add a tool to T
3.copy pT and T in normal variables that acquire the significance of tool variables;
4.copy pT and the tool variables to T
5.read the number of tools in pT or in the tool variables
6.read one at the time all the tools in pT or in the tool variables

Canceling current tools

To cancel the current tools, add the value zero to T.

Examples:

L T = T+0

Adding a current tool

To add a current tool, add to T the number of the tool.

Examples:

L T = T+6
L T = T+101

Copying tools

To copy tools, follow the ^ operator with -2.

Examples:

L CopyOfT = T^-2 ;copies the current tools

L CopyOfpT = pT^-2 ;copies pT

L T = T + 0
L T = CopyOfT^-2 ;assigns a tool variable to T

L T = T + 0
L T = CopyOfpT^-2

L T = T + 0
L T = pT^-2 ;assigns pT to T

Reading the number of the tools

To read the number of the tools, follow the ^ operator with -1.

Examples:

L NumTool = pT^-1
L NumT = CopyOfT^-1

Reading individual tools

To read the individual tools, follow the ^ operator with the position of the required tool (beginning with 0).

Examples:

L FirstTool = pT^0
L SecTool = CopyOfT^1
L ToolPos = 3
L NextTool = pT^ToolPos

[свернуть]
Satex вне форума   Ответить с цитированием Вверх