Scripts - PC-DMIS EMS

waisttherapeuticΛογισμικό & κατασκευή λογ/κού

4 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

134 εμφανίσεις

Creating Scripted Controls

for

Pc
-
DMIS NC


Overview

Scripted controls offer the ability to customize the post out of Pc
-
Dmis NC to any text format.
Completely new controls may be supported by creating text scripts.

Pc
-
DMIS NC Versions

Scripting has been

supported as early as V4.3. There have been many extensions and updated since that
time. This document is based on Pc
-
Dmis V2010_Cnc.

Types of Controls that may be scripted

Supported Interface types

The controllers shown are given as examples. Other contr
ollers with similar types of interfaces may
also be supported with creative scripting.


1.

File Drop


a)

Fanuc


b)

Mazak


c)

Siemens


2.

Serial


a)

Fanuc


b)

Haas


c)

Mazak


d)



3.

Fanuc FOCAS


4.

Heidenhain LSV2 (?)

Scripts

Scripting Language (TCL)

Tool Control Language (TCL) is the scripting pro
gramming language used. It is open sourced and free
implementations are available for Windows and other platforms. A TCL interpreter is embedded in
CncServer. Everything in TCL is a string. Web based documentation and tutorials should be reviewed
to avoid

common pitfalls. For example, the 'if' construct below is correct:


if { $var > 3 } { ....

But the following is incorrect:


if{ $var > 3 } { ...

Note the lack of space between the 'if' and '{' . TCL will not recognize the start of an if statement in this
case.

Script Locations

TCL scripts are located in the NcControllers
\
Scripted directory. This directory has been moving around
of late to integrate with newer versions of Windows folder permissions.


1.

Pc
-
DMIS NC Version 2009


2010 MR2


a)

WinXP

C:
\
Documents

and settings
\
All Users
\
Application Data
\
NcControllers
\
Scripted


b)

Vista or Win 7

C:
\
ProgramData
\
WAI
\
NcControllers
\
Scripted


2.

Pc
-
DMIS NC Version 2010


a)

WinXP


b)

Vista or Win 7


3.

Pc
-
DMIS NC Version 2010 Mr3


a)

WinXP


b)

Vista or Win 7

Script Naming

A TCL script is associated with a machine definition in CncServer by its name. The script name is the
machine name prefixed by 'SCRIPTED_' with extension '.TCL'.

Example: A machine is created for scripting named MACHINE1. The associated scripted file is
S
CRIPTED_MACHINE1.TCL.

The script associated with the machine name must exist or there will be many errors.

Script Templates

Several templates exist in the Scripted folder. They are based on real machines and should be used as a
starting point for buildi
ng a new script.


1.

SCRIPTED_FANUCSERIAL.TCL

Supports a serial link Fanuc controller. This would be a good starting point for any Fanuc
-
Like
controller.


2.

SCRIPTED_FANUCFOCAS.TCL

Supports a Focas link to a Fanuc controller.


3.

SCRIPTED_GNL

Supports a Giddings & L
ewis control


4.

SCRIPTED_MDSI

Supports an MDSI controller

Other have been build as custom scripts for various implementations. Contact Technical Support with
your controller to see if a possible match exists.


Using A Scripted Controller

Let's assume that yo
u already have a valid TCL script and you want to apply it to a machine
MyScriptedMachine.


1.

Create a generic machine of the same name and Id number

In the Machine Definition selection of CncServer, add a new machine of the proper name
MyScriptedMachine. Use

a Generic controller and don't bother setting other parameters unless
you need to work around a temporary conflict (like the same interface). This is just to create a
machine definition slot of the right name and number in CncServer. Save it all the way o
ut to
the CncServer top view.


2.

Create the Scripted Machine

Copy the template TCL file to the Scripted folder and rename to
SCRIPTED_MYSCRIPTEDMACHINE.TCL.


3.

Activate the scripted machine in CncServer

In the Machine Definition dialog, Modify the machine and ch
ange the controller type to
Scripted. Save it all the way out. If you get TCL errors at this point, use the error messages to
diagnose why they occur and edit the TCL script to eliminate them.


4.

Modify the Scripted machine to have the proper parameters

Re
-
En
ter the Machine Definition dialog and Modify the machine.


a)

Set the units on the program page


b)

Next set all the values on the Measure Page


c)

Set the Physical page


d)

Set the Interface page


e)

Save it all the way out

Fix TCL errors if any in the scripted file (SCRIPT
ED_MYSCRIPTEDMACHINE.TCL)


5.

Open PC
-
DMIS and post out a test file

The program should exercise all the axes of the machine.

TCL Error should be fixed.

Review the output of the Post. Apply changes as required and re
-
Post until you are satisfied
with the result
.


Scripting Details

Scripted controllers export the interface methods that are normally hidden inside ctrlrdefaults.dll. The
interfaces support several functions inside PC
-
DMIS and CncServer.


1.

Population of the default values in the Machine Definition page
s


2.

Generation of machine specific code


3.

Creation of Wilcox Macro Sets


a)

Wilcox macro sets also use TCL scripts for generation


4.

Other internal functions

The Scripted control exports the methods of 1 and 2 above by calling external TCL scripts. If you don't
care

about making a general machine that a user could customize with only the settings in Machine
Definitions, the generational part of the scripted control can create a fixed post out.

Scripted Header

ScriptedHeader.TCL is a generic header file that should ap
ply to any Scripted controller. Do not put
machine specific code in this header. All machine specific code should go in Scripted_<Machine
Name>.TCL.

Scripted Machine procs

A brief description of each TCL procedure or proc follows. Scripted_FanucFocas.tcl w
as used as a
model.