Full Version: ArcCAM
Show messages:
1-12
13-32
33-52
53-72
73
From: probotix
>> Where are you based ?
We are in Fort Walton Beach, Florida... the good part of Florida. ;-)
>Len
From: stefano (LIGHTWAVE)
Wasn’t aware of that side of Florida Looks like a nice place to build machines and go surfing sometimes.
Curious what version of coreldraw you use ?
From: Michael Gibson
Hi probotix,
re:
> One thing I had to do that took me a couple of days to figure out was how to
> identify whether can arc was clockwise or counterclockwise.
If you get 3 distinct points on the arc (on a circle don't get start/mid/end because start and end are the same), you can then calculate the signed area of the 2D triangle which will be negative for clockwise order, positive for counter-clockwise.
Script code for calculating this is here:
http://moi3d.com/forum/index.php?webtag=MOI&msg=11521.42
re:
> Also, is there a way (I could not find a script) to explicitly set the start point of a curve?
Do you mean only moving just the start control point which will mutate the shape of the curve?
Or do you mean moving the whole curve keeping its shape but positioning it so that it's start point is at the given point?
- Michael
From: probotix
I mean on a closed curve (polyline, poly-line-arc), being able to set the start point to any point I pick. I can already use OrderCurves to change the direction, but I want to be able to set the start point as well.
>Len
From: Michael Gibson
Hi Len,
re:
> I mean on a closed curve (polyline, poly-line-arc), being able to set
> the start point to any point I pick.
Do you mean like this ChangeClosedCurveSeam script:
http://moi3d.com/forum/index.php?webtag=MOI&msg=10125.8
- Michael
From: probotix
Looks like that does what I need. Thanks!
>Len
From: probotix
Couple of other questions...
How can I access object user text? Can it be set for individual segments?
Is there a moi.filesystem.setSavePath to choose directory to save files in if I want to have the user enter the file name in a text dialog? This would enable creating multiple files from multiple curves in a single operation, and it would make it easier for the user to specify the filenames that get embedded into the text of the gcode files of certain controls systems, ie Haas.
>Len
From: Michael Gibson
Hi Len,
re:
> How can I access object user text?
From the UI it's under Details... > Object user text.
From script:
.setUserText( Key, Value ); - Set text value for given key.
.getUserText( Key ); - Returns text value for given key, or undefined if not present.
.removeUserText( Key ); - Remove user text value for given key.
.getAllUserText(); - Return list of all user text, each object has .key and .value properties.
.clearAllUserText(); - Clear all object user text.
> Can it be set for individual segments?
No, not really. You can set it on a segment but it won't show up in the UI and it won't get persisted. It's meant to go on the curve.
> Is there a moi.filesystem.setSavePath to choose directory to save files in if I want to have
> the user enter the file name in a text dialog?
There's moi.filesystem.getSaveFileName() if you want to get a file name from the user, like this:
var filename = moi.filesystem.getSaveFileName( 'Text file name', 'Text files (*.txt)|*.txt' );
If you want to get a directory name from the user instead of a file name, in v5 there is moi.filesystem.getDirName(),like this:
var dir = moi.filesystem.getDirName( 'Dialog caption', 'c:\\initpath' );
returns empty string if canceled.
- Michael
From: Mik (MIKULAS)
Hi Len,
>So I am eager to keep my workflow inside of Moi as much as possible.
Me too :-)
... therefore I think that it's excellent idea to have CAM plugin inside MoI.
I think over to purchase some CNC machine (laser, router), but one of the BIG thing, which brake down my decision is potential problem with CAM sw and not enough time to find out the source of problem :-)
CAM plugin tuned for MOI + MOI = reliable CNC workflow for everybody :-)
Thank you .
Mik
From: probotix
This works:
usertext = curves.item(i).getAllUserText();
for ( var u = 0; u < usertext.length; u++ )
{
alert( usertext.item(u).key + " => " + usertext.item(u).value + "\n");
}
Thanks Michael!
>Len
From: stefano (LIGHTWAVE)
hi len - had a look at your website looks interesting...this new Linux-CNC product of yours (in the making)...
Is it going to be touchscreen and totally compact or "industrial" like your other control boxes. Could
consider throwing MACH 3 out of the window - literally.
Cheers
Stefano..
From: probotix
Hey Stefano
Here is the teaser image for the new machine series that will come with the new touchscreen:
It will be offered in an ethernet based version for interfacing with the Mesa Electronics FPGA control cards, which we use in our new UnityE controllers. It will also be offered with 2x DB25 ports for interfacing with older parallel port based controllers. There will be options for 15" and 10" versions.
>Len
Image Attachments:
EX_series_teaser_deltoro.jpg
From: probotix
Michael,
Tried your suggestion for clockwise/counterclockwise, but it doesn't work because I need to know clockwise or counterclockwise from the direction of travel, not relative to absolute cartesian space.
code:
// DOESNT WORK
function isClockwise(k,l,m)
{
var XLK = l.x - k.x;
var XMK = m.x - k.x;
var YLK = m.y - k.y;
var YMK = m.y - k.y;
signed_area = 0.5 * (( XLK*YMK ) - ( XMK*YLK ));
if( signed_area > 0)
return 1;
else if( signed_area < 0)
return -1;
else
return 0;
}
var min = segment.domainMin;
var max = segment.domainMax;
var len = max - min;
var start = segment.getStartPt();
var midpoint = segment.evaluatePoint( min + (0.5 * len) );
var end = segment.getEndPt();
var clockwise = isClockwise( start, midpoint, end );
This below works for any arcs that are not 180 deg, but 180 degree arcs resolve to an arc angle of pi, so it doesnt know which direction to turn:
code:
// WORKS FOR ANY ARC THAT IS NOT 180 degrees (pi radians).
function isClockwise( p0,p1,c )
{
var pi = Math.PI;
var angle = Math.atan2(p0.y - c.y, p0.x - c.x) - Math.atan2(p1.y - c.y, p1.x - c.x);
if ( angle == 0 || angle == pi )
return 0;
else if ( angle > 0 && angle < pi )
return 1;
else if ( angle> pi )
return -1;
else if ( angle < 0 && angle> (pi * -1))
return -1;
else if ( angle < (pi * -1))
return 1;
}
var clockwise = isClockwise( segment.getStartPt(),segment.getEndPt(), segment.conicFrame.origin );
>Len
From: Michael Gibson
Hi Len,
re:
> Tried your suggestion for clockwise/counterclockwise, but it doesn't work because I need
> to know clockwise or counterclockwise from the direction of travel, not relative to absolute
> cartesian space.
Can you please post a .3dm file with an example arc that doesn't work?
Could you maybe describe a little more about what coordinate system you need to use if it isn't global coordinates?
- Michael
From: probotix
Michael,
I have posted the latest code with both isClockwise functions. You can choose which one on lines 178 & 179.
https://github.com/probotix/ArcCAM
With const DEBUG = true, you'll have to change the path to a hard coded log file on line 48.
Here is a file. There are several arcs that do not compute properly in this file in isClockwise2. Segments 3, 14, 20, 24, and 28 are all reversed.
In the original isClockwise all arcs are generated just fine, except segment 14, the 180 degree arc. If I split that arc into 2x 90s, it will generate fine, but I dont consider that a solution.
I use ncviewer to preview the tool paths:
https://ncviewer.com/
You can just paste into the text box and you can also step through each block line by line. I should note that ncviewer has a bug where it doesnt display 180 degree arcs at all. Ncviewer has other issues, too, like it cannot handle arcs that use I & J instead of R. Eventually I'll build a gcode preview script Moi, maybe where it throws it into a certain named group or different color.
>Len
Attachments:
x3.3dm
From: probotix
For the algorithm you suggested, I'm thinking maybe I could take the entry angle (tangent of the first point I think) and rotate the mid and end points to align with cartesian before doing the calculation.
BTW, I'm not worried about circles yet because they will be a completely different tool path, and Haas has a circular pocket op from center and radius.
>Len
From: Michael Gibson
Hi Len,
re:
> For the algorithm you suggested, I'm thinking maybe I could take the entry angle (tangent of the first point I think)
> and rotate the mid and end points to align with cartesian before doing the calculation.
The property of clockwise/counter-clockwise direction is invariant to 2D rotation.
It looks like you have a typo in the isClockwise2() function.
You have this:
code:
function isClockwise2(k,l,m)
{
var XLK = l.x - k.x;
var XMK = m.x - k.x;
>>> var YLK = m.y - k.y; <<<
var YMK = m.y - k.y;
signed_area = 0.5 * (( XLK*YMK ) - ( XMK*YLK ));
if( signed_area > 0)
return 1;
else if( signed_area < 0)
return -1;
else
return 0;
}
There is a typo in the line marked with >>> <<< , it should be
(from
http://moi3d.com/forum/index.php?webtag=MOI&msg=11521.42):
code:
var YLK = l.y - k.y;
- Michael
From: probotix
Michael,
Thanks! See that's why you make the big bucks. ;-)
>Len
From: probotix
Michael,
I'm getting a much better understanding of arcs in Moi, now. But I am puzzled by this behaviour.
Here is the starting arc.
In this next image, I add a point snapped to the midpoint of an arc, and it adds another control point instead and keeps the arc intact.
In this third image, I trim the arc using the orange line and it splits the arc, but the top half has only one control point while the bottom has two.
>Len
Image Attachments:
add_point.jpg
beginning_arc.jpg
trim.jpg
From: Michael Gibson
Hi Len, when you show edit points on a circle, ellipse, or arc curve the points you see are from an automatically rebuilt approximation curve.
That's so that if you edit the points you'll get a smooth curve and not get kinks at internal fully multiple knots.
But if the segment is an arc with only 3 control points (without any internal fully multiple knots) it won't do the automatic rebuild because editing those points won't produce a sharp kink. The upper segment in your 3rd image falls into this category.
> In this next image, I add a point snapped to the midpoint of an arc, and it adds another control
> point instead and keeps the arc intact.
One thing to note is after you have added the control point, the result will be a rebuilt general spline curve and not a precise arc anymore.
If you want to keep exact arcs then you shouldn't edit their control points, when you do control point manipulation it is assumed that you want to make a squishable smooth curve.
- Michael
Show messages:
1-12
13-32
33-52
53-72
73