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:

keqian

Verified Members
  • Posts

    13
  • Joined

  • Last visited

keqian's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi, I wrote a VB program to automatically chain the contour with leadin and leadout values. In the program, I give the values of the leadin and leadout values for both lines and arcs. After running & chaining a contour, I see, from the "Operation Manager", that it only takes in the values for lines and also Arcsweep, but no ArcRadius (which remain zero no matter what I do, even if I give a specific value like, Leadin.ArcRadius =.1). Can anybody point out if there is something wrong in my program or there is a bug in VB that prevents it importing the ArcRadius value. To test, make a chain on any lines or closed shape and check the result in "Operations Manager". When done. double-click the "Parameters", and then click "leadIn/Out" to see if there is value in "Radius" part (should be non-zero). Thanks for helping Kevin Qian code: '------------------------------------------------ 'Apt_test Call Main() sub Main() Dim tool_dia Dim leadin dim leadout tool_dia=.3125 AskForChain("chain please") Set leadin = New McLeads leadin.Useline = 1 'Use a line For leading In/out leadin.LineLength = tool_dia/2 'leadin length leadin.LineTangent = 1 'Is the line Tangent Or Perpendicular? leadin.LineRampHeight = 0 'Height of lead In/out Line (defining a ‘ramp’) leadin.UseArc = 1 'Use an arc For leading In/out leadin.ArcRadius=tool_dia/2 'Radius of lead In/out arc, **** NOT WORKING, ArcRadius does not take any value **** leadin.ArcSweep = 1.57079633 'Angular sweep of lead In/out arc, 1.57079633 works out to be 90 degree leadin.ArcHelixHeight = 0 'Height of lead In/out Arc (defining a helix set leadout = new mcleads leadout.UseLine = 1 leadout.LineLength = tool_dia/4 leadout.LineTangent = 1 leadout.LineRampheight = 0 leadout.UseArc = 1 leadout.ArcRadius=tool_dia/4 'Radius of lead In/out arc, **** NOT WORKING **** leadout.ArcSweep = 1.57079633 leadout.ArcHelixHeight = 0 Call SetEntry(0,0,leadin) '1st zero for mid pt of contour, 2nd zero for overlap Call SetExit(leadout) Call MakeContour("",tool_dia,0,0,mctool_flat,mcCUTTER_COMP_LEFT,mcCUTTER_ROLL_SHARP,100) end sub '-------------------------------------------------------
  2. I installed the MU1 and the VB drill program worked great. Thanks
  3. Hi, I copied and pasted your codes into my X4 and ran it. Nothing happened. I tried to find out what command "RunFTcommand" is in the VB help but I cannot find it. Then I blanked above line and add a new statement: "MakeContour". It generate a chain in the Operation Manager Box. Below are the codes, Call Main() Sub Main() Dim result, result1, prev_result1 Dim id ' open the chain manager result = AskForChain("test") result1 = GetEntityEptr() ' go through all the elements in the chain and save them in the geomtry group "TEST" ' when previous EntityEptr is different than current EntityEptr ' it means that I have not reach the and of chain yet While result1 <> prev_result1 prev_result1 = result1 result1 = AddCurrentEntToGroup("TEST") result = MoveForwardOnChain() result1 = GetEntityEptr() wend 'Call RunFTCommand("MASTERCAM", "SelectAllMask") ' this one is not working id=MakeContour("",0,0,1,mctool_flat,mccutter_comp_left,mccutter_roll_none,80)' End Sub Try yourself and see if it is what you need. Thanks Kevin
  4. That is good to know, at least I don't need to put more effort to solve it. Could you please tell me approx. when X4 MU1 will be available to end users? Thanks. Kevin
  5. Mick, I uninstalled and reinstalled X4 many times, but this problem persisted. I don't know why. Ihe above VB program does nothing in X4. I also tried to match my X4 config to that of X2 as close as possible but to no avail. Thanks Kevin
  6. Hi, I wrote a VB program for automatic drilling points on the screen a while ago. It worked fine with X2. But when I recently changed over to X4, it does not generate any drill operation in the toolpath operation manager when running above program. I tried to debug the problem and finally narrowed down the problem to one VB statement, "MakeDrill" I attatch a simplified VB code. See if anyone can help me find why it does not work in X4. 'Start Call Main() Sub Main() Dim OperationID Call ZeroPts 'Clear any existing point data from the drill list Call AddDrillPoint(1.0,2.0,3.0) 'Add this point to the list for drilling OperationID = MakeDrill ("", 0, 118, 1, mctool_drill) 'Apply drilling and return an operation Id End Sub ' End of Program. In MakeDrill statement, I leave 1st string para. empty "", 0 for 2nd parameter for auto searching for tool, 118 (tip angle) for the 3nd parameter, 1 for the fourth para. (tool #1) and mctool_drill for the final para. for regular drill style. Again it works in X2 but not in X4. In X2, it makes a drilling operation in Operation Manager and make a point on screen at location X1.0,Y2.0, and Z3.0 Thnaks Kevin Qian
  7. I try to write a VBScript file to automatically select and drill some points on screen. Let say there are 4 points (grey color) drawn on Mastercam screen and I like to use dia .250 drill to drill them. I attatched program below. The program seems working. But there is a major flaw: After running it, it duplicate the existing points on screen at all the points' location. and the Drilling Operations in the Operations Manager is associated with the new points created. I want the dirlling association to go with the original points on the screen and do not want any extra points. I kind of understand the reason. It must unintensionally created the new points when the program try to get the points' x,y,z coorditions in order to add necessary data to function, "AddDrillPoint". But that is only way I can think of select the points. Is any other way to select the points without creating new one? Maybe I can use function "SetEntityFromEptr()", but I don't know what Eptr mean. Thanks for helping me out. [ Call Main() Sub Main() Call DRILL250() End Sub 'END OF MAIN SUB '''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub DRILL250() Dim intOperationID Dim new_pt Dim color_pt Dim pointer, pre_pointer 'these variables for stopping the points searching at the end of loop Call ZeroPts If StartDBSearch(mc_alive,mc_pointtype) Then 'Start searching point with grey color End If Set new_pt = New McPt If GetPointData(-1, new_pt) Then ' Get the coordinates of a current active point entity End If pointer=GetEntityEptr() color_pt = GetEntityColor() If color_pt = 7 Then Call AddDrillPoint(new_pt.x, new_pt.y, new_pt.z) End If Do ' do while loop for searching all grey points and add them to drill list pre_pointer = pointer If NextDBSearch() Then End If pointer=GetEntityEptr() If GetPointData(-1, new_pt) Then End If color_pt = GetEntityColor() 'Get the color of the current active entity If color_pt = 7 Then Call AddDrillPoint(new_pt.x, new_pt.y, new_pt.z) End If Loop While ( pointer <> pre_pointer) SetDrillSortMethod(mcsort_xzmym) intOperationID = MakeDrill ("My Drill Toolpath", .250, 118, 1, mcTOOL_drill) 'Apply drilling and return an operation Id End Sub ] Thanks Kevin Qian
  8. Hi, Roger, Thanks for your insightful reply. I downloaded again the "NetHook2Example.zip" from your link. I loaded the program in the VS2005, referenced the "NetHook2_0.dll" and re-assign the "build path" directly under McamXchook. Then I built the project, fired up Mastercam and run the NetHook2Example.dll and Walla, It worked. I am glad it worked, but I don't think I did anything different from what I did before other than re set up the "NetHook2Example" from fresh. and reassign the "build path" to a different location (I used to built program into a Desktop folder). My "NetHook2_0.dll" has version of 1.0.2909.14326 and Run Time version of V2.050727. I laugh now that I fixated on 'SDK' which turns out has zero effect on running the program. I still have some questions that I likes to know, 1). It seems that NetHook2Example.dll generated will run every samples inside the project, from 1st sample to the last. Is there a way that I can build a .dll file which will run just one sub sample in it, such as "5.1-The pointGeometry Class". 2). If everything to do with Mastercam API is inside the single file "NetHook2_0.dll", how do I know what functions inside it that I can use to write my own program. Is there any Instruction/description booklet that will list each function and syntex for using them. Thanks again for your help Kevin Qian
  9. Hi All, I wrote VB script programs to simply tasks in Mastercam. But there are limitations in accomplishing the complex jobs. So I now try to use VS2005 (Professional version) to learn how to write and use dll files. Following suggestion in this forum, I started with sample project, "NetHook2Example", I loaded this project file in VS2005 and further open one of the example, "5.1 - The PointGeometry Class". Then I did all the steps mensioned in "Read Me First!!.txt". Then I click on menu "build", then click "build NetHook2Example". Ok, it did generate (2) files, "NetHook2Example.dll" & "NetHook2Example.pdb" in the folder ...NetHook2ExamplebinRelease. After that, I open my Mastercam, click on menu "Settings", "Run User Application", find and click above dll file (NetHook2Example.dll) and hope it will run. But instead, it pop up a message window: "The appropriate Mastercam .NET Support dll could not be found". I am at loss. I installed mastercam SDK under the Mastercam directory and I think VS2005 professional would intall all the required stuf needed. Can anyone tell why it did not run. The only thing I can think of that may cause problem is that I run Mastercam mill X2 Mr2 SP1 and SDK installed is for Mastercam X MR1 SP2. Are they not compatible. I am new to VS2005, but I studied "C" programming and "Basic" preogramming back in college iong time ago. I would appreciate greatly any insight in solving this problem. Thanks Kevin Qian Quality Forming
  10. Thanks Glenn, That is exactly the problem. I loaded the machine def. and it worked just fine. Now I am trying to modify the program such that it will automatically read hole locations on screen and drill them. Thanks again.
  11. Hi, I have X2 MR1 SP1. I tried to use VB to make a program that will automatically drill some points on screen. Here is the program. code: Call Main() Sub Main() Dim intOperationID Call ClearParameters() Call InitParameters() Call SetDepth(True, -1.0) Call ZeroPts Call SetPlaneNormal(0,0,0) Call AddDrillPoint(3,3,0) Call AddDrillPointToDepth(2,2,0,-.5) 'Apply drilling and return an operation Id intOperationID = MakeDrill ("My Drill Toolpath", 1/8, 118, 3, mcTOOL_DRILL) ' -- Success? If intOperationID > mcOPERATION_INVALID Then ShowString "We made a drill toolpath!" RunPointManager(intOperationID) RegenOp(intOperationID) End If ' -- Zoom All Call RepaintScreen(True) End Sub When I tried to run this, It give a MCVBSCRIPT error message: "Drilling not allowed in this product". I have MastercamX Mill Level 3 and MastercamX Five Axis. It seems it should work. I tested this same program on Mastercam 9, It worked. Can anybody give me some insight. Thanks

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