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 Xform Rotate


Kyle Waters
 Share

Recommended Posts

Good Morning All,

 

I have a bunch of parts that I need to create roughly 15 new Cplane/Tplanes on. Currently I;

Rotate Gview

Enter my rotation values

Accept the result

Name and save the Gview

Type the name

Click to set as WCS

Set Planes = to Gview

Create a point on a previously created arc

Reset my WCS to Top

Change my Cplane/Tplane origin to the point just created

Click on update

Reset my Gview to Top(WCS)

start over...

 

I tried using macros, but I don't see how to get the whole thing automated with macros. I did do some searching, and I didn't see anything in the Mastercam VBScript help file for creating rotated views, only for physically rotating. Would this mean NETHook/C-Hook?

 

I am using X4, but I will use X3 if I need to!

 

Any and all help is appreciated.

Link to comment
Share on other sites

Hi Kyle,

 

You can make new planes with VBscript, but I'm not an expert, so I don't know how to automate the whole process. I mad a short example just in case it can be any help.

 

I got help from the developers forum last year.

Maybe if you post in that forum, you'll get better help.

 

 

'///////////////// My Constants /////////////////

 

Public Newplane

 

'///////////////// My Global Variables //////////

 

 

' -- Start Script

Call Main()

 

 

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

' Sub Declaration

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

Sub Main()

' -- Add code here...

 

Newplane = SetTPlaneNormal(0.707,0,0.707)

 

End Sub

Link to comment
Share on other sites

Ok Let me ask this. Do you think a script could be made where you could pick a a group of line and have Cplanes assigned to them? Let say I have 500 Vector lines and I wanted 500 Cplanes on each one could you make a script to allow you to pick all 500 lines and then assign Cplanes to each one without having to do the 1000's of mouse clicks required now?

Link to comment
Share on other sites

Hi Ron,

 

I tried to create planes from lines.

 

I'm all new to this so it may look silly to real programmers.

 

I guess you could make it loop until all necessary planes are created.

 

Anyway here's the script:

##################

 

Public theplane, new_ln, pointer, NewPlane

Public xb,yb,zb

 

Call Main()

 

 

Call GetCPlaneNumber

 

 

Sub Main()

 

 

If AskForEntity("select",mc_linetype) Then

Call Hej(theplane)

NewPlane = SetCPlaneNormal (xb,yb,zb)

End If

 

End Sub

 

Function Hej(theplane)

 

Set new_ln = New McLn

 

pointer = GetEntityEptr()

If GetLineData(-1,new_ln) Then

xb = new_ln.x2

yb = new_ln.y2

zb = new_ln.z2

FormatNumber xb,4

FormatNumber yb,4

FormatNumber zb,4

 

Exit Function

 

 

End If

 

 

End Function

 

############################

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