Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

VBScript Function List?


Recommended Posts

40 minutes ago, Jobnt said:

Is there still a list of functions, methods etc for Mastercam VBS? Can't find anything in the help or in the forums. 

 

TYIA. 

here you go!

VBScript.htm

'A long time ago in a galaxy far far away...
'---------------------------------'

'#Region Geometry Variable Declaration
Dim Line1
Dim Line2
Dim Line3
Dim Line4

'---------------------------------'

'#Region Geometry Variable Initialization
Set Line1 = New McLn
Set Line2 = New McLn
Set Line3 = New McLn
Set Line4 = New McLn

'---------------------------------'

'#Region Geometry Variable Parameter settings
With Line1
.X1 = 0.
.Y1 = 0.
.Z1 = 0.

.X2 = 1.
.Y2 = 0.
.Z2 = 0.
End With
With Line2
.X1 = 1.
.Y1 = 0.
.Z1 = 0.

.X2 = 1.
.Y2 = 1.
.Z2 = 0.
End With
With Line3
.X1 = 1.
.Y1 = 1.
.Z1 = 0.

.X2 = 0.
.Y2 = 1.
.Z2 = 0.
End With
With Line4
.X1 = 0.
.Y1 = 1.
.Z1 = 0.

.X2 = 0.
.Y2 = 0.
.Z2 = 0.
End With

'---------------------------------'

'#Region Level Variable Parameter settings
Dim Level 
Level = 10

'---------------------------------'

'#Region Draw Lines
Sub CreateLines
If CreateLine(Line1,mcCOLOR_GREEN,Level) = mcENTITY_INVALID Then
ShowString "Failed to create line"
Exit Sub
End If
If CreateLine(Line2,mcCOLOR_GREEN,Level) = mcENTITY_INVALID Then
ShowString "Failed to create line"
Exit Sub
End If
If CreateLine(Line3,mcCOLOR_GREEN,Level) = mcENTITY_INVALID Then
ShowString "Failed to create line"
Exit Sub
End If
If CreateLine(Line4,mcCOLOR_GREEN,Level) = mcENTITY_INVALID Then
ShowString "Failed to create line"
Exit Sub
End If
End Sub

'---------------------------------'

'#Region Tool Variables
Dim ToolDiameter
Dim ToolRadius
Dim ToolNumber
Dim Tool
Dim Comp
Dim CornerType
Dim FeedRatePercent

'---------------------------------'

'#Region Set Tool Variables
ToolDiameter = 0.125
ToolRadius = 0.0
ToolNumber = 1
Tool = 1 '??
Comp = 1 'Cutter Compensation
CornerType = 0
FeedRatePercent = 100.0

'---------------------------------'

'#Region ErrorCodes
Dim opErrorCode

'---------------------------------'

'#Region Create Contour Operation
Sub CreateContour
If ChainAll(True,False,Level, "") Then
opErrorCode = MakeContour("Operation Created Via the Api",ToolDiameter,ToolRadius,ToolNumber,Tool,Comp,CornerType,FeedRatePercent)
If opErrorCode = mcOPERATION_INVALID Then
	ShowString "Failed to contour operation,"
End If
Call FreeChains   
End If
End Sub

'---------------------------------'

'#Region Program call all functions here
Sub Program
'#Region Set Planes 
'call some predefined  functions to set the plane to top
call SetCPlaneNumber(mcVIEW_TOP)
call SetTPlaneNumber(mcVIEW_TOP)

'#Region Geometry Creation
call CreateLines
'#Region Geometry Creation
call CreateContour
End Sub

'---------------------------------'

'#Region Call Program
call Program

 

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...