587,302 active members*
3,318 visitors online*
Register for free
Login
IndustryArena Forum > CAM Software > BobCad-Cam > V23 - Pocketing off the part: Easier way???
Page 3 of 3 123
Results 41 to 48 of 48
  1. #41
    Join Date
    Apr 2008
    Posts
    1577
    Quote Originally Posted by winaa View Post
    Thats nice SBC, how do i go about using your file?
    Just download the file attached above and unzip it to your the "Posts - Mill" folder for your version of BobCAD.

    Open an existing file with a pocket feature or make a new one.

    When you right click and select Edit on the feature, you should now have a new Tab marked "Adv. Posting". Only use the number of turns and the spiral radius value for now.

    You don't even need to recompute. Just change your Post Processor to "SPIRAL-POST-CLEAN.MillPst" and hit post.

    The code will not work on your machine yet but it should backplot if you have the Predator Backplot feature. When you find errors (and you will, I've spotted a few already) please post them.

  2. #42
    Join Date
    Apr 2008
    Posts
    1577
    I normally would have just posted an update but there was an awful error in the first one I posted. The original has been removed and there is a newer one in place.

    http://www.cnczone.com/forums/attach...3&d=1343346410

  3. #43
    Join Date
    Apr 2008
    Posts
    1577
    Rev2:

    -Supports CW or CCW arc moves
    -Supports Multiple Pockets
    -Supports Multiple Depths
    -Supports User Selected Start Point *New
    -Choose Arc start angle *New
    -Now works in V25 but only if you select a start point*

    NOTES:

    Just a reminder, the script ignores the pocket geometry (but so does BobCAD on occasion).

    The start angle is measured from the center to the start of the arc. So if your start angle is zero, the center of the arc will be in the negative X direction. At 90, the center of the arc will be in the negative Y, etc. I'm not sure if this is defined properly if in CW or CCW mode but you'll get the hang of it. If you play with it, you can get it to match the BobCAD spiral.

    The ramp angle still doesn't work yet. It's not that hard, I'd just like a cleaner way to deal with it.

    Anyone using it yet? It's almost to the point where it's not experimental anymore. I'm going to add it to my post shortly.

    *EDIT: Be careful using this with V25. In some circumstances BobCAD is doing something unexpected and it's throwing off the script. I tried to get around it but couldn't. If you select a start point, it fixes it most of the time.
    Attached Files Attached Files

  4. #44
    Join Date
    Mar 2012
    Posts
    1570
    Nice work SBC!




    Code:
    2005. Program Block 5 - Spiral Script
    
    	Dim comboArcSelection
    	Dim XCURR
    	Dim YCURR
    	Dim ZCURR
    
    	XCURR = MILL_GetXFeed()
    	YCURR = MILL_GetYFeed()
    	ZCURR = MILL_GetZFeed()
    
    	Call MILL_SetDoubleMemoryLoc(1,XCURR)
    	Call MILL_SetDoubleMemoryLoc(2,YCURR)
    	Call MILL_SetDoubleMemoryLoc(3,ZCURR)
    
    	comboArcSelection = MILL_GetUserSelectComboVariable(20)	'Read Spiral Arc combo box; 0 = No arcs, 1 = Arcs CW, 2 = Arcs CCW
    	
    Select Case comboArcSelection
    	Case 0
    		Call MILL_SetStringMemoryLoc(0,"SPIRALOFF")	'No Spiral arc selected
    
    	Case 1
    		Call MILL_SetStringMemoryLoc(0,"SPIRALON")	'Spiral arc selected,CW
    		Call MILL_SetStringMemoryLoc(1,"G02")
    	Case 2
    		Call MILL_SetStringMemoryLoc(0,"SPIRALON")	'Spiral arc selected,CCW
    		Call MILL_SetStringMemoryLoc(1,"G03")
    
    	Case Else
    		MsgBox("Unexpected Value for comboArcSelection")
    
    End Select
    
    '	MILL_OutputText("(<---DEBUG: XCURR = "&XCURR&" )")
    '	MILL_OutputText("(<---DEBUG: YCURR = "&YCURR&" )")
    '	MILL_OutputText("(<---DEBUG: ZCURR = "&ZCURR&" )")
    '	MILL_OutputText("(<---DEBUG: OffsetAmount = "&setupGetOffsetAmount&" )")
    '	MILL_OutputText("(<---DEBUG: Arc Radius = "&setupGetArcRadius&" )")

    Code:
    2007. Program Block 7.
    
    	Dim spiralNumTurns
    	Dim spiralRadius
    	Dim spiralStartAngle
    	Dim spiralRampAngle
    	Dim spiralDirection
    	Dim ZCurrent
    	Dim ZPrevious
    	Dim ZChanged
    	Dim ZStart
    	Dim ZEnd
    	Dim ZStep
    	Dim XCurrent
    	Dim YCurrent
    	Dim Counter
    	Dim SPIRALONOFF
    	Dim PI
    	Dim DEG2RAD
    
    	PI = 3.14159265358979
    	DEG2RAD = PI/180		'Multiplier to convert degrees to Radians
    
    'Read all the Advanced Posting Parameters from the 2D-POCKET feature
    	spiralNumTurns = MILL_GetUserEditIntegerVariable(14)
    	spiralRadius = MILL_GetUserEditRealVariable(16)
    	spiralStartAngle = MILL_GetUserEditIntegerVariable(17)
    	spiralRampAngle = MILL_GetUserEditRealVariable(18)
    	spiralDirection = MILL_GetStringMemoryLoc(1)
    
    'The script runs after all the BobCAD generated code for the spiral is done, we need previous values
    	ZPrevious = MILL_GetPreviousZFeed()
    	ZCurrent = MILL_GetZFeed()
    	XPrevious = MILL_GetPreviousXFeed()
    	YPrevious = MILL_GetPreviousYFeed()
    
    'This short code checks to see if the spiral is needed, eliminate spiral from the finish tool
    	ZStart = MILL_GetDoubleMemoryLoc(3)
    	If ZStart - ZCurrent = 0 Then	'If the second tool is posted, don't run the spiral
    		Call MILL_SetStringMemoryLoc(0,"SPIRALOFF")
    	End If
    
    'Check to see if the user activated the spiral or if the finish tool is posting
    	SPIRALONOFF = MILL_GetStringMemoryLoc(0)
    
    'If it is, run the spiral script
    	If SPIRALONOFF = "SPIRALON" Then
    		
    	'If Z has changed, the BobCAD linear Spiral is still active - wait until all Z moves are executed
    		If ZCurrent < ZPrevious Then
    			
    '			MILL_OutputText("(NC CODE SUPPRESSED BY SCRIPT - Z HAS CHANGED)")
    			
    		Else							'BobCAD spiral is done. Let's do the Arc spiral - then post the regular Arc move
    
    			ZEnd = ZCurrent						'Find the current Z depth
    			ZChanged = ZStart - ZEnd			'Compare it to Z start point
    			ZStep = ZChanged / spiralNumTurns	'Get the ZStep for the spiral
    			Counter = 0							'Initialize counter
    
    	'Establish the arc move variables
    			XPrevious = MILL_MakeRealString(XPrevious)
    			YPrevious = MILL_MakeRealString(YPrevious)
    			ICenter = MILL_MakeRealString(spiralRadius*Cos(spiralStartAngle*DEG2RAD))*-1
    			JCenter = MILL_MakeRealString(spiralRadius*Sin(spiralStartAngle*DEG2RAD))*-1
    			Call MILL_ProcessPostLine("n,'(WARNING-CODE CHANGED BY SCRIPT)'")
    
    			Do While Counter < spiralNumTurns
    				Counter = Counter + 1		'Increment the counter
    				ZStart = ZStart - ZStep		'Increment Z
    				Call MILL_ProcessPostLine("n,'"&spiralDirection&" X"&XPrevious&" Y"&YPrevious&" Z"&MILL_MakeRealString(ZStart)&" I"&ICenter&" J"&JCenter&"'")
    			Loop
    
    	'All the arc moves should be done, turn off the script and reset the counter back to 0
    			Call MILL_SetStringMemoryLoc(0,"SPIRALOFF")
    			Counter = 0
    			Call MILL_ProcessPostLine("n,'(WARNING-END SCRIPT OUTPUT)'")
    	'Output the first move of the pocket
    			Call MILL_ProcessPostLine("n,'G01 'feed_move,x_f,y_f,z_f,feed_rate")
    
    		End If
    	Else
    
    'Function is off, normal Block 55. post line
    		Call MILL_ProcessPostLine("n,feed_move,x_f,y_f,z_f,feed_rate")
    
    	End If

    Code:
    2008. Program Block 8.
    
    		Call MILL_SetStringMemoryLoc(0,"SPIRALOFF")
    '		MILL_OutputText(MILL_GetStringMemoryLoc(0))

    Code:
    2009. Program Block 9.
    
    	Dim spiralNumTurns
    	Dim spiralRadius
    	Dim spiralStartAngle
    	Dim spiralRampAngle
    	Dim spiralDirection
    	Dim ZCurrent
    	Dim ZPrevious
    	Dim ZChanged
    	Dim ZStart
    	Dim ZEnd
    	Dim ZStep
    	Dim XCurrent
    	Dim YCurrent
    	Dim Counter
    	Dim SPIRALONOFF
    	Dim PI
    	Dim DEG2RAD
    
    	PI = 3.14159265358979
    	DEG2RAD = PI/180		'Multiplier to convert degrees to Radians
    
    'Read all the Advanced Posting Parameters from the 2D-POCKET feature
    	spiralNumTurns = MILL_GetUserEditIntegerVariable(14)
    	spiralRadius = MILL_GetUserEditRealVariable(16)
    	spiralStartAngle = MILL_GetUserEditIntegerVariable(17)
    	spiralRampAngle = MILL_GetUserEditRealVariable(18)
    	spiralDirection = MILL_GetStringMemoryLoc(1)
    
    'The script runs after all the BobCAD generated code for the spiral is done, we need previous values
    	ZPrevious = MILL_GetPreviousZFeed()
    	ZCurrent = MILL_GetZFeed()
    	XPrevious = MILL_GetPreviousXFeed()
    	YPrevious = MILL_GetPreviousYFeed()
    
    'This short code checks to see if the spiral is needed, eliminate spiral from the finish tool
    	ZStart = MILL_GetDoubleMemoryLoc(3)
    	If ZStart - ZCurrent = 0 Then	'If the second tool is posted, don't run the spiral
    		Call MILL_SetStringMemoryLoc(0,"SPIRALOFF")
    	End If
    
    'Check to see if the user activated the spiral or if the finish tool is posting
    	SPIRALONOFF = MILL_GetStringMemoryLoc(0)
    
    'If it is, run the spiral script
    	If SPIRALONOFF = "SPIRALON" Then
    		
    	'If Z has changed, the BobCAD linear Spiral is still active - wait until all Z moves are executed
    		If ZCurrent < ZPrevious Then
    			
    '			MILL_OutputText("(NC CODE SUPPRESSED BY SCRIPT - Z HAS CHANGED)")
    			
    		Else							'BobCAD spiral is done. Let's do the Arc spiral - then post the regular Arc move
    
    			ZEnd = ZCurrent						'Find the current Z depth
    			ZChanged = ZStart - ZEnd			'Compare it to Z start point
    			ZStep = ZChanged / spiralNumTurns	'Get the ZStep for the spiral
    			Counter = 0							'Initialize counter
    
    	'Establish the arc move variables
    			XPrevious = MILL_MakeRealString(XPrevious)
    			YPrevious = MILL_MakeRealString(YPrevious)
    			ICenter = MILL_MakeRealString(spiralRadius*Cos(spiralStartAngle*DEG2RAD))*-1
    			JCenter = MILL_MakeRealString(spiralRadius*Sin(spiralStartAngle*DEG2RAD))*-1
    			Call MILL_ProcessPostLine("n,'(WARNING-CODE CHANGED BY SCRIPT)'")
    
    			Do While Counter < spiralNumTurns
    				Counter = Counter + 1		'Increment the counter
    				ZStart = ZStart - ZStep		'Increment Z
    				Call MILL_ProcessPostLine("n,'"&spiralDirection&" X"&XPrevious&" Y"&YPrevious&" Z"&MILL_MakeRealString(ZStart)&" I"&ICenter&" J"&JCenter&"'")
    			Loop
    
    	'All the arc moves should be done, turn off the script and reset the counter back to 0
    			Call MILL_SetStringMemoryLoc(0,"SPIRALOFF")
    			Counter = 0
    			Call MILL_ProcessPostLine("n,'(WARNING-END SCRIPT OUTPUT)'")
    	'Output the first move of the pocket
    			Call MILL_ProcessPostLine("n,g_arc_move,g_arc_plane,x_f,y_f,z_f,arc_center,feed_rate")
    
    		End If
    	Else
    
    'Function is off, normal Block 64. post line
    		Call MILL_ProcessPostLine("n,g_arc_move,g_arc_plane,x_f,y_f,z_f,arc_center,feed_rate")
    
    	End If

    Code:
    COMBO_BOX,21,No (Standard Output),Yes CW (Experimental),Yes CCW (Experimental)
    TEXT_LABEL,21,Use Spiral with Arcs?
    DEFAULT_COMBO_INDEX,21,0
    
    EDIT_BOX,15,INTEGER
    TEXT_LABEL,15,NUMBER OF TURNS
    DEFAULT_REAL,15,5
    
    EDIT_BOX,17,REAL
    TEXT_LABEL,17,ARC RADIUS
    DEFAULT_REAL,17,0.2500
    
    EDIT_BOX,18,INTEGER
    TEXT_LABEL,18,START ANGLE
    DEFAULT_INTEGER,18,0
    
    EDIT_BOX,19,REAL
    TEXT_LABEL,19,RAMP ANGLE*(Future use)
    DEFAULT_REAL,19,0
    Al DePoalo
    Partner Product Manager BobCAD CAM, Inc. 866-408-3226 X147

  5. #45
    Join Date
    Apr 2008
    Posts
    1577
    Thanks Al! I'm a little rusty on the scripting but it's coming back.

    BobCAD's scripting ability is awful handy.

  6. #46
    Join Date
    Nov 2010
    Posts
    0
    Quote Originally Posted by SBC Cycle View Post
    Rev2:

    -Supports CW or CCW arc moves
    -Supports Multiple Pockets
    -Supports Multiple Depths
    -Supports User Selected Start Point *New
    -Choose Arc start angle *New
    -Now works in V25 but only if you select a start point*

    NOTES:

    Just a reminder, the script ignores the pocket geometry (but so does BobCAD on occasion).

    The start angle is measured from the center to the start of the arc. So if your start angle is zero, the center of the arc will be in the negative X direction. At 90, the center of the arc will be in the negative Y, etc. I'm not sure if this is defined properly if in CW or CCW mode but you'll get the hang of it. If you play with it, you can get it to match the BobCAD spiral.

    The ramp angle still doesn't work yet. It's not that hard, I'd just like a cleaner way to deal with it.

    Anyone using it yet? It's almost to the point where it's not experimental anymore. I'm going to add it to my post shortly.

    *EDIT: Be careful using this with V25. In some circumstances BobCAD is doing something unexpected and it's throwing off the script. I tried to get around it but couldn't. If you select a start point, it fixes it most of the time.
    I had a go with your post yesterday but for some reason could not get any spiral entry code.
    I click on Adv. Posting and added some data and left plunge entry in bobcad.
    but when I post I just get plunge entry using V24
    oh and i'm using bobcad in metric mode as that is what we use over here

  7. #47
    Join Date
    Apr 2008
    Posts
    1577
    Quote Originally Posted by winaa View Post
    I had a go with your post yesterday but for some reason could not get any spiral entry code.
    I click on Adv. Posting and added some data and left plunge entry in bobcad.
    but when I post I just get plunge entry using V24
    oh and i'm using bobcad in metric mode as that is what we use over here
    Make sure that in the "Leads" area of the pocket feature that you use "Spiral" for the entry code, not plunge or ramp. It doesn't matter (yet) what ramp angle or number of turns you enter on that page, they are ignored for now. You just want to make sure you have some kind of ramp entry, not a single plunge or the script won't be triggered.

    Basically, the script is looking for BobCAD's spiral (all the tiny XYZ moves) and replacing it with arcs. If the spiral isn't there to begin with, it won't have one later.

    It's the only way I could get it to work consistently. I'll try to make a short video later if that would help.

  8. #48
    Join Date
    Apr 2008
    Posts
    1577
    I made a short video as an example of how I would use it.

    Rules:

    The Advanced Posting page will only become available if you have selected the SPIRAL-POST-CLEAN.MillPst as your post processor. You can do this on old files with no harm as long as you don't use any scripts currently (most people don't). You can switch back to your regular post and the Advanced Posting page will not appear again and your program will post for your machine normally. If you ever switch pack to SPIRAL-POST-CLEAN.MillPst, all of your variables you set will still be saved with the file. It's important to know this, as this script is just for testing at the time being.

    Under "Roughing" tool you must select "Spiral" as your lead. That's the hardest thing to remember because it doesn't make any sense. It could probably be done differently, but I really wanted to make sure that it would only kick in if the user selected something other than "Plunge". (Small note, the script will kick in if you select "Ramp" also. FYI)

    Under the Adv. Posting tab, don't enter anything silly like "0" turns or a "0" radius, it will just crash. I might do something to throw a message box if something accidental like that happens but in general this is still very rough and thrown together on the fly.

    Spiral ramp angle is not functional. Looking for ideas on how this can be implemented. I don't want to get side tracked on it until I'm fairly sure this whole thing works though.

    Other than that, fairly self explanatory.

    TIPS -

    Use a Spiral Radius value less than the radius of the cutter to clear all material, no "Island" left in the middle

    The feed rate of the spiral arc move is the same as the Z plunge feed rate for the Rough tool in the pocket feature. It is still independent of the XY feed moves.

    PRO TIP -

    Use a very large Spiral Radius value to slug out a hole. Select a start point a safe allowance from the edge of the hole (allowance should be at least the radius of the tool + the side allowance) and set the Spiral Radius value equal to the distance from the start point to the center of the hole. Make sure your depth is great enough to punch all the way through the part, you need to add one more turn and add to the depth a bit to cut the slug all the way through. The rest of the pocket will cut air but those lines can be edited out.

    See the attached file for an example. V24 Build 546. I can't make a V23 file on this computer.

    SPIRAL-ARC-ENTRY - RTMachine's library
    Attached Files Attached Files

Page 3 of 3 123

Similar Threads

  1. Replies: 6
    Last Post: 04-30-2010, 01:55 AM
  2. There has GOT to be an easier way!?
    By HackMax in forum Benchtop Machines
    Replies: 19
    Last Post: 08-28-2009, 04:39 PM
  3. New easier CNC sulotion
    By roctech in forum Commercial CNC Wood Routers
    Replies: 1
    Last Post: 06-29-2009, 04:42 AM
  4. Which is better, easier?
    By dpmulvan in forum DIY CNC Router Table Machines
    Replies: 1
    Last Post: 10-31-2007, 05:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •