The following is an addendum to the MiniPascal manual for MiniCAD 7.
(addendum version 1)

Late Procedure Additions / Changes
AppleScript Support and MiniPascal
Encryption
Color Information
Miscellany

PROCEDURE PrimaryUnits(unitStyle:INTEGER;displayPrec,dimPrec:LONGINT;decFormat,
angPrec:INTEGER;showUnitMark,displayFrac:BOOLEAN);

Procedure PrimaryUnits sets the primary unit parameters for the active document. The primary units setting is used by the document for all measurement entry and display values in the document.

Parameter unitStyle sets the active unit style for the document. Parameters displayPrec and dimPrec set the display precision and dimension precision for entered and displayed values. Parameters decFormat and angPrec set the decimal format anf angular value display, and parameters showUnitMark and displayFrac control the display of the unit mark and whether values will be displayed as fractions or decimals.

Example

PrimaryUnits(2,100,1000,4,2,TRUE,FALSE);

Sets the primary units to millimeters, with a display precision of hundredths, dimension precision of thousandths,a decimal format of 0.XX0, and an angular precision of degrees/minutes. Also, the unit mark will be displayed, and fractional display is disabled(display as decimal).


PROCEDURE SecondaryUnits(unitStyle:INTEGER;dimPrec:LONGINT;decFormat:INTEGER;
showUnitMark,displayFrac:BOOLEAN);

Procedure SecondaryUnits sets the secondary unit parameters for the active document. The secondary units setting is used primarily for display of alternate dimensions in when a dual dimension standard is active.

Parameter unitStyle sets the active unit style for secondary values. Parameter dimPrec sets the dimension precision for secondary values. Parameter decFormat sets the decimal format, and parameters showUnitMark and displayFrac control the display of the unit mark and whether secondary values will be displayed as fractions or decimals.

Example

SecondaryUnits(6,64,2,TRUE,TRUE);

Sets the secondary units to feet/inches with a dimension precision of 1/64, unit mark displayed, and fractional display of units values enabled.


PROCEDURE SetPrimaryDim(showValue,boxText:BOOLEAN;leader,trailer:STRING;
dimPrecision:LONGINT);

Procedure SetPrimaryDim sets the primary dimension text display characteristics for a newly created dimension. Parameter showValue controls the visibility of the dimension text, and parameter boxText controls whether the text will be boxed. Parameters leader and trailer specify leader and trailer text for the dimension, and parameter dimPrecision controls the display precision of the dimension text.

Example

SetPrimaryDim(FALSE,FALSE,'>','(nom)',1000);

sets the display parameters of the primary dimension value of a dual dimension.


PROCEDURE SetSecondaryDim(showValue,boxText:BOOLEAN;leader,trailer:STRING;
dimPrecision:LONGINT);

Procedure SetSecondaryDim sets the secondary dimension text display characteristics for a dual dimension.

Parameter showValue controls the visibility of the dimension text, and parameter boxText controls whether the text will be boxed. Parameters leader and trailer specify leader and trailer text for the dimension, and parameter dimPrecision controls the display precision of the dimension text.

Example

SetSecondaryDim(TRUE,TRUE,'','',8);

sets the display parameters of the secondary dimension value of a dual dimension.


Function AddSolid(obj1,obj2:HANDLE;VAR newSolid:HANDLE):INTEGER;

Function AddSolid creates an additive solid from two component objects.

Parameters obj1 and obj2 are handles to the component objects of the addition process. The function returns a handle to the resultant solid object through parameter newSolid, as well as returning a flag indicating the success of the operation.

Example

resultCode:=AddSolid(hd1,hd2,newObject);

creates a new solid from the existing objects specified.


Function SubtractSolid (obj1,obj2:HANDLE;VAR newSolid:HANDLE):INTEGER;

Function SubtractSolid creates an subtractive solid from two component objects.

Parameters obj1 and obj2 are handles to the component objects of the subtraction process. The function returns a handle to the resultant solid object through parameter newSolid, as well as returning a flag indicating the success of the operation.

Example

resultCode:=SubtractSolid(hd1,hd2,newObject);

creates a new solid from the existing objects specified.


Function IntersectSolid (obj1,obj2:HANDLE;VAR newSolid:HANDLE):INTEGER;

Function IntersectSolid creates an intersecting solid from two component objects.

