Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Pen Plotting with Rotating Tool (2.5 Axis) #61

Open
dhumpo opened this issue Jan 17, 2024 · 9 comments
Open

[QUESTION] Pen Plotting with Rotating Tool (2.5 Axis) #61

dhumpo opened this issue Jan 17, 2024 · 9 comments
Labels
discussion/idea General ideas/discussions enhancement New feature or request question Further information is requested

Comments

@dhumpo
Copy link

dhumpo commented Jan 17, 2024

I am designing a variable line width pen plotter with a rotating z axis. The line thickness is determined by the rotation of the marker tool. (perpendicular/90deg to tool path tangent = on/full width)

0001-0240.mp4

I am using Blender's geometry nodes to pre-visualize/design a variable line width plot. I'm then exporting as an indexed, 3 coordinate list. Below is a sample of the .ply data from Blender (X, Y, Rotation in Radians)

ply #concise coordinate in meters, x,y,rotation
format ascii 1.0
comment Created in Blender version 4.0.2
element vertex 9216
property float x
property float y
property float z #radians
element edge 9088
property int vertex1
property int vertex2
end_header
5.5847714e-08 1.8739383 0.676805 #first coordinate with rot value
0.014846257 1.8739147 0.67858016 #second...
0.029689893 1.8737563 0.6825235
0.04452504 1.8733462 0.68454605
0.05934261 1.8725877 0.6866971
0.074131355 1.8714039 0.6933933
0.08887847 1.8697386 0.702613
0.103570454 1.8675553 0.708761
0.118194 1.864838 0.7144503

I plan on building a CoreXY rig with a stepper at the head controlling marker rotation, converting that z coordinate into degrees rotation. Currently, I'm appending/replacing the z coordinate with the calculated rotation (based off of the sampled image/curve tangent) out of convenience. This format could change, it would just be a matter of appending the rotation value to one of the 3 color coordinates that .ply can also store. Whatever makes more sense for this implementation.

I don't have Excel and was reading the overview doc for the python implementation. Are there objects/templates that allow for the import of a coordinate list like the one above (or any indexed coordinate list, was using .ply as a debug) for it to be properly read by FC?

Additionally, curious how you all would approach the z-axis rotation. That would be messing with the FC design, as this plotter is a thing that does not factor in states associated with FDM. (working exclusively in travel paths, no layer heights, etc.). I am a complete python/scripting novice, so would appreciate a layman's response (if possible).

Thanks
dhumpo

@dhumpo dhumpo added the question Further information is requested label Jan 17, 2024
@fullcontrol-xyz
Copy link
Contributor

Comment copied from reddit:

Once you know your final implementation, I'll help you get set up in FullControl. It's very easy to import the data (using standard python functionality) and convert it into the appropriate data for FullControl/GCode (e.g. X Y ROTATION). As I said, I'll demo that once you know your setup. But following another comment to your post, if you choose to vary Z height, that will be different than if you use pen rotation. Both are very interesting options. There is some ongoing interesting in using FullControl for pen plotting, including previewing the path with correct widths and automatically generating paths from images, etc. So I'm keen to generalise any of the things you do as much as possible and make it useful for other people

In the quickest implementation, am I correct in thinking you need to import a csv file of lots of lines of "X, Y, ROTATION" and convert that to GCode? What is the format of the GCode? Does the letter Z in gcode need to change to another letter?

@fullcontrol-xyz fullcontrol-xyz added enhancement New feature or request discussion/idea General ideas/discussions labels Jan 20, 2024
@dhumpo
Copy link
Author

dhumpo commented Jan 20, 2024

That is correct. I plan on using GRBL firmware (or similar that would work on an Arduino shield). For readability/debug purposes, I think changing Z to r would be helpful.

As I've been developing the drawing tool in Blender, I realized the plotter should have some way of raising and lowering the marker. This is a secondary goal but wanted to include it in the discussion as well.

Because we've forfeited the z-axis, the design could be modified so that the printing/traverse states control a servo that raises the whole tool head (marker and stepper) perpendicular to the work surface. I can imagine this is a common design modification for plotters programmed with FC. Similar to the design below:

Screenshot 2024-01-20 090248

Best
dhumpo

@fullcontrol-xyz
Copy link
Contributor

I'd suggest you actually use a 4-axis version of FullControl. The rotation can be specified by the B rotation axis. Then you can either write the exact Z value you want for each point if you have a stepper motor controlling Z. Or if you have some kind of on/off servo for Z, you could design Z of each point to be 0 or 1, and then the gcode would be interpreted based on whether it has Z0 or Z1 written in the gcode line. Sound good?

@dhumpo
Copy link
Author

dhumpo commented Jan 22, 2024

From a hardware standpoint I like the sound of a binary servo.

There are some plotting designs that are not indexed nicely, unlike the design shown in the first post. In this case I would need to define the travel path (z servo on/1) in addition to the plot path, (servo off/0) correct?

Or would the FC design interpolate a travel vector between the end of one path, and the beginning of the next in the index sequence?

I'll make a quick animation to depict the indexing issue if what I'm describing this poorly.

@dhumpo
Copy link
Author

dhumpo commented Jan 22, 2024

house0001-0150.mp4

The white line is an animation of the plot path from index 0-600. When the plot path reaches the end of one segment would an FC design be able to interpolate a travel path to the beginning of the next segment?

I understand this sequence should run vertically down the work surface, and that this will antagonize plot times, but I've yet to determine a solution in Blender.

@fullcontrol-xyz
Copy link
Contributor

Yep that's all easy in FullControl. There can be a quick check for each new point, and whenever the x-value of a point is lower than the previous point, you know you're starting a new line and can automatically add these steps: move to Z1, move to next XY, move to Z0, continue through points. Alternatively, if you imported data included information about which lines are drawn and which are travel, that's even easier. It would also be possible, with a little bit of python magickery, to re-order the lines to run sequentially from top to bottom.

@dhumpo
Copy link
Author

dhumpo commented Jan 24, 2024

Ok great, I think that quick check will work fine. Drawing travel lines in Blender is possible but doesn't sound necessary with the solution you described.

The python magickery would be a similar check, reordering the group index of each segment by decreasing y value?

For example, an if loop looking for a negative change in the x value, and then sorting that group index (the line segment) by the y value of the first index in that group.

@fullcontrol-xyz
Copy link
Contributor

Yep exactly, I was thinking you'd split your large list into a series of smaller lists and then order them and potentially reverse them as required. There are lots of other ways to do it too. That's why we made FullControl use native python as much as possible to allow complete freedom during design.

@ES-Alexander
Copy link
Contributor

ES-Alexander commented Feb 23, 2024

Noting that if you calculate expected extrusion widths from the rotation angles within FullControl then it should be possible to visualise nicely with FullControl's plotting functionality (to make sure it's doing what you expect, and in case you want to generate paths in FullControl instead of always using Blender), potentially using a colour gradient to show the drawing order (since there isn't yet support for toolpath animation) :-)


For linking purposes, this Issue is relevant to #15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion/idea General ideas/discussions enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants