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:

C-Hooks and VB


Guest
 Share

Recommended Posts

Hello

a little bug was reported and I fixed the bug.

if you are already using this utility,

please download the file again and re-install.

Sorry for inconvenience.

:reported bug:

curse.gifwhen clicked 'Relative' icon, the Ribbonbar disappeared

 

 

User reported bug fixed!

http://www.ai-sols.co.jp/eng/download/AI_Utility_1_00_en.exe

Link to comment
Share on other sites

Hi Thad.

Thank you for suggestion. I'll do it tomorrow.

and I have to make download.htm file too. smile.gif

 

quote:

Ai_McxViewerExt.dll

.mcx file thumbnail preview in right-click popup menu.


it is a shell-extention dll, and InstallShield should unload the dll file by command 'regsvr32 /u Ai_McxViewerExt.dll' before uninstalling/deleting it.

(I'll check InstallShield project file too.

 

I have not done any change to Ai_McxViewerExt.dll,

it is the same file, so it will not be a big problem.

 

Thank you for the report. smile.gif

 

Any requests/suggestions/bug reports are welcome.

Thanks

 

and happy birthday to me cheers.gif lol

Link to comment
Share on other sites

quote:

Documents - We have several VB Scripts that generate setup sheets in Microsoft Word. The advantage to this is that we get to place data and graphics exactly where we want them. When the script runs, the user is prompted with a series of dialog boxes that they can input data in. Then the Script builds a Word document and populates the fields.

Colin,

Do this VB the complete setup sheet or dos it take the info from the Set-file and put that in a Word file?

Can/will you share an script for setup sheets?

Link to comment
Share on other sites

Hi Henk,

 

Our scripts do not read the .SET file. Our VB Script prompts the user with a series of dialog boxes and the user inputs the relative information. Then the VB Script builds a Word document by creating text boxes and filling in those boxes. Here is a modified version of our script. IT IS AN EXAMPLE ONLY! I just want to make that clear for everyone because it will not create a setup sheet if you just try and run it. If you take the time to learn a little VB it is a good starting point.

 

code:

  

 

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

'//

'//

'//

'// Description: setupsheet example only!!

'//

'// Comments: Makes a job setup sheet. Work in progress!

'//

'// Revisions:

'//

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

 

 

'///////////////// My Constants /////////////////

 

 

 

'///////////////// My Global Variables //////////

 

 

 

' -- Start Script

 

 

 

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

' Sub Declaration

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

Dim wordDoc

Dim i

'///////////////// My Constants /////////////////

Dim companyname

Dim Program

Dim HeaderName

Dim ToolList

Dim Description

Dim Post

Dim programmer

Dim notes

Dim Auth

Dim Sheet

Dim Rev

Dim Fixture

Dim Part

 

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 Path

Dim graphic

Dim stockx

Dim stocky

Dim stockz

Dim material

Dim saveworddoc

 

Dim lineY

 

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()

 

On Error Resume Next

'Filename = GetCurrentFileName()

Path = GetPathFromExtension("MCX")

 

 

ShowString("Setupdoc.vbs" & vbNewLine & "Graphic from c:temppart.jpg")

 

Filename = replace(ucase(GetCurrentFileName()),ucase(Path),"")

 

'HeaderName = GetGroupNameFromNumber(3)

HeaderName =Replace(ucase(Filename),".MCX","")

 

Post="MACHINE TYPE"

 

'Set objNetwork = CreateObject("WScript.Network")

'strUserName = objNetwork.UserName

 

'Do 'ask until a real programmer name is input

'programmer=AskString("programmer?")

'Loop While programmer="programmer?" Or programmer="" Or programmer="((ESC))"

 

 

 

If askYesNo ("Setup Style 1?")=mcMSG_YES Then

Auth = "Style1"

Sheet = "SHT" & Ucase( AskString("Sheet?"))

Rev = " REV" & Ucase(AskString("Revision Level?"))

Else

If askYesNo ("Style2?")=mcMSG_YES Then

Auth = "Style2"

Sheet = ""

Rev = "REV " & Ucase(AskString("Revision Level?"))

Else

Auth = ""

Sheet = ""

Rev = ""

End If

End If

 

'notes=AskString("Notes") 'better a blank line than seeing Notes: notes

' If notes="Notes" Or notes="" Then

notes=""

' End If

 

'check and get material

material=GetJobSetupMaterial()

ShowString "mat ", material

 

If material="NONE" Or material = "" Then

Fixture=AskString("Fixture?")

Part =AskString("Part?")

material = Fixture & " /Part:" & Part

End If

 

' 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

programmer = wordDoc.UserName

 

With wordDoc

 

.Visible=True

.WindowState=wdWindowStateMaximize

.DisplayAlerts=wdAlertsNone

.Selection.PageSetup.Orientation = 1

.Selection.Styles(-1).Font.Name="courier new"

.Selection.Font.Name="courier new"

'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=36

'.Selection.ParagraphFormat.Alignment=wdAlignParagraphLeft

'.Selection.Font.Name="Courier"

'

''.Selection.Font.Color =wdColorDarkRed 'Running low on red ink!

'.Selection.TypeText Program '"PROGRAM INFO"

'.Selection.ParagraphFormat.Alignment=wdAlignParagraphRight

'.Selection.TypeText "FWC:" & Post '"PROGRAM INFO"

'.Selection.TypeText vbNewLine

 

'Puts program number in box, top of document

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, 20, 520, 42).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Line.Visible = msoTrue

