Bullines
-
Posts
3,094 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Store
eMastercam Wiki
Blogs
Gallery
Events
Posts posted by Bullines
-
-
Any issues in using VS2010 and .NET 3.5 or 4.0 for Nethook development?
-
quote:can it move the entities to the correct level? ie. wireframe is level 100 puts all wireframe on level 100, surfaces level 200 puts all surfaces on leve 200.......is that easy to do?
Easy to do with the C-Hook and Nethook APIs. Not possible with the VBScript API as it only has access to basic wireframe entities (points, lines and arcs), and not other entities like surfaces and solids.
-
quote:also is the new c-hook colrsurf.dll working o.k.
Works fine for me in X MR1-SP2. If there's a problem, let me know. I know the developer really well
-
Does this portion in the script on your computer look exactly like this (excluding the debug messages)?
code:Set objFSO = CreateObject("Scripting.FileSystemObject")
' Make sure the file is actually there and bail if it isn't.If Not (objFSO.FileExists(DEF_CSV_FILE)) ThenobjFSO = NothingShowString("File not found!" & vbLf & vbLf & DEF_CSV_FILE)Exit SubEnd If
-
Do you get the "File Not Found" error before you get the runtime error?
-
Unprompted debug version it is, then:
code:Const DEF_CSV_FILE = "C:pathtoyourfile.csv"
Const DEF_FSO_FORREADING = 1Const DEF_UNNAMED_LVL = """""""."""""""' Kick off our scriptCall Main()' Purpose: The main subroutineSub Main()Dim objFSODim objTSDim strInLineDim arrTokLineShowString "Debug 1"Set objFSO = CreateObject("Scripting.FileSystemObject")ShowString "Debug 2"' Make sure the file is actually there and bail if it isn't.If Not (objFSO.FileExists(DEF_CSV_FILE)) ThenobjFSO = NothingShowString("File not found!" & vbLf & vbLf & DEF_CSV_FILE)Exit SubEnd IfShowString "Debug 3"Set objTS = objFSO.OpenTextFile(DEF_CSV_FILE, DEF_FSO_FORREADING, False)ShowString "Debug 4"' Read the CSV file line by line. For each line, make sure that it' contains a comma. If it does, tokenize on the comma into an array.' The first element is the level number and the second element is' the level name. Set the named levels based on what's in the array.Do While(objTS.AtEndOfStream <> True)strInLine = Trim(objTS.ReadLine)If (InStr(1, strInLine, ",")) ThenarrTokLine = Split(strInLine, ",")If Not (arrTokLine(1) = DEF_UNNAMED_LVL) ThenCall SetLevelName(arrTokLine(0), Trim(arrTokLine(1)))End IfEnd IfLoopShowString "Debug 5"' Close the CSV file. We're done with it.objTS.CloseShowString "Debug 6"' CleanupSet objFSO = NothingSet objTS = NothingShowString "Debug 7"' All done!ShowString ("All done!")End SubOf course you'll have to update the contents of DEF_CSV_FILE so that it matches the path to your CSV file on your computer.
-
Ah, the joys of debugging Mastercam VBScript. Line numbers would be nice, wouldn't they? Anywho, I have a hunch what it might be in your case, Pip, but give this a try:
code:Const DEF_FSO_FORREADING = 1
Const DEF_UNNAMED_LVL = """""""."""""""' Kick off our scriptCall Main()' Purpose: The main subroutineSub Main()Dim objFSODim objTSDim strCSVPathDim strInLineDim arrTokLineShowString("Debug 1")' Prompt the user for a CSV file. Bail if the user cancels' the dialog.If Not (AskForFileName("*.CSV", "r", strCSVPath)) ThenShowString("No file selected. Aborting.")Exit SubEnd IfShowString("Debug 2")Set objFSO = CreateObject("Scripting.FileSystemObject")ShowString("Debug 3")' Make sure the file is actually there and bail if it isn't.If Not (objFSO.FileExists(strCSVPath)) ThenobjFSO = NothingShowString("File not found!" & vbLf & vbLf & strCSVPath)Exit SubEnd IfShowString("Debug 4")Set objTS = objFSO.OpenTextFile(strCSVPath, DEF_FSO_FORREADING, False)ShowString("Debug 5")' Read the CSV file line by line. For each line, make sure that it' contains a comma. If it does, tokenize on the comma into an array.' The first element is the level number and the second element is' the level name. Set the named levels based on what's in the array.Do While(objTS.AtEndOfStream <> True)strInLine = Trim(objTS.ReadLine)If (InStr(1, strInLine, ",")) ThenarrTokLine = Split(strInLine, ",")If Not (arrTokLine(1) = DEF_UNNAMED_LVL) ThenCall SetLevelName(arrTokLine(0), Trim(arrTokLine(1)))End IfEnd IfLoopShowString("Debug 6")' Close the CSV file. We're done with it.objTS.CloseShowString("Debug 7")' CleanupSet objFSO = NothingSet objTS = NothingShowString("Debug 8")' All done!ShowString ("All done!")End SubRun this "debug" version of the script and let me know what the last debug number you see before you get that runtime error dialog.
-
quote:One thing that would make it AWESOME would be if it did not prompt at all.
Piece o' cake:
code:Const DEF_CSV_FILE = "C:pathtoyourfile.csv"
Const DEF_FSO_FORREADING = 1Const DEF_UNNAMED_LVL = """""""."""""""' Kick off our scriptCall Main()' Purpose: The main subroutineSub Main()Dim objFSODim objTSDim strInLineDim arrTokLineSet objFSO = CreateObject("Scripting.FileSystemObject")' Make sure the file is actually there and bail if it isn't.If Not (objFSO.FileExists(DEF_CSV_FILE)) ThenobjFSO = NothingShowString("File not found!" & vbLf & vbLf & DEF_CSV_FILE)Exit SubEnd IfSet objTS = objFSO.OpenTextFile(DEF_CSV_FILE, DEF_FSO_FORREADING, False)' Read the CSV file line by line. For each line, make sure that it' contains a comma. If it does, tokenize on the comma into an array.' The first element is the level number and the second element is' the level name. Set the named levels based on what's in the array.Do While(objTS.AtEndOfStream <> True)strInLine = Trim(objTS.ReadLine)If (InStr(1, strInLine, ",")) ThenarrTokLine = Split(strInLine, ",")If Not (arrTokLine(1) = DEF_UNNAMED_LVL) ThenCall SetLevelName(arrTokLine(0), Trim(arrTokLine(1)))End IfEnd IfLoop' Close the CSV file. We're done with it.objTS.Close' CleanupSet objFSO = NothingSet objTS = Nothing' All done!ShowString ("All done!")End SubChange the value of DEF_CSV_FILE, whcih stores the path to your CSV file, as needed.
HTH
-
I remembered another one. I don't know if he frequents the forum much anymore, but he later went by the name "DOSman". However, his original publicly displayed name was "C:" and that wrecked the forum. Looking back on it now, it was kinda funny how something as simple as that could dummy the forum software. I can just picture a bunch of references in the forum engine's code looking for stuff in the root of everyone's C drive and not finding it
-
There's no book available on VBS for Mastercam, per se, other than the API documentation that ships with Mastercam. However, there are plenty of good books available for VBS as it relates to Windows scripting. You could then easily apply that knowledge to writing scripts for Mastercam.
A possible good one for those not experienced in computer programming:
Microsoft WSH and VBScript Programming for the Absolute Beginner
O'Reilly publishes good "nutshell" books and here's an applicable one:
And online, MSDN is always great for reference:
http://msdn.microsoft.com/scripting/
Hope that's a start.
-
quote:Thanks Quiter
Harsh
-
...in your Mastercam scripts.
Create a sub such as:
code:Sub MakeArc()
End SubAnd you'll see Mastercam get mad. Call it MakeTheArc() instead and all is well.
Just something that popped up today.
-
With some clever scripting (and assuming you don't post in a weird way and you're NOT using X), then you could easily write a Mastercam VBS script to:
[*]post your file
[*]grab the location of your G-Code file
[*]generate a cmdfile.txt file to that contains login and upload commands
[*]execute the command-line FTP client that's included with Windows and pass it the cmdfile.txt that the script generated
A cmdfile.txt generated by your script might look like this:
open 192.168.1.10
your_username
your_password
cd programs
put 1234.nc
And when you have the script run the FTP client, you'd shell it out with a command-line string like this:
code:Dim strFTP
strFTP = "ftp -s: C:pathtoyourcmdfile.txt"Call ShellAndWait(strFTP, True)Otherwise, this can be done via a custom C-Hook or Nethook without needing the command-line FTP client.
-
Now that I think about it, there already is a script for that. If you still have V9 installed, take a peek in the VB subdirectory and look for a script called SETCOLOURSFROMLEVELS.vbs. It does exactly what you're asking.
-
I wrote a script that's on the FTP site called Z_Colours.vbs that assigns a colour for each unique depth. It can easily be altered to do the same for levels.
-
quote:Who will I bribe with beer to fix my computer?!
Shine the Moosehead logo in the clear night sky and I'm there like Batman
-
True enough, Quickmike. Outlook is a bit of a beast. On my notebook, Outlook 2003 uses 73MB of RAM, my OST is 374MB and I have an open PST file of archives that's 244MB. If I had a client-side spam filter (in addition to the basic one included with Outlook 2003), that would be a noticable performance hit when it touches my 374MB OST file each time email arrives. Solution? Don't save an email
quote:I think this decrease in performance is more related to the exchange server than outlook itself.What makes you think that? You're not running the mail server on your Mastercam workstation, are you?!?!?
-
Ok, I have a few:
[*]my first post on this forum
[*]Multax's stupidity...he had a wicked hate-on for James Meyette - example 1 and example 2. His over-eloquency and "Mr. Meyette" stuff were hilarious in a pitiful sort of way
[*]Dongless - Anyone remember that?
Refresher 1, Refresher 2 and Refresher 3. This guy pissed me off by spamming all our members. Using various techniques, I anonymously (fake usernames and IP spoofing) conversated with this guy via email and IM, got his cracking utility, discovered the location of both his website and himself, had him thinking I'd send him my HASP dump, and then left him hanging
[*]Alec: the CAD/CAM WaReZ FTP admin. Another one of these lamerz. Hop into the Wayback Machine. I did a similar thing with this guy to what I did with that Dongless guy. However, this guy wanted me to upload a copy of Art and the latest X beta. Instead of giving him what he wanted, I took a copy of Windows XP SP2, renamed the CAB file to "data1.cab", wrote an EXE called "setup.exe" that would email me a tonne of info about his computer and wrapped it up in a file called "mastercamx_rc1.zip". However, I spoke with the BSA before uploading this to his FTP site and was reprimanded by the BSA. The reason being that if any harm should come to his computer, I'd (and in turn In-House Solutions) would be liable. Still pretty funny though
There's plenty more of great memories but those are the first ones that I can remember.
-
quote:[ie setting filters for individual users]
Good filters should not require per-user filters.
quote:we only have one person here to deal with ALL computing and information management for 70-80 usersPoor guy.
-
quote:I think we switched over to our current setup to allow a little more in. I think my IT guy described it as a choice between high-performance / low functionality and lower performance / higher functionality.
Good server-side spam filtering software for Exchange should allow the administrator to deal with false-positives and pass them along.
Even better software allows the administrator (or even the users) to train the filter.
If that's the route your company will be going, then defragmenting your drive often would be a way to alleviate some of the sluggishness. You want your PST file to be in tip-top shape as much as possible.
-
quote:I am running Microsoft Outlook 2003 in cache mode from an Exchange Server[i have no idea what that actually means, but that's what the IT guy says]
It means that your email is stored locally on your computer once it's received by the Exchange Server. If your network connection drops, you'd still be able to access your existing email. On the other hand, if you were running Outlook in non-cached mode, email would always sit on your Exchange Server - if your network connection drops, you can't see any of your email.
I don't think the fact that you're running Outlook in cached mode directly impacts Mastercam's performance. However, if you have antivirus software and/or anti-spyware software and/or client-side spam filtering software, then that can cause quite the performance hit on your computer. The reason being, every time you receive email, all of this software would start scanning your email, causing that drive to thrash like a mutha.
A good plan of action? Here's what I'd do.
[*]Client computers have antivirus software installed
[*]Client computers have no antispyware installed. Teaching users about spyware, having good Internet policies, and system lock-downs are better and don't consume computer resources that Mastercam needs.
[*]Spam filtering should be done on the Exchange Server - not the client's computer
-
I think this thread belongs in the General Mastercam forum instead of the Developers' forum. Hold on everyone!
-
Thanks again, folks. CAM's banner-rasing was way kewl. Hopefully all of you will keep in touch - perhaps by commenting on my many misguided ramblings on my blog.
Watcher, In-House will find a replacement. And I'm sure whoever they find will rawk way more than I ever could. And you're right, Dave is rare - great great manager to work with.
-
quote:Before you go can you share some of your favorite MC Forum postings?
If I drank coffee, I'd put a pot of it on before I tackle this. Would beer do the trick?
quote:One of mine was You or Dave saying something like"Hey when you can play Fooze ball and smoke with skidoo gloves on" then you can tell me about cold weather.....Ga? Maybe I need to reduce the beer intake...or increase it.
I'll get back to you regarding my favourite moments
Visual Studio for Nethooks
in Mastercam C-Hook, NET-Hook and VBScript Development
Posted
Hi Roger,
I wasn't sure if only certain Fx versions were supported, as I didn't notice it in the Nethook documentation (and I'm sorely out of the Mastercam loop). If I'm able to target 3.5, then I'm good to go
And yup, it's me.