Parameters obj1 and obj2 are handles to the component objects of the intersection process. The function returns a handle to the resultant solid object through parameter newSolid, as well as returning a flag indicating the success of the operation.

Example

resultCode:=IntersectSolid(hd1,hd2,newObject);

creates a new solid from the existing objects specified.


DoScript

MiniPascal supports the AppleScript "DoScript" command. Users may send MiniPascal procedure calls via this mechanism for execution in MiniCad. The syntax for the DoScript command is:

DoScript "<MiniPascal procedure call>"

The procedure call string should be a known MiniPascal procedure or procedures. A simple example would be using the DoMenuText call to perform a print. The AppleScript command would appear as follows:
tell application "MiniCad 7.0.0"																										
DoScript "DoMenuText('Print...');"
end tell


Drawing and other commands can also be used, as shown:
tell application "MiniCad 7.0.0"																									
DoScript "Rect(0,0,2,2);Oval(0,0,2,2);"
end tell
The DoScript command will also accept a path to an external macro file. You must specify the full path to the macro file to be executed. This can be done by passing the file name as an AppleScript alias, as shown:
tell application "MiniCad 7.0.0b9i PPC"
activate
	DoScript (fileName as alias)
end tell


A complete Applescript which will execute drag/dropped MiniPascal macro files might look like this:
on open (doclist)
	repeat with f in doclist
		ProcessFiles(f)
	end repeat
end open

on ProcessFiles(fileName)
	set fName to getFileName(fileName as string)
	set theInfo to (info for fileName)
	set theType to file type of theInfo
	set theCreator to file creator of theInfo
	
	if ((theType = "#TXT") or (theType = "TEXT")) then
		--tell application "MiniCad"
		tell application "MiniCad 7.0.0"
			activate
			DoScript (fileName as alias)
		end tell
	else
		display dialog ("Invalid file type.") buttons {"OK"} default button 1
	end if
end ProcessFiles

on getFileName(thePath)
	copy the text item delimiters to oldDelims
	set the text item delimiters to {":"}
	copy the last text item of (thePath as string) to theFile
	set the text item delimiters to oldDelims
	return theFile
end getFileName

Translate

MiniCAD also contains an additional AppleScript command, translate, which allows you to translate files from older MiniCad formats into the current MiniCAD file format. When used in conjunction with AppleScript, you can automate the process of translating large numbers of files from older versions of MiniCAD.

The translate command takes as its parameter an Applescript alias of the file to be translated. The translate statement would appear as follows:

tell application "MiniCad 7.0.0"
	with timeout of 1200 seconds
		translate (theFile as alias)
	end timeout
end tell
For more details on how to write scripts incorporating MiniCAD's Applescript support, you should consult Apple's AppleScript reference for more details on the AppleScript language.


Macintosh

To encrypt MiniPascal commands residing in palettes, the following sequence should be performed:

  1. Engage the Caps Lock key.
  2. Simultaneously depress the Shift, Control, Option, and Command keys, and choose a command via the Resource palette. Select Edit from the Resource palette.
  3. You will be prompted to confirm that you wish to lock the command. After locking the command, you will be unable to open it in the command editor.

To encrypt MiniPascal commands in external macro files, the following sequence should be performed:

  1. Simultaneously depress the Shift, Control,Option, and Command keys, and choose a command file via the Resource palette. Select Run from the Resource palette.
  2. You will be prompted to confirm that you wish to encrypt the command. After encrypting the command, you will be unable to edit the file.
Windows

To encrypt MiniPascal commands residing in palettes, the following sequence should be performed:

  1. Engage the Caps Lock key.
  2. Simultaneously depress the Shift, Control, and Alt keys, and choose a command via the Resource palette. Select Edit from the Resource palette.
  3. You will be prompted to confirm that you wish to lock the command. After locking the command, you will be unable to open it in the command editor.

To encrypt MiniPascal commands in external macro files, the following sequence should be performed:

  1. Simultaneously depress the Shift, Control, and Alt keys, and choose a command file via the Resource palette. Select Run from the Resource palette.
  2. You will be prompted to confirm that you wish to encrypt the command. After encrypting the command, you will be unable to edit the file.

WARNING
Locking commands and macro files is NOT reversible; make sure you have copies of your commands.

MiniCad 7.0.0 Color Palette with Indexes

You can also refer to a table of RGB values for MiniPascal.