.Selection.ShapeRange.Select

'.Selection.ShapeRange.IncrementLeft 36 ' -- Removed # not valid in VBS mag

'.Selection.ShapeRange.IncrementTop -18

.Selection.Font.Size = 32

.Selection.Font.Bold = False

.Selection.TypeText HeaderName & " Setup Sheet " & Post

 

 

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 540, 20, 230, 42).Select

.Selection.ShapeRange.TextFrame.TextRange.Select 'First box header info goes this section

.Selection.Collapse

.Selection.ShapeRange.Line.Visible = msoTrue

.ActiveDocument.Paragraphs.TabStops.ClearAll

.Selection.ParagraphFormat.TabStops.Add .InchesToPoints(1.6)

.Selection.Font.Size = 36

.Selection.Font.Bold=False

'.Selection.TypeText "Date:" &vbTab 'Description

.Selection.Font.Bold=False

.Selection.InsertDateTime "M/D/YY", False, False, wdEnglishUS, wdCalendarWestern 'get the date

.Selection.TypeText vbNewLine

 

 

'Puts program number in sideways box, right side

'.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 675, 100, 45, 800).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 & " FWC: " & Post

 

'Print out notes

 

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 20,62, 520, 68).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Line.Visible = msoFalse

.Selection.Font.Size = 18

.Selection.Font.Bold=False

.Selection.TypeText "NOTES: "

.Selection.Font.Bold=False

.Selection.TypeText Ucase(notes)

 

'puts out tool list

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 675, 150, 90, 200).Select

.Selection.ShapeRange.Line.Visible = msoTrue

.Selection.Font.Bold=False

.Selection.Font.Size = 18

 

toolcount=1 'prints first tool

strText="T"&arrToolNumber(1) '& vbTab & _

.Selection.Font.Bold=False

.Selection.TypeText "TOOLS" & vbNewLine & "=====" & vbNewLine

.Selection.TypeText strText & vbNewLine

ToolList = ToolList & " " & strText

 

For idx=1 To nCount

strText = "T"&arrToolNumber(idx)'& vbTab & _

If instr(ToolList,strText) = 0 Then

.Selection.TypeText strText & vbNewLine

ToolList = ToolList & " " & strText

End If

Next

 

'Put TL0 information in

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 20,150, 650, 35).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Select

.Selection.ShapeRange.Line.Visible = msoTrue

.Selection.Font.Size=24

.Selection.Font.Bold=False

.Selection.TypeText

.Selection.TypeText Ucase(material)

 

 

 

'Misc. Info

 

 

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 540,62,230,20).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Select

.Selection.ShapeRange.Line.Visible = msoTrue

.Selection.Font.Size=12

.Selection.Font.Bold=False

.Selection.TypeText "AUTH: " & Auth

 

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 540,82,230,20).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Select

.Selection.ShapeRange.Line.Visible = msoTrue

.Selection.Font.Size=12

.Selection.Font.Bold=False

.Selection.TypeText Sheet & Rev

 

 

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 540,102,230,20).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Select

.Selection.ShapeRange.Line.Visible = msoTrue

.Selection.Font.Size=12

.Selection.Font.Bold=False

.Selection.TypeText "BY: " & Ucase(Programmer)

 

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 540, 122, 230, 20).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Select

.Selection.ShapeRange.Line.Visible = msoTrue

.Selection.Font.Size=12

.Selection.Font.Bold=False

.Selection.TypeText "MANUFACTURING REFERENCE ONLY"

 

 

'Load Graphic into textbox

'graphic= Replace(LCase(GetCurrentFileName), ".mcx", ".emf") '"J:datatetest.emf"

 

'Load Graphic into textbox

graphic="c:temppart.jpg"

'DoMetafile graphic

