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:

Vb script for drill circle picking


Recommended Posts

You could use the AskValue() function to prompt the user for a diamter like this:

 

code:

Dim iDia    ' var to hold diameter value

 

If Not (askValue("Enter diameter:", 0, 100, iDia)) Then

' user canceled os you can bail if need be

End If

Then you can loop throught the database to find arcs that match what you're looking for:

 

code:

    Dim bSuccf            ' success flag

Dim arrNewArcs() ' array of arcs

Dim arcTemp ' temporary arc object

Dim iArcCount ' number of arcs

 

' init

iArcCount = 0

 

' look for arcs

bSuccf = StartDBSearch(mc_alive, mc_arctype)

 

' good to go?

If bSuccf Then

Do

' create an arc object for the current arc

Set arcTemp = New McAr

 

' get the current arc

If GetArcData(GetEntityEptr, arcTemp) Then

' add the arc to the array if it has the diameter we want

If (arcTemp.R * 2 = iDia) Then

' resize the array

ReDim Preserve arrNewArcs(iArcCount + 1)

 

' add the new arc to our array

Set arrNewArcs(iArcCount) = arcTemp

 

' increment the counter

iArcCount = iArcCount + 1

End If

End If

 

' get the next arc

bSuccf = NextDBSearch()

Loop While bSuccf

End If

You would then have an array, called arrNewArcs, containing Mastercam arc objects (McAr) that have the same diameter as what the user entered. From that point, you can do what you need to.

 

For more examples, look in the VB sub directory in your Mastercam installation directory.

 

HTH cheers.gif

 

[ 09-24-2004, 01:32 PM: Message edited by: Bullines ]

Link to comment
Share on other sites

I would like to use the variable Idia when I get to the Mask on Arc command so I dont need to select an arc from the part. Could I use a script using the Toolpaths - Drill - Mask on arc commands with a prompt for the value of Idia and then using the aray arrNewArcs for creating point positions.

Thanks again.

Bob.

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