+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 11 to 16 of 16

Thread: CNC script for Datron M8 - under development

  1. #11

    CNC script for LinuxCNC

    Hello,

    I have written this attached script for using with LinuxCNC, formerly EMC2. I setup it for my machine, so I don't know how well it work for others. I have been testing it on and off with various cuts and seems to be holding up well.

    In the future I would like to add some more options, like choosing between CCW or CW arcs, and toggling dwell times on or off. Then maybe automate the generation of the tool path for the shortest path between objects, and to cut contours from inside to out. Right now it is setup for the user to select the objects in order of the cuts. If you use this script please be advised to look through the code and simulate your g-code before actually performing a cut.

    The one thing I would like to do is compound all the user inputs into one input box with multiple fields for variables, instead of a series of pop up windows. I am unclear on how to create an input box with multiple fields for variables. Any help would be greatly appreciated. Thanks.
    Attached Files

  2. #12
    Well, I just upgraded to Wenatchee 2012-08-07 (408) on OS 10.8, and now I am receiving errors with my script.

    -------------------------------------------------------
    Message: unable to convert 71a340a5-e0d0-44f2-ac0a-c4e41a838d28 into Curve geometry

    Traceback:
    line 538, in coercecurve, "/Users/x/Library/Application Support/McNeel/Rhinoceros/MacPlugIns/IronPython/settings/lib/rhinoscript/utility.py"
    line 2017, in IsPolyline, "/Users/x/Library/Application Support/McNeel/Rhinoceros/MacPlugIns/IronPython/settings/lib/rhinoscript/curve.py"
    line 73, in Gcode2d, "/Users/x/Library/Application Support/McNeel/Rhinoceros/Scripts/MyCommands/Gcode2d.py"
    line 134, in <module>, "/Users/x/Library/Application Support/McNeel/Rhinoceros/Scripts/MyCommands/Gcode2d.py"
    -------------------------------------------------------

    Any help with these errors would be great! Seems to be with a problem with points. I am not sure if it is a problem with my script or with Rhino.
    Last edited by loboy; 08-11-2012 at 06:08 PM.

  3. #13

    Fixed the problem

    Well, I fixed the problem, and it was simple formatting error. Here is the revised script.
    Attached Files

  4. #14
    Can someone please advise me as to the best way to iterate through all the segments of a PolyCurve? I am having some trouble understanding the syntax for getting at the segment index of a polycurve.

  5. #15
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    286
    Hi,
    I don't know what you want to do with the segments, there aren't really Rhinoscriptsyntax methods for getting at the subcurves without actually exploding the curve (which you can of course do).

    With RhinoCommon, it is possible to access the geometry of the subcurves without actually exploding the original and adding the subcurves to the document:
    python Code:
      import rhinoscriptsyntax as rs
      import Rhino,scriptcontext
       
      crvID=rs.GetObject("Select Polycurve",4,True)
      crv=rs.coercecurve(crvID)
      segs=rs.PolyCurveCount(crvID)
       
      #to get a list of subcurves (not added to document!)
      subcurves=[Rhino.Geometry.PolyCurve.SegmentCurve(crv,i) for i in range(segs)]
      #to add the list of curves to the document as individual objects
      for i in range(segs):
          scriptcontext.doc.Objects.AddCurve(subcurves[i])
    --Mitch

  6. #16
    Thanks for the advice Mitch.

    I ended up exploding the polycurve and dealing with it from there. I just wasn't sure if that was the most efficient, elegant solution.

+ Reply to Thread

Tags for this Thread

Posting Permissions

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