.Selection.ShapeRange.SelectThe

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 20,190, 650, 420).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Line.Visible = msoFalse

.Selection.InlineShapes.AddPicture "c:temppart.jpg"

 

 

'save word document to same directory as MC file

'saveworddoc= Replace(LCase(GetCurrentFileName()),".mcx",".doc")

saveworddoc = path & "NC51-" & Ucase(HeaderName) & ".doc"

'ShowString(saveworddoc)

.ActiveDocument.SaveAs saveworddoc

 

End With 'end output to word

 

 

If Not wordDoc Is Nothing Then Set wordDoc = Nothing

 

ShowString "Setup Sheet Finished"&vbNewLine&"file saved as "&saveworddoc

 

 

 

 

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

 

Public Sub PlyLine(yVal,strOutText)

With wordDoc

.ActiveDocument.Shapes.AddLine(510.0,yVal,580.0,yVal).Select

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 590,(yVal-15),200,20).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Select

.Selection.ShapeRange.Line.Visible = msoFalse

.Selection.Font.Size=12

.Selection.Font.Bold=False

.Selection.TypeText strOutText

End With

End Sub

 

Public Sub CoreSketch(yVal,strCoreText,strFoamText)

With wordDoc

.ActiveDocument.Shapes.AddLine(510.0,yVal,510.0,yVal+40).Select

.ActiveDocument.Shapes.AddLine(515.0,yVal+10,515.0,yVal+30).Select

.ActiveDocument.Shapes.AddLine(520.0,yVal,520.0,yVal+40).Select

.ActiveDocument.Shapes.AddLine(525.0,yVal+10,525.0,yVal+30).Select

.ActiveDocument.Shapes.AddLine(530.0,yVal,530.0,yVal+40).Select

.ActiveDocument.Shapes.AddLine(535.0,yVal+10,535.0,yVal+30).Select

.ActiveDocument.Shapes.AddLine(540.0,yVal,540.0,yVal+40).Select

 

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 550,(yVal),240,20).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Select

.Selection.ShapeRange.Line.Visible = msoFalse

.Selection.Font.Size=12

.Selection.Font.Bold=False

.Selection.TypeText "CORE " & strCoreText

 

If strFoamText <> "" Then

.ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, 550,(yVal+20),240,20).Select

.Selection.ShapeRange.TextFrame.TextRange.Select

.Selection.Collapse

.Selection.ShapeRange.Select

.Selection.ShapeRange.Line.Visible = msoFalse

.Selection.Font.Size=12

.Selection.Font.Bold=False

.Selection.TypeText "FOAM " & strFoamText

End If

End With

End Sub

Hope that helps guys,

 

Colin Gilchrist

The Boeing Company

Link to comment
Share on other sites

I'm glad I could help Henk. Creating a VB that builds a word document is a lot more work, but you get exactly the information you want in a custom format. It sounds like your requirements lean a little more to the X+ utilites. Do a search on the forum for "X+". The nice thing about Gunther's setup sheets is that you can customize the fields that you want to use from the operations. You can also configure several different styles of setup sheets and select the one you want from a list. You get options to create the setup sheets as HTML or Excell which is really nice. It also creates a graphic and loads it into the setup sheet automatically.

 

HTH,

 

Colin Gilchrist

The Boeing Company

MR2 and Beta test site

Link to comment
Share on other sites

Hello

 

I've uploaded my chook Utility on our web site.

the latest version is 1.03.

 

1. XMenu got the ability to run VBScript.

Menu text format is...

"menu text" RunVBS "file name of .vbs"

 

"VBS RunCommand.vbs" RunVBS "vbRunCommand.vbs"

 

2. some little fixes about uninitailizing the chooks.

 

Thanks

 

http://www.ai-sols.co.jp/eng/download/AI_Utility_1_03_en.exe

 

Should I open my own thread?? biggrin.gif

Link to comment
Share on other sites

quote:

I've uploaded my chook Utility on our web site.

the latest version is 1.03.

MasterShake,

 

The next time you update it, can you add the version number somewhere on this page too? That would be like the Help-About in other programs.

 

version.jpg

 

Thanks.

 

Thad

Link to comment
Share on other sites

OK smile.gif I'll do it.

and I have to make version checking feature to see if they are changed/fixed/updated.

 

Thank you.

 

OT:

I've also started learning C# ( nethook )from this month.

I made a nethook last weekend at home.

(nethookBuilder.zip on ftp..

it is a C# & VB.Net Compile utility, You can make nethook without visual studio.

when lerning C#, I've noticed there is Compiler function in .Net framework.

Please dont ask me about this nethook and C# language, coz I'm just started learning it.

 

 

And I'll be going busy from this week....

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