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 : Adding arcs instead of points to drilling operation


Recommended Posts

Hi, I was wondering if their is a way to add arcs instead of points to a drill op via vbscript. Here is my code for drilling :

'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Function DrillAllAddToOperation(LevelToDrill,PathToOpLibrary,OpNameAsString,OpCommentAsString,OverRideSettings,currentview)
Call FreeChains     
Call UnselectAll      
Call RepaintScreen(True)   
Call SetCPlaneNumber(currentview)
Call SetTPlaneNumber(currentview)
Call ZeroPts
Dim SearchArcs
SearchArcs = StartDBSearch(mc_alive, mc_arctype)    
If SearchArcs Then
Do 
If Not LevelToDrill <> GetEntityLevel Then 
Dim Arc
Set Arc = New McAr
If GetArcData(GetEntityEptr, Arc) = True Then
Call AddDrillPoint (Arc.X, Arc.Y, -1) 
End If
End if
Loop While NextDBSearch   
End If  
If MakeOperationFromName(PathToOpLibrary,OpNameAsString,OpCommentAsString, OverRideSettings) <> mcOPERATION_INVALID Then
Else
End If  
Call SetCPlaneNumber(mcVIEW_TOP)
Call SetTPlaneNumber(mcVIEW_TOP)
Call ZeroPts
End Function
'/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Thank youu!

ps. I know this language is out of date but IT is having trouble download visual studio onto my machine with windows 10

Link to comment
Share on other sites
On 12/10/2019 at 10:58 AM, Mick George said:

It is certainly out of date and essentially deprecated at this point but you might be able to use AddArcPoint()

 

If you open or create a VBScript in Mastercam Code Editor you will get intellisense to help find functionality.

 

 

addarcpoint.png

Mick,

thank you.

 If I may ask another question, would it be possible to disable duplicate tool checking during makeoperationfromfilename ?

Link to comment
Share on other sites
  • 3 weeks later...
17 minutes ago, Roger Martin from CNC Software said:

Peter,

See :

NET-Hook API Reference Guide
https://nethookdocs.mastercam.com

Search for: OperationsManager.ImportOperation
Note the ImportOptions that are passed to the ImportOperation method.
 

Thank you for the reply Roger,

I am looking to add an arc to an already existing drilling or circle milling/helixbore operation

Link to comment
Share on other sites

NET-Hook API Reference Guide
https://nethookdocs.mastercam.com

Search for: "DrillPoint"
See: DrillPoint Constructor (ArcGeometry)

In a "Point-Based" type operation in the NET-Hook API...
The toolpath geometry assigned to it are "DrillPoint" objects.
The operation has the "DrillPoints" member data that contains these points.

-Pseudo code-

// MyArc - is an existing ArcGeometry object.
// MyDrillOp - is a "Point-Based" type operation.

var drillPt = new DrillPoint(MyArc);
MyDrillOp.DrillPoints.Add(drillPt);
MyDrillOp.Commit();
MyDrillOp.Regenerate(); 
                        

Link to comment
Share on other sites
On 1/2/2020 at 1:38 PM, Roger Martin from CNC Software said:

NET-Hook API Reference Guide
https://nethookdocs.mastercam.com

Search for: "DrillPoint"
See: DrillPoint Constructor (ArcGeometry)

In a "Point-Based" type operation in the NET-Hook API...
The toolpath geometry assigned to it are "DrillPoint" objects.
The operation has the "DrillPoints" member data that contains these points.

-Pseudo code-

// MyArc - is an existing ArcGeometry object.
// MyDrillOp - is a "Point-Based" type operation.

var drillPt = new DrillPoint(MyArc);
MyDrillOp.DrillPoints.Add(drillPt);
MyDrillOp.Commit();
MyDrillOp.Regenerate(); 
                        

It works perfectly, thanks again.

 

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

In my user profile these functions work well, however on 2 other users there is some undefined behavior where toolpaths are being sometimes mangled, I will probably switch to using only pocket and contour toolpaths to deal with the former helix bore, circle mill toolpaths, the drilling doesn't seem to cause a problem, but I will most likely return to the c++ point based system for drilling.

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