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:

Chook or VBS to assign colors to layers


Recommended Posts

I think there was a chook for that. Don't remember the name though.

 

Yes, you should be able to do this via VBS. I'll look when I get to work. (Methinks I should at least bring home a copy of the help file for VBS/MC.. rolleyes.gif )

 

'Rekd teh Favorite answer to evening questions.. "Lemme look when I get to work"

Link to comment
Share on other sites

It's untested, cheesy and I wrote it in 5 minutes, but it may be a start for someone. I know how I'd do it as a C-Hook, but I haven't played with the Mastercam's VBS stuff much. Hey, everyone (running 9.1) can edit VBS wink.gif

 

code:

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

'//

'// Author: Chris Bellini [email protected]

'// Date: 10/8/2003 10:14:32 PM

'// File Name: level_2_colour.vbs

'//

'// Description: set various levels to given colours

'//

'//

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

 

' -- Start Script

Call Main()

 

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

' Sub Declaration

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

Sub Main()

' vars

Dim bSuccf

Dim nCurrLevel

 

 

' start clean

Call ClearMenuAndPrompts

Call UnselectAll

Call FreeChains

 

' fit to screen

Call RepaintScreen(True)

 

' select the entities

bSuccf = ChainAll(False, False, mcCHAIN_ALL_NUMBERED_LEVELS, mcCHAIN_ALL_NAMED_LEVELS)

 

' make sure we actually have something to work with

If bSuccf Then ' yes, there's entities

' set the success flag to False, just in case

bSuccf = False

 

' loop through the db

Do

' get the level of the current entity

nCurrLevel = GetEntityLevel()

 

If (nCurrLevel > 0) Then ' make sure it's a valid level

' set the current entity's colour value to that of its level

Call SetEntityColor(nCurrLevel)

End If

 

' next entity, please

bSuccf = MoveToNextChain

Loop While bSuccf

 

ShowString "All done!"

Else ' no entities

ShowString "C'mon, gimme somethin' to work with!"

End If

End Sub

All of you Mastercam VBS gurus get your red pens out and mark it up wink.gif

 

[ 10-09-2003, 08:54 AM: Message edited by: Bullines ]

Link to comment
Share on other sites

Here's another way smile.gif

 

code:

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

'//

'// Author: Mick George [email protected]

'// Date: 08/10/2003 11:12 PM

'// File Name: SETCOLOURSFROMLEVELS.VBS

'//

'// Description: Changes all lines, arcs and points to the colour of the

'// level they reside on.

'//

'// Comments:

'//

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

 

 

' -- Start Script

Call Main()

 

 

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

' Sub Declaration

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

Sub Main()

 

Dim bRet

Dim intNewColor

 

' -- Select all entities

bRet = StartDBSearch(mc_alive, -1)

 

 

' -- Ok to go?

If bRet Then

 

Do

' -- Get this level

intNewColor = GetEntityLevel()

 

Call SetEntityColor(intNewColor)

 

' -- Get the next entity

bRet = NextDBSearch()

 

Loop While bRet

 

Call RepaintScreen(True)

 

End If

 

 

End Sub

Link to comment
Share on other sites
Guest CNC Apps Guy 1

quote:

ShowString "C'mon, gimme somethin' to work with!"

I like the comments. It makes it much more interesting.

 

I worked for/with a guy that heavily tweeked Mastercam's text file to the point where every error message elicited a vile response from the computer. Not fun being cussed at by your computer.

Link to comment
Share on other sites

Your all forgetting about the Levels C Hook

 

Levels-

-Sort-

-Color Sort

-Level Sort

-Z Sort

-Ent Sort

-Condense

-Fix Colors

-3D Lines

-By Length

-By Radius

-DB Percent

 

 

Oh and by the way ermm, its FREE

ooop sorry did I say FREE

What I meant to Say is " Wicked Chook and FREE "

 

Ok Roger and Chris start typing more VB code.

 

 

cheers.gif

Karl Oram

Link to comment
Share on other sites

Duh Duh duh Duh Duh duh du du du du du du Duh Duh duh duh duh Duh duh Duh my impression of deauling bajo's. biggrin.gifbiggrin.gifbiggrin.gif We need to enable sound on this thing I got tons of old waves from the old IRC days when I meet my wife on the internet about 7 years ago.

 

Hey Mick and Bulliness you keep writing them and i will keep using them I appericate the help you give and the knowlegde you share.

 

Crazy Millman

Link to comment
Share on other sites

quote:

I worked for/with a guy that heavily tweeked Mastercam's text file to the point where every error message elicited a vile response from the computer. Not fun being cussed at by your computer.

I did something like that a few years ago to a couple of our computers. We had more people than hasps and where constantly swapping them around. I had Mastercam say few choice words if you started without the hasp. Fast Forward a few years. I setup a new computer for the new guy and to save time I basically cloned the settings off another computer. I had a serious memory lapse about a certain text file. A couple days later he wanted to know why mastercam was swearing at him. smile.gif Oops. Luckily he had a sense of humor.

 

Bryan smile.gif

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