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 mastercam


Recommended Posts

I updated the script to import drilling and threading, drilling works fine but threading is failing, I'll dig deeper.

'//   Description:   Test calling up an executable then import an operation
'//                  and modify it's feed, speed, and op comment.
'//      Comments:   Using version X9 
 
' Constants
Public Const DEF_NOTEPAD = "C:\test\notepad.exe"
 
Const OP_FILE = "C:\Users\Public\Documents\shared mcamx9\mill\Ops\Threadmill_Jc.operations-9"
Const OP_NAME = "Thread Mill"
Const OP_NAME_DRILL = "Drilling Operation"
Const OP_COMMENT_DRILL = "Drilling Operation"
Const OP_COMMENT = "Threadmill 1/4-20 3x"
 
' Start Script
Call Main()
 
Sub Main()
 
Dim FSO, strShell, overrides
  
Set FSO = CreateObject("Scripting.FileSystemObject")
strShell = DEF_NOTEPAD
 
Call ShellAndWait (strShell, True) 
 
Set overrides = New McOverride
 
With overrides
       .FeedRatePercentOn = False
       .FeedRate = 80
       .SpindleSpeedPercentOn = False
       .SpindleSpeed = 80
End With


Call ZeroPts

Dim success
success = StartDBSearch(mc_alive, mc_pointtype)        

If success Then
    Do 
	       Dim Point
           Set Point = New McPt
           If GetPointData(GetEntityEptr, Point) = True Then
              Call AddDrillPoint(Point.X, Point.Y, -1) 
			  ShowString("Adding Point X:" + Cstr(Point.X) + " Y:" + Cstr(Point.Y) )  
           End If
    Loop While NextDBSearch   
End If  
  
If MakeOperationFromName(OP_FILE,OP_NAME_DRILL,OP_COMMENT_DRILL, overrides) <> mcOPERATION_INVALID Then
      ShowString("Drilling complete")
Else
      ShowString("Could not apply Drilling toolpath")
End If  
  
'If MakeOperationFromName(OP_FILE,OP_NAME,OP_COMMENT, overrides) <> mcOPERATION_INVALID Then
'      ShowString("Threadmilling complete")
'Else
'      ShowString("Could not apply Threadmilling toolpath")
'End If
 
    
' -- Clean up
Set FSO = Nothing
 
End Sub
Link to comment
Share on other sites

Mick,

 

  Thanks for the prompt support...not used to good CAM support...coming from ProEngineer. I tried attaching the file and received the following message:   Error You aren't permitted to upload this kind of file. The file was a generic threadmill .operations-9 file which I selected one point for geometry before exporting out.  Your new script gives me plenty to absorb and experiment with...curious on the threadmill conclusion.

 

Thanks, JCDFCM

Link to comment
Share on other sites

JCDFCM,

 

It appears that importing a thread mill operation is currently broken in X9 and 2017 I'm afraid. It has been fixed internally but I am not sure if it will be part of any maintenance update for 2017 but I will see. I apologize for any inconvenience caused.

 

Edit: I would like to add the we are no longer actively developing our VBScript API and it will be deprecated at some point. The .NET API is the recommended choice in place of VBScript.

Edited by Mick from CNC Software Inc.
Link to comment
Share on other sites

Mick,

 

   That's ok, this gives me a reason to go full bore on .Net. I can use the VBScript for basic odds and ends but will pursue the .NET API. So basically I can accomplish the same functionality above, it just has to be a NET-Hook and the .NET API will be maturing in the future while VBScript will be phased out?

 

Thanks, JCDFCM

Link to comment
Share on other sites

I am working on a new import operations example project and should have something uploaded in the next couple of days. I will let you know when its available.

 

Mick,

 

   That's ok, this gives me a reason to go full bore on .Net. I can use the VBScript for basic odds and ends but will pursue the .NET API. So basically I can accomplish the same functionality above, it just has to be a NET-Hook and the .NET API will be maturing in the future while VBScript will be phased out?

 

Thanks, JCDFCM

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