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:

John T.

Verified Members
  • Posts

    189
  • Joined

  • Last visited

Everything posted by John T.

  1. As a personal project, I had these plans scanned, and they are in TIF format. Now I need something that will convert these TIF's to one of the formats that MC9 will read. I suspect that is usual with these kind of conversions, I'll wind up tracing over the vector lines on another layer with MC. Anyone know of a raster to vector program that doesn't cost an arm and a leg and does a pretty good job? John
  2. I'm vacationing in vegas area right now. Shoshone is $2.49 a gallon. Fortunately, I don't need to buy it there! about $2.00 a gallon elsewhere in this area.
  3. CAM Disciple, It doesn't seem to matter whether abs or incr is used. Mick, have you had a chance to look into why this crashes with transforms? John
  4. I have a couple of .set setup sheets in the FTP. I don't recall exactly what they were named, setup2.set and setup3.set, or something like that. I was never satisfied with them (formatting problems), and abandoned them, going with a .vbs script setup sheet instead that pretty much does what I want. John
  5. We've had molds go for over 20 hours, and on top of that, they are often multi-cavity tools, so we can spend many many days just running these same ones over and over. We would rather get a good quality finish with minimal polishing than to "just get the part out". John
  6. If your gonna do the whole thing in just 3D, solids are fine, but solids do take up more memory and disk space. If you want to make 2D toolpaths (not have seen the file), transforming the solids to surfaces will make it easier to generate the 2D geo for your toolpaths. John
  7. Mick, I don't think I'll be allowed to send any of our drawings, but I can upload the current script program that we are using, and you should be able to test it on any drawing that uses a transform toolpath to watch it crash. Look for it in the VB script folder as setupsheet John
  8. Maybe they (vendors) are saving their jaw-droppers for the Chicago show? supposed to be this fall, right? John
  9. yep yep yep. Transformed toolpaths cause this sucker to CRASH mastercam. Maybe once I get the do-while thing figured out, it'll make a difference. John
  10. I still haven't figured out the logic for splitting the tool list, but I'm working on it. But anyway, we have a theory that what causes MC to crash when using this doc sheet is that it has something to do with transformed operations. The one thing in common all the programs that crash has been transformed operations. Interesting. We'll be putting it to the test shortly. John
  11. Heres what I have. It works fine when tools are consecutive, but skips the remaining tools after the missing one. this is the code for one column. I don't know if the if-next loop in ther messed things up, but I just can't figure out how to cut up the tool list into 2 columns of 10 tools each code: nCount=GetFirstOperationID("") 'Get id of first operation toolcount=1 Do nToolNum=GetToolNumberFromOperationID("",nCount) If toolcount=nToolNum Then strText="T"&nToolNum&vbTab& _ GetToolComment(nToolNum)&vbTab& _ GetToolDiameter(nToolNum)&vbTab& _ GetToolFluteLength(nToolNum)&vbTab& _ GetToolLength(nToolNum) With wordDoc 'output to word .Selection.MoveDown wdLine, .ActiveDocument.Words.Count .Selection.TypeParagraph .Selection.TypeText strText End With toolcount=toolcount+1 'nCount=GetNextOperationID() 'Else nToolNum=nToolNum+1 End If nCount=GetNextOperationID() Loop While (nCount<>-1) And nToolNum<=10 John
  12. Bullines, Your code works, but it seems the trick is to list each tool only once, then only 10 tools each in 2 columns. Straight, your code will list all operations. I can't seem to do this correctly. Whatever I try either gives me an inifinite loop, or lists tool 1 once. I'm trying to puzzle out the logic to do this now. John
  13. I've realized that the do while loops may not work unless you can figure out how to avoid infinite loops when less than the specified number of tools (loop while toolcount<=10) are used. At least the way I have written it. John
  14. Heres what I tried: toocount=1 idx=1 Do Do While toolcount=GetToolNumberFromOperationID("",(idx)) strText = "T"&arrToolNumber(idx)& vbTab & _ arrToolComment(idx) & vbTab &" " & _ arrToolDiameter(idx) & vbTab&" "& _ arrToolFluteLength(idx) &vbTab& _ arrToolLength(idx) Call WriteToWord(strText) toolcount=toolcount+1 Loop idx=idx+1 Loop While toolcount<=10 This works fine when all the tools are there, but it crashes in the case of the missing tool. Do I need to do some error trapping the way of looking for a different kind of string, such as "NULL" or something? For my testing, I deleted tool 3, it lists tools one and 2 fine, lists tool 4 as T3, then freezes up, possibly an infinite loop. I have no idea what to look for to see if a tool is missing. John
  15. If you give my setup sheet a try, you'll see in the upper left box "Description:". Now if a user puts in more characters than will fit between character and the border of the text box, it'll wrap down, pushing the 2 fields below the "description field" down, with the "material" field being pushed out the bottom of the text box. So what I need to do is trim the description to fit regardless of how long it is. Maybe Rekd has the best idea. Simply format it for the fattest characters. John
  16. hmmm. using: Description=Left(Description,22) works, but it wont keep the input inside the field (ie it wraps to the next line, moving the next two lines out of the text box) if the characters are "fat", like m's. skinny letters like i are no problem. Can a string be trimmed to a max length in inches or points? John
  17. You guys understood perfectly. I used the Replace command at first, but didn't know I needed the qoutation marks. This is what I have now. I will use this for setting up saving the word document my setup sheet generats within the same directory as the MC9 file. saveworddoc=Replace(GetCurrentFileName(),".MC9",".DOC") ShowString(saveworddoc) The other method for trimming should work for trimming user input. John
  18. Is there a way to manipulate string lengths with VBS? For example, trim the .MC9 off of a file path and add .DOC so to save my doc sheet file in word with the MC9 files. Another would be to trim a input string to fit in a field. John
  19. I had a vertibird when I was about 6! I think mine was the artic one. My much older half brother said he would "improve" it for me, then broke a spring in it. Said he'd fix it, but never did. > I had a SPT (although I think they were called SST?) racer, a demo derby one. That evel Knievel bike stuff was cool. I had both the chopper bike, regular bike, scramble van, and rocket bike (his canyon jumper). Don't forget the original star wars stuff. I still have my blue border cards. Water rockets are still sold. John
  20. Serious problem has cropped up. The 30mb file I was using to test the script while developing it caused no problems, but when attempted with large files with lots of 3D, 131mb and 69mb, it causes MC to crash (caused errors message box). a 68mb file worked OK though. This was on different computers with the same results. any ideas? John
  21. In testing, if a tool is missing (i.e. 1,2,4,5, etc) it messes up the tool list. If a tool is repeated after other tools (1,2,3,1), no problem. Anyone else find any problems? any suggestions for the missing tool bug? John
  22. Once again, Never mind! Seems the assignment to the F12 key didn't take for some reason. Works from MC now. John
  23. Here it is. My finished setup sheet. There is only one big problem. It doesn't work right from MC, only the VB editor in MC!! why is this??? code: '//////////////////////////////////////////////////////////////////////////////// '// '// Author: John Thompson, with MUCH help from Mick George and Bullines! '// Date: 15/03/2004 04:01 PM '// File Name: New Mastercam Script '// '// Description: setupsheet.vbs '// '// Comments: Makes a job setup sheet. '// '//////////////////////////////////////////////////////////////////////////////// '///////////////// My Constants ///////////////// '///////////////// My Global Variables ////////// ' -- Start Script ' //////////////////// ' Sub Declaration ' //////////////////// Dim wordDoc '///////////////// My Constants ///////////////// Dim companyname Dim Program Dim Description Dim Post Dim programmer Dim notes Dim tlo Dim nCount ' number of operations Dim nToolNum ' tool number Dim arrToolNumber() ' array of tool numbers Dim arrToolComment() ' array of tool comments Dim arrToolDiameter() ' array of tool diameters Dim arrToolFluteLength() ' array of tool flute lengths Dim arrToolLength() ' array of tool lengths Dim idx Dim toolcount Dim strText Dim Position Dim FileName Dim graphic Dim stockx Dim stocky Dim stockz Const wdTabLeaderSpaces = 0 Dim DateTimeFormat() Const wdAlertsNone=0 Const wdWindowStateMaximize=1 Const wdLine=5 Const wdEnglishUS = 1033 Const wdCalendarWestern = 0 Const wdColorDarkRed=128 Const wdAlignParagraphCenter=1 Const msoTextOrientationHorizontal = 1 Const wdTextOrientationDownward = 3 Const msoFalse=0 Const DEF_SPACING_ONEANDAHALF=1 Const wdAlignTabRight = 2 Const wdAlignTabLeft=2 '///////////////// My Global Variables ////////// ' -- Start Script Call Main() ' //////////////////// ' Sub Declaration ' //////////////////// Sub Main() 'WriteString("Company Name?") Do 'ask until a real company name is entered companyname=AskString("company Name?") Loop While companyname="company Name?" Or companyname="((ESC))" Or companyname="" Do 'ask until a real program number is used Program=AskString("program number?") Loop While Program="program number?" Or Program="" Or Program="((ESC))" Do 'ask until a real description is used Description=AskString("description") Loop While Description="description" Or Description="" Or Description="((ESC))" Post=AskString("Fadal") ' -- You can call GetPostName() mag Do 'ask until a real programmer name is input programmer=AskString("programmer?") Loop While programmer="programmer?" Or programmer="" Or programmer="((ESC))" notes=AskString("Notes") 'better a blank line than seeing Notes: notes If notes="Notes" Or notes="" Then notes="" End If Do tlo=AskString("TL0") Loop While tlo="TL0" Or tlo="" Or tlo="((ESC))" 'get stock setup sizes stockx=GetJobSetupStockSizeX stocky=GetJobSetupStockSizeY stockz=GetJobSetupStockSizeZ 'check stock size for 0 If stockx=0 Then If askYesNo ("Stock size is zero, do you want to change it?")=mcMSG_YES Then stockx=AskString ("X stock size?") stocky=AskString ("Y stock size?") stockz=AskString ("Z stock size") End If End If 'Load tool information ' get the number of operations nCount = GetOperationCount("") If nCount = 0 Then ShowString "No operations found in current drawing": Exit Sub For idx = 1 To nCount ' get the tool number using the current operation nToolNum = GetToolNumberFromOperationID("", idx) ReDim Preserve arrToolNumber(idx) ReDim Preserve arrToolComment(idx) ReDim Preserve arrToolDiameter(idx) ReDim Preserve arrToolFluteLength(idx) ReDim Preserve arrToolLength(idx) ' copy tool data into our individual arrays arrToolNumber(idx) = nToolNum arrToolComment(idx) = GetToolComment(nToolNum) arrToolDiameter(idx) = GetToolDiameter(nToolNum) arrToolFluteLength(idx) = GetToolFluteLength(nToolNum) arrToolLength(idx) = GetToolLength(nToolNum) Next 'open word Set wordDoc=CreateObject("Word.Application") wordDoc.Documents.Add With wordDoc .Visible=True .WindowState=wdWindowStateMaximize .DisplayAlerts=wdAlertsNone 'Sets Margins .Selection.PageSetup.LeftMargin = .InchesToPoints(0.5) 'start of margin setting macro .Selection.PageSetup.RightMargin = .InchesToPoints(0.5) .Selection.PageSetup.TopMargin = .InchesToPoints(0.5) .ActiveWindow.ActivePane.VerticalPercentScrolled = 20 .Selection.PageSetup.BottomMargin = .InchesToPoints(0.5) 'end of margin setting macro 'Puts "Program Info" top center .Selection.Font.Bold=True .Selection.Font.Size=20 .Selection.ParagraphFormat.Alignment=wdAlignParagraphCenter .Selection.Font.Name="staccato222 BT" '.Selection.Font.Color =wdColorDarkRed 'Running low on red ink! .Selection.TypeText "PROGRAM INFO" .Selection.TypeText vbNewLine 'Puts program number in sideways box, right side .ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 525, 75, 45, 117).Select 'start of macro code .Selection.ShapeRange.TextFrame.TextRange.Select .Selection.Collapse .Selection.ShapeRange.Line.Visible = msoFalse .Selection.ShapeRange.Select .Selection.ShapeRange.IncrementLeft 36 ' -- Removed # not valid in VBS mag .Selection.ShapeRange.IncrementTop -18 .Selection.Orientation = wdTextOrientationDownward .Selection.Font.Size = 24 .Selection.TypeText Program 'double text boxes for header info .ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 20,80, 222.3, 60).Select 'first box left side .Selection.ShapeRange.TextFrame.TextRange.Select 'First box header info goes this section .Selection.Collapse .Selection.ShapeRange.Line.Visible = msoFalse .Selection.Font.Bold=True .Selection.TypeText "Company: "&vbTab 'Company Name .Selection.Font.Bold=False .Selection.TypeText companyname&vbNewLine .Selection.Font.Bold=True .Selection.TypeText "Description: "&vbTab 'Description .Selection.Font.Bold=False .Selection.TypeText Description &vbNewLine .Selection.Font.Bold=True .Selection.TypeText "PI Num: "&vbTab 'PI number .Selection.Font.Bold=False .Selection.TypeText Program &vbNewLine .Selection.Font.Bold=True .Selection.Font.Bold=True .Selection.TypeText "Material: "&vbTab 'Material type IF in Job setup .Selection.Font.Bold=False .Selection.TypeText GetJobSetupMaterial() &vbNewLine 'Second Header box .Selection.ShapeRange.Select .ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 245,80, 320, 60).Select 'second box right side .Selection.ShapeRange.TextFrame.TextRange.Select .Selection.Collapse .Selection.ShapeRange.Line.Visible = msoFalse .Selection.Font.Bold=True .Selection.TypeText "Filename: "&vbTab&vbTab 'File Name .Selection.Font.Bold=False .Selection.TypeText GetCurrentFileName()&vbNewLine .Selection.Font.Bold=True .Selection.TypeText "Post: "&vbTab&vbTab&vbTab 'Post .Selection.Font.Bold=False .Selection.TypeText Post &vbNewLine .Selection.Font.Bold=True .Selection.TypeText "Stock Size: "&vbTab&vbTab 'Stock size IF in job setup .Selection.Font.Bold=False .Selection.TypeText "X"&stockx&" Y"&stocky&" Z"&stockz &vbNewLine .Selection.Font.Bold=True .Selection.TypeText "Stock Origin: "&vbTab 'Stock origin from job setup. Almost always 0,0 .Selection.Font.Bold=False .Selection.TypeText "X"&GetJobSetupStockOriginX&" Y"&GetJobSetupStockOriginY&vbNewLine 'Print out notes .ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, _ 140, 530, 35).Select .Selection.ShapeRange.TextFrame.TextRange.Select .Selection.Collapse .Selection.ShapeRange.Line.Visible = msoFalse .Selection.Font.Bold=True .Selection.TypeText "NOTES: " .Selection.Font.Bold=False .Selection.TypeText notes 'Revisions listing .Selection.ShapeRange.Select .ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, _ 180, 575.7, 33).Select .ActiveDocument.Paragraphs.TabStops.ClearAll .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(1.6) .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(3.1) .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(4.6) .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(6.1) .Selection.ShapeRange.TextFrame.TextRange.Select .Selection.Collapse .Selection.ShapeRange.Line.Visible=msoFalse .Selection.Font.Bold=True .Selection.TypeText "Name: "&programmer&vbTab&"Name:________"&vbTab&"Name:________"&vbTab&"Name:_______"&vbTab&"Name:________"&vbNewLine .Selection.TypeText "Date: " 'Date .Selection.InsertDateTime "M/D/YY", False, False, wdEnglishUS, wdCalendarWestern 'get the date .Selection.TypeText vbTab&"Date:________"&vbTab&"Date:________"&vbTab&"Date:_______"&vbTab&"Date:________" 'puts out tool list 'creat 2 text boxes 'left side box .ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, _ 213, 270, 225).Select .ActiveDocument.Paragraphs.TabStops.ClearAll .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(.5) .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(1.5) .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(2.3) .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(2.9) .Selection.ShapeRange.TextFrame.TextRange.Select .Selection.Collapse .Selection.ParagraphFormat.LineSpacingRule=DEF_SPACING_ONEANDAHALF 'Change line spacing to 1 and a half .Selection.ShapeRange.Line.Visible = msoFalse .Selection.Font.Bold=True .Selection.TypeText "Tool"&vbTab&"Description"&vbTab&" "&"Dia "&vbTab&"Flute"&vbTab&"Overall" .Selection.Font.Bold=False toolcount=1 'prints first tool strText="T"&arrToolNumber(1)& vbTab & _ arrToolComment(1) & vbTab &" "& _ arrToolDiameter(1) & vbTab&" " & _ arrToolFluteLength(1) & vbTab & _ arrToolLength(1) Call WriteToWord(strText)'sends first tool to word For idx=1 To nCount If toolcount<=9 Then If toolcount<>GetToolNumberFromOperationID("",(idx)) Then strText = "T"&arrToolNumber(idx)& vbTab & _ arrToolComment(idx) & vbTab &" " & _ arrToolDiameter(idx) & vbTab&" "& _ arrToolFluteLength(idx) &vbTab& _ arrToolLength(idx) Call WriteToWord(strText) toolcount=toolcount+1 End If End If Next 'Right side box .Selection.ShapeRange.Select .ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 310, _ 213, 270, 225).Select .ActiveDocument.Paragraphs.TabStops.ClearAll .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(.5) .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(1.5) .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(2.3) .Selection.ParagraphFormat.TabStops.Add .InchesToPoints(2.9) .Selection.ShapeRange.TextFrame.TextRange.Select .Selection.Collapse .Selection.ParagraphFormat.LineSpacingRule=DEF_SPACING_ONEANDAHALF .Selection.ShapeRange.Line.Visible = msoFalse .Selection.Font.Bold=True .Selection.TypeText "Tool"&vbTab&"Description"&vbTab&" "&"Dia"&vbTab&"Flute"&vbTab&"Overall" .Selection.Font.Bold=False 'Second column of tools toolcount=11 'toolcount=1 For idx=1 To nCount If toolcount >= 10 Then If toolcount=GetToolNumberFromOperationID("",(idx)) Then strText = "T"&arrToolNumber(idx)& vbTab & _ arrToolComment(idx) & vbTab &" " & _ arrToolDiameter(idx) & vbTab&" "& _ arrToolFluteLength(idx) &vbTab& _ arrToolLength(idx) Call WriteToWord(strText) toolcount=toolcount+1 End If End If Next 'Put TL0 information in .ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, _ 438, 564.3, 35).Select .Selection.ShapeRange.TextFrame.TextRange.Select .Selection.Collapse .Selection.ShapeRange.Select .Selection.ShapeRange.Line.Visible = msoFalse .Selection.Font.Bold=True .Selection.TypeText "T.L.0. Location: " .Selection.Font.Bold=False .Selection.TypeText tlo&vbNewLine .Selection.TypeText "_________________________________________________________________________________________" 'Load Graphic into textbox graphic="J:datatetest.emf" DoMetafile graphic .Selection.ShapeRange.Select .ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 115, _ 480, 390, 302).Select .Selection.ShapeRange.TextFrame.TextRange.Select .Selection.Collapse .Selection.ShapeRange.Line.Visible = msoFalse .Selection.InlineShapes.AddPicture graphic,False,True End With 'end output to word If Not wordDoc Is Nothing Then Set wordDoc = Nothing ShowString "Script has ended" End Sub ' Writes tool list to word Public Sub WriteToWord(strOutText) Dim wordCounts With wordDoc .Selection.MoveDown wdLine, .ActiveDocument.Words.Count .Selection.TypeParagraph .Selection.TypeText strOutText End With End Sub What doesn't work is the message boxes, one that asks if you want to enter stock size if the default is zero, and it won't create the text box at the bottom and put the EMF graphic in it. I don't know if its creating the EMF file either, haven't checked. I assigned the script to the F12 key, and it won't do those things, only from the script editor. John
  24. no, the one I have is an older free version that was with MC9, and the list covering the new stuff I have was the announcment last year of the upgrades, and shows the list of new functions and stuff, but not the syntax and the like.
  25. Is there a updated version of this file? The one I have doesn't show the newer commands like GetToolFluteLength, etc. John

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