Hello Guest it is April 20, 2019, 11:00:07 PM

Author Topic: CAM Application for inside ProgeCAD or AutoCAD  (Read 2427 times)

0 Members and 1 Guest are viewing this topic.

Offline kf2qd

*
  •  123 123
    • View Profile
CAM Application for inside ProgeCAD or AutoCAD
« on: April 19, 2010, 05:52:11 PM »
I have been working on a simple CAM application that works in side ProgeCAD or AutoCAD. It is written in VBA and lets you pick a line or an arc and create the CNC code. By picking sequential entities and clicking the appropriate button it creates teh CNC code which you can then save to a file and run. Right now I am working on it in ProgeCAD Professional and I am planning to get it working under AutoCAD after I get a couple more features working. It is one step above manual - you just have a few buttons to click and the code it created 1 entity at a time. you can also enter lines manually for G & M codes and Z axis moves - It is primarily 2D at teh present, but I plan to do more as I develop it further.

I would like to get some feedback from others, so please post if this interrests you.

Pete

Offline ger21

*
  • *
  •  6,204 6,204
    • View Profile
    • The CNC Woodworker
Re: CAM Application for inside ProgeCAD or AutoCAD
« Reply #1 on: April 19, 2010, 07:03:07 PM »
Take a look at my AutoCAD VBA macro. Works in 2002 and up. Converts circles and polylines (2D and 3D). Multiple passes, ramping, bi directional cutting, circular pocketing. Lots of stuff. You can assign cutting depths and feedrates (and other options) to polylines and circles, and the info will be saved with the drawing. It can also use an entities Z value for the cutting depth. Allows a lot of flexibility.

I use it for at least 90% of my cutting.
Later this year I'm going to modify it to out put code for our Morbidelli router at work.

You can get it here.
http://tinyurl.com/yglfz3e

Let me know if you have any questions.
« Last Edit: April 19, 2010, 07:05:01 PM by ger21 »
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html

Offline ger21

*
  • *
  •  6,204 6,204
    • View Profile
    • The CNC Woodworker
Re: CAM Application for inside ProgeCAD or AutoCAD
« Reply #2 on: April 25, 2010, 06:41:04 AM »
From your other thread:

Quote
I will have to look into converting my VB code in my CAD program to produce incremental IJ.

In my macro, I use polylines instead of arcs, because then I only need to support 1 entity, instead of several. As any arc can quickly be turned into a polyline using PEDIT.

Here's some code I use for finding the incremental IJ locations, using the bulge of the polyline. "Retcoord" are the polyline vertices. I don't know if ProgeCAD has the "AnglefromXaxis" function, but it's easy to calculate if it doesn't.

pi = 4 * Atn(1) 'Define Pi

BulgeN = Ent.GetBulge(b - 1) ' Get Bulge of current coordinate
  
        ' Set G-Word based on Bulge value - G1, G2, G3
            
        If BulgeN = 0 Then
            GWord = "G1"
            ElseIf BulgeN < 0 Then
            GWord = "G2"
            ElseIf BulgeN > 0 Then
            GWord = "G3"
        End If
        
       ' Find Center of Arc
        
        If BulgeN <> 0 Then  'If Bulge is NOT zero
        
           ' First find chord of arc - pythagorean
            
            ChordL = Sqr((RetCoord(X) - RetCoord(X - 2)) ^ 2 + (RetCoord(y) - RetCoord(y - 2)) ^ 2)
      
            ' Set Start point of Arc as pt1 and End Point as pt2
            
            Pt1(0) = RetCoord(X - 2): Pt1(1) = RetCoord(y - 2): Pt1(2) = 0
            Pt2(0) = RetCoord(X): Pt2(1) = RetCoord(y): Pt2(2) = 0
      
            BulgeAngle = (4 * Atn(BulgeN)) * 180 / pi ' included angle - Convert from radians?
      
            r = Abs(ChordL / (2 * Sin((4 * Atn(BulgeN)) / 2))) ' Find Radius of Arc
      
            ReturnAngle = ThisDrawing.Utility.AngleFromXAxis(Pt1, Pt2)
      
      
           ' Find angle from Start point to Center Point
            
            AngleToCenter = ReturnAngle + (pi / 2 - (2 * Atn(BulgeN)))
      
           '  Find Center Point
            
            CenterPt = ThisDrawing.Utility.PolarPoint(Pt1, AngleToCenter, r)
            
            If GWord = "G3" Then
                ILoc = CStr(FormatNumber(Round(CenterPt(0) - RetCoord(X - 2), Precision), Precision, -1, 0, 0))
                JLoc = CStr(FormatNumber(Round(CenterPt(1) - RetCoord(y - 2), Precision), Precision, -1, 0, 0))
                Else 'G2
                ILoc = CStr(FormatNumber(Round(RetCoord(X - 2) - CenterPt(0), Precision), Precision, -1, 0, 0))
                JLoc = CStr(FormatNumber(Round(RetCoord(y - 2) - CenterPt(1), Precision), Precision, -1, 0, 0))
            End If
« Last Edit: April 25, 2010, 06:45:33 AM by ger21 »
Gerry

2010 Screenset
http://www.thecncwoodworker.com/2010.html

JointCAM Dovetail and Box Joint software
http://www.g-forcecnc.com/jointcam.html