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:

Creating new planes in VB-script?


Recommended Posts

Hello,

 

Since I haven't had the time to learn Visual studio and C++, I've made some simple VBscripts, and with Scriptlinker I find this really useful.

 

Customers doing 4-axis vertical machining tend to use the plane BACK or create another plane with one axis pointing in the wrong direction.

 

I've had them use a file with 36 new planes, merging every geometry into that file.

This so they don't need to create so many planes from scratch.

 

Questions:

How to create new planes in VBscript?

I'd like to pick an axis, angle increment and direction. Then have them named with the angle.

 

Maybe I should send this as an enhancement request to QC instead, and hope for a new command?

 

Anyone else thought about this?

Link to comment
Share on other sites

This is from the mastercam script help:

 

// set the current tool plane view to be perpendicular to a certain vector

 

Integer SetTPlaneNormal(

Real,(Input: X-Coordinate of vector perpendicular to new view)

 

Real,(Input: Y-Coordinate of vector perpendicular to new view)

 

Real,(Input: Z-Coordinate of vector perpendicular to new view)

)

 

 

I have never tried to use it, but it is possible to create a plane using VB!

 

Karl

Link to comment
Share on other sites
  • 4 weeks later...

Here is an example Taft sent me that creates two arcs on different planes:

 

 

code:

'////////////////////////////////////////////////////////////////////////////////

'//

'// Author: Rich Taft

'// Date: 8/16/05

'// File Name: geo_junk.vbs

'//

'// Description: sample from the "TaftMan" setting cplane

'//

'// Comments:

'//

'////////////////////////////////////////////////////////////////////////////////

 

 

Public CRect, Cline, CPoint, CArc

Public NewPlane,NewView

Call Main

Sub Main

'Call NewMC(False)

Call GetCPlaneNumber()

'Call SetWCSNumber(mcVIEW_ISO)

Call RepaintScreen (True)

 

'From Top Plane create line perpendicular to Z

' and 180 degree arc @

NewPlane = SetCPlaneNormal(0,0,1)

 

'NewView = 1

'Call create_line

'Call create_arc

 

'From 45 degree Plane create line perpendicular to Z

' and 180 degree arc @

NewPlane = SetCPlaneNormal(0,-.70711,.70711)

'SetCPlaneNumber(2)

'NewView = 2

Call create_line

Call create_arc

 

 

NewPlane = SetCPlaneNormal(0,-1,0)

'NewView = 3

Call create_line

Call create_arc

 

 

 

Call RepaintScreen (True)

End Sub

Sub Create_arc

Set Carc = New McAr

With Carc

.X = 2

.Y = 1

.Z = 0

.R = 1

.SA = 0

.SW = 180

.view = NewPlane

'.view = NewView

End With

If CreateArc(Carc, 2, 12) =mcENTITY_INVALID Then Exit Sub

Set Carc = Nothing

End Sub

 

 

Sub Create_Line

Set Cline = New McLn

With Cline

.X1 = 2

.Y1 = 1

.Z1 = 0

.X2 = 2

.Y2 = 1

.Z2 = 1

End With

If CreateLine(CLine, 10, 5) =mcENTITY_INVALID Then Exit Sub

Set Cline = Nothing

End Sub


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...