PDA

View Full Version : Point3D to coordinates



aalto
05-08-2010, 05:21 PM
Dear all,

I am a beginner and as of now I am trying to use snippets of the provided samples and Steves code to get a better grasp on how to solve things with Python.

In the included script, a command is registered which divides a curve into points. The goal would be to generate a mcr file to drive a CNC mill , going from one point to another.

Point = rhinoscript.curve.EvaluateCurve(CurveId, param)

gives me a Point3D object that I cant find any documentation on. What I need is a list of coordinates, which will then be collected inside another list, "output", that can be used to generate the mcr file.

Bonus question (i.e. the next problem I know I am going to run into...):

What approach inside Rhino would be best if my goal is to generate a text string, with linebreaks, and to output this into a file as ASCII?

All the best,

Aalto

aalto
05-08-2010, 06:11 PM
I got the first part sorted, I entirely forgot that the first item in a list is 0, not 1, which of course resulted in an error.

The next step would be to extract the final point of the curve and add it to the list.

Perhaps a good solution would be to generate lines between the points to illustrate the actual toolpath for visual inspection.

Perhaps someone would point me to a a sample of how to make a dialog pop up that has several options included. My thoughts would be to make a single window where you could adjust things such as tool number, RPM, feed and other parameters that only need to be collected as integers from the user. This info would eventually be included in the header of the file to prep the CNC machine.

again, thank you.

aalto
05-09-2010, 10:24 AM
Latest iteration of the script, now outputting mcr code (the AXYZ commands in the command window).

No doubt there is a need to clean up the code quite a bit and comment better, as well as getting rid of all the print statements that are unnecessary.

Still interested in hearing how to include several options into a single dialogue to collect user input on feed, rpm and such. Also, now thinking that it should be able to preselect a curve and select multiple curves as well.

Also, currently the milling is done from the end of the curve to the beginning, perhaps unintuitive, should be easy to fix.