Tag Archives: OpenSCAD

3D Printer Ashtar M: Moving XZ Frame (Moving Gantry), First Draft

Updates:

  • 2020/12/20: adding XZ arch option
  • 2020/12/14: initial post
Jon Schone: Moving Portal Mod

In April 2020 Jon Schone (@properprinting) showed a “Moving Portal” mod for his CR-10 – a Prusa i3 derivative – and I thought to adapt his approach as “Ashtar M” as moving XZ frame or moving gantry in CNC terms.

On a second thought, this approach makes only sense with larger beds, as the bed weight should exceed the weight of XZ frame and X carriage:

weight(XZ frame + X carriage) < weight(bed)

and as I compose my Ashtar 3D printer series with alu extrusions (beams) I can say:

weight(XZ frame) = beam X * 2 + beam Z * 2 + NEMA17 * 2
weight(bed) = X * Y

and it becomes here clear, the bed weight grows X * Y whereas XZ frame only (X + Z) * 2, but also 2* NEMA17 motors of the Z axis are part of the XZ frame.

Moving Portal / Gantry

A few still images of Jon’s YT video to look at some details of his approach:

First Draft

  • using solely 500mm 2020 alu extrusions (T-slot for general frame and XZ frame, V-slot for carriages: X beam, 2x Y beams)
  • trying to achieve 400x400x400mm build volume as close as possible, alike Ashtar C 38.40.36

Using for Y carriages existing vcarriage2 module with vcarriage2(width=100) to have it wide enough:

The two main new pieces required were connecting the Y carriage with the XZ frame:

  • Piece “A” outside ycarriage_xzframe_mount_a(): has to be printed with 0.1mm layer height in order to stay within the +/- 0.05mm tolerance, otherwise it will introduce tilt and stress on the Y carriage and cause long term damage – tricky part to print.
Adding side pieces “A” & “B”
  • Piece “B” inside ycarriage_xzframe_mount_b(): is quite elaborate already and should be functional, with the Y belt ends fastening with M3 screws and M3 nuts inserts, the belt endings will come out downward:

XZ Arch Option – Removing Lower X Beam

In order to gain some Z build space by lowering the print bed, I may reduce the XZ frame to an XZ arch:

Actual physical tests may reveal if it’s suitable to maintain overall geometrical integrity. Removing the lower X beam also reduces moving mass of the XZ arch/frame/gantry.

Pros

  • gain Z build space
  • reduce XZ gantry weight / inertia

Cons

  • decrease XZ gantry stability

Further Development

As I develop Ashtar M further, I will post updates on the blog here, and also keep documenting the current state at Ashtar M page.

That’s it.

3D Printer Ashtar M (Draft)

Status: just a draft

Ashtar M (Prusa i3 MG)
Ashtar M IDEX – Draft

Updates:

  • 2021/01/14: Option IDEX (Independent Dual Extrusion), early draft (not yet tested)
  • 2021/01/07: Y motor and shaft extension with Y pulley holder added
  • 2021/01/03: Z motor mounts added, Y carriage to XZ frame/arch pieces refined using rcube()
  • 2020/12/19: new “XZ Arch” option (removing lower X beam from XZ frame)
  • 2020/12/17: change X carriage, routing X belt inside 2020 alu extrusion
  • 2020/12/12: first drafts, just a skeleton, details still to be worked out

Introduction

Jon Schone (@properprinting) did a “Moving Portal” (MP) mod for his CR-10 in April 2020, and I thought to adapt his approach as “Ashtar M” as Moving Gantry (MG) using CNC terminology.

Instead to move the bed in Y axis to move the entire XZ frame or gantry – the rest of the Prusa i3 style printer remains the same.

Reducing Moving Weight

Ashtar M with Moving XZ frame using modular & parametric V-carriage

This variant only makes sense when the weight of the bed exceeds the weight of the XZ frame + X carriage, in order to reduce the moving weight as of inertia – so only for large(r) build volume this makes sense:

weight(XZ frame + X carriage) < weight(bed)

and as I compose my Ashtar 3D printer series with alu extrusions (beams) I can say:

weight(XZ frame) = beam X * 2 + beam Z * 2 + NEMA17 * 2
weight(bed) = X * Y

and it becomes here clear, the bed weight grows X * Y whereas XZ frame only (X + Z) * 2, but also 2* NEMA17 motors of the Z axis are part of the XZ frame.

The main differences of Ashtar M and Ashtar K:

Ashtar M (Prusa i3 MG)

  • static bed
  • 2x Y belts
  • 1x Y motor
  • 2x Y beams: V-slot 2020 alu
  • Y axis: 2x V carriages (each 3 wheels)
  • XZ frame is moving (do not add anything more)

Ashtar K (Prusa i3)

  • movable bed with simple sliders
  • 1x Y belt
  • 1x Y motor
  • 2x Y beams: T-slot 2020 alu
  • XZ frame is static (can hold filament, extruders etc)

Draft

For now I decided to use my V modules as Y carriages with width of 100mm vcarriage2(width=100) but actual tests are required how stable the moving XZ frame will be.

As you can see on the draft, I lose some build volume because I stack on top of the Y carriage instead within, but if I put the gantry / XZ frame between the Y carriage I need extra long X beams for the outer frame, and make it impossible to achieve uni-length design (same beam length for all); it’s all about balancing a compromise.

XZ Arch Option

The “XZ Arch” option is removing the lower X beam from the XZ frame, hence, extends Z build space as the print bed also goes lower – for now I moved the Y beams supporting the print bed on the lower framework, details how the print bed will be mounted not yet determined. The side piece “A” is a bit shorter, and side piece “B” is a bit more solid – the way the Y belt is fastened remains the same: Y belt ends come out downward, and are fastened with M3 screws & M3 nuts inserts.

Specifications

  • Build Volume: ~380x400x380mm
  • Frame: 10x 500mm 2020 alu profiles (XZ arch option)
    • 3x or 5x V-Slot 2020 (X, Y and optional Z axis)
    • 7x or 5x T-Slot 2020

Issues to Resolve

  • Y motor & Y pulley holder, likely using 6mm smooth or threaded rod as extender, resolved, details defined with 625ZZ bearings
  • print bed mounting with adjusting nobs to level bed
    • optional remove lower beam of the XZ frame and make it just a gantry, would allow to lower supporting bed beams (space for springs and nobs etc) – but might introduce weaker XZ gantry geometry
  • Y Carriage to XZ Frame mount: either combine the L shape of XZ frame, or have a separate piece to attach – that part likely is the most challenging to get right, using two pieces “A” and “B” to connect to XZ frame with Y carriage
    • resolved in theory, but in actual implementation it will be tricky, as the piece “A” aka ycarriage_xzframe_mount_a() will be printed flat, and quantized by layer height, but the thickness has to be very precise as +/- 0.05mm not to introduce any tilt on the Y carriage (it would damage the V module and/or V wheels and introduce wobble Y-wise), hence 0.1mm layer height required for piece ycarriage_xzframe_mount_a() mounted outside, and ycarriage_xzframe_mount_b() (◤-like piece) mounted inside:
  • Z motor mounts, resolved: how stable it is needs to be tested
  • cabels & bowden tube routing
    • XZ frame moves as well – lot of motion involved – likely not put bowden extruder motor on it and avoid to add additional weight again
    • cable chain to ensure it bends in a controlled manner
  • positioning: controller, display, power-supply, optional: filament holder
    • none of them can be put on the moving XZ frame anymore
  • tuning to common to build-volume with uni-length beams
    • likely 400x400mm build plate achievable, but perhaps 380×400 printable, losing 10-15mm on left- and right-hand side.
  • XZ frame vs XZ arch: to be determined if it’s essential with actual tests
  • build printer
  • print tests
  • release parts
  • release code

Bed

Ashtar K & M bed mounting

The bed is stationary, so it’s relatively simple, a bed carriage it still required so the fine level adjustment is possible with some knobs – using the same setup as for Ashtar K.

Gallery

Parts

Printable Parts

  • Y carriage:
    • 2x am_v_plate-2020-double-v-244-110-100w-a
    • 2x am_v_plate-2020-double-v-244-110-100w-b
    • 2x am_zmotor_mount
    • 2x am_ycarriage_xzframe_mount_a
    • 2x am_ycarriage_xzframe_mount_b
  • 1x am_ypulley_holder
  • 1x am_ymotor_mount or 2020_Y_motor_mount
  • 4x am_foot_hh

Non-Printable Parts

  • 2x 625ZZ bearings
    • 2x for 1x am_pulley_holder
  • nx pulleys (dimension not yet determined)
    • 2x (5mm hole) for 1x Y motor, 1x am_ypulley_holder
    • 1x (5mm hole) for 1x X motor
  • nx idlers (with 3 or 5mm hole)
    • 1x (3mm hole) for 1x X belt
    • 2x (3mm hole) for 2x Y belts
  • ~490-500 mm M5 smooth or threaded rod (Y shaft extension)

See the on-going blog-posts on Ashtar M development, with some more details than the overall page here.

IDEX Option

As Ashtar M shares much of Ashtar K design, the IDEX option comes easily – yet, adding a 2nd motor on the moveable XZ frame/gantry definitely pushes the limits of Ashtar M, significant forces will be applied at high Z positions while moving Y axis.

In order to run two independent printheads (Independent Dual Extrusion) following changes are needed:

Printable

  • 1 x xcarriage_short_hmount_motor_2020-endstop-idex-left
  • 1 x xcarriage_short_hmount_motor_2020-idex-right
  • 1 x xcarriage_beltmount_2020-idex
  • 1 x pulley_holder

Non-Printable

  • 1x Nema 17 42-45Nm (39-40mm height) with 1m wires
  • belt ~110cm GT2 6mm
  • 1 x pulley
  • 1 x idler

As soon I tested this option I will document it in more details, like electronics, changes in firmware, slicer settings etc.

References

3D Printer Ashtar B (Draft)

Status: just a draft

Ashtar B (Cantilever)

Updates:

  • 2020/12/23: added more details on Y bed, and size comparison, blog post published.
  • 2020/12/17: X motor mount done, X belt pulley holder, XZ cantilever x-offset 10mm.
  • 2020/12/12: just the basic idea, an early draft with a few options (extra foot, 3/4 wheels for Z carriage), 6 vs 7 vs 9 beams.

Introduction

Ashtar K was the first design with 2020 T-slot alu extrusions, and I used 11 beams of 500mm length to make up the entire frame. In the back of my mind I thought also doing a Cantilever 3D printer with 2020 T- or V-slot, like the Prusa Mini or Printrbot Simple Metal, and as before I like to reuse the frame as rails directly and not use any smooth rods or alike, which means X beam as V-slot, and optionally Z beam as well as V-slot, Ashtar B:

Draft

A build-volume of 140mm to 190mm each axis is targeted in order to keep the X axis short – also, likely using a Bowden extruder setup where just a hotend resides on the X carriage.

Specifications

  • Build Volume: ~180x180x180mm
  • Frame: 6x 340mm 2020 alu profiles
    • 2x V-Slot (X and Z axis)
    • 4x T-Slot (Y axis with simple sliders where T-Slot are sufficient)

Issues to Resolve

  • X belt routing: outside of 2020 extrusion or inside
  • X motor mount: rather simple, perhaps combine with xcarriage_short_hmount_2020(), done
  • Y motor mount position: will determine overall build volume
  • Y bed slider: perhaps like Ashtar K final version
  • testing overall stability: 6, 7 or 9 beams
  • 3 vs 4 wheels on Z carriage, 4 wheels (see below why)
  • positioning: extruder, controller, display, power supply, optional filament holder
  • positions of X, Y and Z endswitches
  • tune to a common build volume while having uni-length beams/extrusions
    • 150mm, 200mm, 215mm for X & Y build axis length

Frame: 6 vs 7 vs 9 beams

The 9 beams give an overall better sturdiness, but not sure how essential at small building volume (less than 220mm each axis). I might be able to remove beam, the last beam at the back at the bottom reducing to only 6 beams, in that case the Y motor is mounted on the remaining beam in the back.

Z Carriage: 3 vs 4 wheels module

The 4 wheels looks better also because it allows to add another 2020 horizontal mount or wider mount, some X range is sacrificed (10-20mm).

Different Sizes

The build volume from 150mm to 200mm for each axis, I like to have 200mm but not sure if the X axis can maintain linearity fully (e.g. half of a layer-height such as 0.1mm ⇒ 0.05mm linearity for head X = 0 .. max), I might to have to settle for 180mm or even 150mm. Actual tests and fine tuning of the Z axis (4 wheels V carriage) and X axis (3 wheels V carriage) will tell.

Comparison

Build Axis: 150mm (83%)
Area: 225cm2 (69%)
Volume: 3.4Kcm3 (58%)

Build Axis: 180mm (100%)
Area: 324cm2 (100%)
Volume: 5.8Kcm3 (100%)

Build Axis: 200mm (111%)
Area: 400cm2 (123%)
Volume: 8Kcm3 (137%)

IdeaFormer Magnetic Sticker
(Aliexpress, 2020/12)

Common quadratic bed-sizes are 150mm, 200mm, 214mm, 220mm and 235mm e.g. for magnetic beds. A 200mm bed can be used but only 180mm be printed, as I have sufficient margin on the XZ cantilever side.

Y Bed

I gonna use the simple slider riding on T-slot (derived from an existing nylon slider) for the Y bed, 3 sliders in total:

The sliders are glued beneath the Y carriage, then the Y bed snaps into the T-slots easily. I have printed on these sliders with two Ashtar K‘s (K1 = 380×400, K2 = 300×300) for about 1+ years successful. This simple approach requires gravity, and the bed needs its own weight to stay in place (cannot be up-side-down or in no-gravity environment like International Space Station ISS).

Back & Bottom View

Ashtar B (back view)

Ashtar B (bottom view)

References

CAD: ScriptCAD.org Prototype (2019/12)

Around February 2019 I bootstrapped a scripted CAD environment named “ScriptCAD”, and resembles closely to OpenSCAD.org and OpenJSCAD.org (which I co-developed for a couple of years) with a new take, developed from scratch:

ScriptCAD.org: ScriptCAD Logo 2019/11
  • Scripting capability using JavaScript
  • Separate internal representation from display representation
    • Triangulation or Implicit representation
    • only triangulate at late stage at display or export
ScriptCAD.org Internal Stages
  • Intuitive Graphical User Interface (GUI)
    • Simple export various formats
    • Select top-level solids
    • Source <-> TreeView <-> 3D Model selection
Select Source <-> TreeView Item <-> 3D Model

The transparent Source vs Object Tree vs 3D Space has been in the back of my mind for a long time as I keep the connection of each stage intact and transparent.

  • Ease of use
    • hiding JS module complexity and notions
    • Browser use (either use built-in editor or drag-n-drop source with autoreload)
    • Command Line Interface (CLI) use

Screenshots & Examples

SpiritCAD.org Online as Preview

As of November 2019, ScriptCAD.org is reachable as an early preview (alpha stage), most examples work, some do not yet or display wrong output.

Note: there is only limited documentation yet (2019/11), and the API is subject of changes.

I still tune it to my use-cases and therefore API and overall design of the API might change, even drastically; once the API becomes more stable I will release the source code as well.

Some of use-cases (as seen in the gallery above):

  • coding low-level Gcode and use ScriptCAD to preview (render) Gcode including colors, scriptcad (CLI) outputs .gcode to actually print
    • testing single layer color mixed 3D Printing: forms, color mixing
  • ScriptCAD uses ThreeCSG/csg.js at its core to perform CSG operations, which can be very slow – hence, designing complex pieces can be slow as every change recomputes all again (I like to avoid this in future developments) yet as of 0.3.2 basic caching is implemented so only deltas are recomputed.

Introduction Video

The on-going development I document also. That’s it.

CAD & 3D Printing: Parametric CAD with OpenSCAD

The past year (2018/2019) I printed with my own designed 3D Printers with various printheads and required for each variant a dedicated Part Cooler, and I realized it was worth the time to approach this in a parametric manner using OpenSCAD, using the “bull horn” design and so I came up with a general approach, and as a result was able to create various variants for my use-cases:

part-cooler-selection2

  • Custom Triple (& Dual) Micro Swiss hotends (3 nozzles, 3 heatsinks)
  • Chimera 2-in-2 (2 nozzles, 1 heatsink)
  • Cyclops NF 2-in-1 (2 intake, 1 nozzle, 1 heatsink, non-mixing)
  • E3D Volcano (1 nozzle, 1 heatsink, large nozzle diameter)
  • E3D V6 Lite (1 nozzle, 1 heatsink, small / medium nozzle diameter)
  • a few other specialized setups

Needless to say, the proven design allowed me to quickly design and print a new variant, and have expected results when using the part cooler – which is a huge time saver.

Yet, one drawback is obvious: in order to adapt a new variant, one requires the surrounding parts like heat sink and nozzle as a model or design it yourself (which can be time consuming as well) so the proper variables can be found to render the part cooler for the setup.

After I designed my 3D Printers also in parametric manner, like the Ashtar K (Prusa i3-like) 380x300x300mm build volume or Ashtar C (Core XY) 380x400x380mm build volume, using this parametric approach for a Part Cooler as well, turned out quite successful too.

It makes sense to develop and design a parametric piece which

  • maintains a few constraints, a general form, a base functionality
  • requires a few variables to adapt certain customization, sometimes it makes sense to introduce a lot of variables, and while testing and adapting customized pieces, some variables may become constants and unforeseen variables become more important

It certainly requires expertise about the piece in order to discern the constraints from the variable aspects while still maintaining its base functionality.

That’s it.

PS: See Parametric Part Cooler project page for new developments.

3D Printing: Diamond Hotend Part Coolers Design Reviews

The past weeks (2019/09) I adapted existing Part Cooler designs, and redesigned them in order to work with the Diamond Hotend, as I have been searching for a good part cooler option and did not succeed with what’s out there already.

So here my 3 designs so far with a short review of their use quality:

Dual (or Single) Short Fan Shrouds

At the first sight this looks a promising design, but in reality there were major drawbacks:

  • adjustment of height (vertical) was critical and required fine-tuning
  • tendency to cool down the nozzle instead of the molten filament, in particular at lower layers near the bed
  • max cooling was 35% with my 5015 blowers

Rating: ★★★★

See details at Dual Short Fan Shrouds.

Ring Cooler

As next I designed the ring cooler, with small holes around the nozzle, also adjustable in the height (Z), but the cooling wasn’t really sufficient, as the nozzle still was cooling off a lot (no more than 45% cooling fan with 5015 blower was possible) – quite a disappointment for the rather sophisticated setup, but this general “ring cooler” design has failed for me also for other printheads like E3D V6 or so, and I switched back to “bull horn” like fan shroud.

Rating: ★★★

See details at Ring Cooler.

Single Directional Cooler

This rather simple design turned out the best option so far:

  • wide: 5015 blower runs at 80% without cooling the nozzle too much
  • narrow: 5015 blower runs at 50% without cooling the nozzle too much
  • creates sufficient disturbance around the nozzle to cool opposite side as well

and the XYZ 20mm Hollow Calibration Cubes came out quite well, on all 4 sides the letters were printed OK – not as good as E3D V6 and other printheads.

Rating: ★★★

See details at Directional Cooler.

Addendum: Dual Directional Cooler

Although it seemed logical to use two direct cooler, but the amount of air around the nozzle in operation was too much, and it required 20% fan cooling so the nozzle was still properly heated, but this was too low to provide any sufficient part cooling. So this option, without silicon sock on the Diamond Hotend, is not suitable.

Rating: ★★★ 

Summary

The winner is the Directional Part Cooler as it brings the cool air close enough where the molten filament exits the nozzle, without affecting the bare nozzle too much. As mentioned, either way a silicon sock would be recommended when using a part cooler with the Diamond Hotend – so far (2019/09) there is no commercial source but DIY approach with this thing.

As you can see I used simple E3D V6 Fan mount in combination of LED Strip holder to lighten up the tip of the nozzle and the printing operation.

That’s it.

3D Printing: Diamond Hotend Directional Part Cooler

Diamond Hotend Part Coolers Design Reviews:

This is the 3rd option for a Part Cooler for Diamond Hotend I designed, a pointy directional approach using again 5015 blower:

Screenshot from 2019-09-11 08-55-14Screenshot from 2019-09-11 08-55-30

Assemble

Functional Setup

Parts

screenshot-from-2019-09-13-17-45-31.png

Printable:

  • diamond_cooler_shield_blower-2mounts
  • diamond_cooler_5015-mount-inset-right
  • diamond_direct_part_cooler
    • print without support but with additional brim to increase adhesion of 1st layer
    • print with 0.4mm nozzle / line-width, with a good slicer this gives 3 perimeters for the model with 0.2mm or 0.25mm layer-height
    • -narrow: use ~50% fan cooling, position as low to the nozzle height as possible (e.g. 2mm above, not less, not more)
    • -wide: use ~80% fan cooling: more tolerant on vertical position / height
  • optional:
  • optional (recommended):

Vitamins (Non-Printable):

  • 5010 fan (main heatsink fan)
  • 5015 blower
  • 3x M3x20
  • 2x M3 nuts

Download

https://cults3d.com/en/3d-model/tool/diamond-hotend-directional-part-cool

https://www.thingiverse.com/thing:3855947

Throttle Fan & Positioning

Even though the air output is close to the nozzle tip, you might reduce the fan

  • -narrow: use ~50% fan cooling, position as low to the nozzle height as possible (e.g. 2mm above, not less, not more)
  • -wide: use ~80% fan cooling: more tolerant on vertical position / height

to avoid cooling the nozzle and run into “THERMAL RUNAWAY” error – or you use a Diamond Hotend silicon sock, then you likely are able to use 100% cooling fan.

XYZ Hollow Calibration Cube with 3 Colors Mixed

The actual success of this setup is seen in this test cube (printable with 0% infill):

The “X” and “Y” junctions are quite well printed, not as good with a “bull horn” part cooler as with E3D V6 setup.

Addendum: Dual Directional Cooler

Although this looks like a nice setup, the overall output of air to the nozzle is overpowering and cools off the nozzle too much. The cooling fan, in my case, required reduction to 20% to avoid “THERMAL RUNAWAY ERROR”, but at 20% the cooling effect on the extruded filament was less optional than with a single directional cooler – therefore this option isn’t recommended, unless you have a silicon sock over the nozzle.

 

That’s it.

CAD: CSG Operation exclusive()

Historically Constructive Solid Geometry (CSG) covers three main boolean operations:

  • union
  • difference
  • intersection

like with Set Theory or more known when using Venn diagrams.

Brian Spilsbury started to look at 3D meshes for his JSxCAD library and how to process them: much closer to actual use cases of composing solids together and incorporate physical reality that two solids cannot occupy the same space at the same time while still unite or combine their shapes somehow.

He came up with the concept disjointed assembly of solids, which has the advantage of preserving the solids integrity in order to maintain individual information of material or colors per solid, and only change their shapes to align seamless to each other.

Disjointed Assembly or Exclusivity

The disjointed assembly or exclusive series of a, b and c like

a = sphere().color(red)
b = cube(1.5).color(green).translate([0.5,0.5,0.5])
c = cube(1).color(blue).translate([0.5,0,0])

may be written as

exclusive(a,b,c) = [ difference(a,b,c), difference(b,c), c  ]

The parts no longer intersect any space of each other, and seamlessly can be fused now together. The order of such exclusivity matters now: the first solid in line is changed by all succeeding solids, and each next solid in the disjointed assembly the same, whereas the last solid remains untouched, hence, exclusivity with ascending order, the last dominates most.

Alternatively, exclusivity with descending order:

exclusive(a,b,c) = [ a, difference(b,a), difference(c,b,a) ]

and then a remains untouched, and all succeeding parts are dominated by the preceding ones.

While union(), difference() and intersection() are base functions handling solids, exclusive() introduces a lightweight approach to handle grouping of multi-material CSG solids by having the parts accessible individually afterwards.

Support

Last update 2019/04/19:

  • OpenSCAD:  exclusive() may be written as a module:
module exclusive(order="asc",explode=[0,0,0]) {
   for (i = [0:1:$children-1]) 
      translate([explode[0]*i,explode[1]*i,explode[2]*i]) 
         if(order=="desc") 
            difference() {
               children(i);
               children([i-1:-1:0]);
            }
         else
            difference() {
               children(i);
               children([i+1:1:$children-1]);
            }
}

exclusive(explode=[3,0,0]) {
   color([1,0,0]) sphere($fn=32);
   color([0,1,0]) translate([0.5,0.5,0.5]) cube(1.5,center=true);
   color([0,0,1]) translate([0.5,0,0]) cube(1,center=true);
}

Screenshot from 2019-04-19 10-45-31

  • OpenJSCAD: not yet, you can easily write a function to handle an array of solids, and creates difference() operations to each other.
  • JSxCAD: assembly() with ascending order implied, means, the last object is most dominant.
  • Unreleased/Unnamed CAD (which I currently work on 2019/04): exclusive() available, with optional last argument options with order: either "asc" (default) or "desc" like:
    • exclusive(a,b,c);
    • exclusive(a,b,c,{order:"desc"});

Screenshot from 2019-04-10 08-48-11

That’s it.

Discrete OpenSCAD

This is aimed to be small OpenSCAD Library which re-implements some of its basic forms in discrete manner so vertices remain accessible in order to manipulate before being transformed into actual polyhedron for CSG operations.

State: very experimental state, not yet released due several drawbacks, code released (e.g. polygons must have same amount of segments to properly extrude, resolved)

Updates:

  • 2021/01/02: 0.0.6: code finally released
  • 2018/12/30: 0.0.5: 3d: dm_merge([]) merge multiple meshes into single one.
  • 2018/12/26: 0.0.4:
    • 3d: dm_extrude_rotate(p,n=4,start=0,end=360) which allows simple dm_torus()
    • more detailed documentation and illustrations
  • 2018/12/25: 0.0.3:
    • 2d: added dp_translate(), dp_scale()dp_rotate()dp_bounds() and dp_center()
    • 3d: added dm_sphere(), dm_cylinder() and dm_cube(), and dm_translate(), dm_scale()dm_rotate()dm_bounds() and dm_center() as well
  • 2018/12/24: 0.0.2: dp_morph() as part of dm_extrude() uses dp_nearest() to find nearby point of two polygons to morph smoothly, morph examples added
  • 2018/12/23: 0.0.1: Point Functions, Polygon Functions and Mesh Functions added, code not yet released

Functions

Discrete Point Functions

  • dpf_ellipse(r1,r2,p,a=0)
    • ​​​​dpf_circle(r,p,a=0)
    • dpf_circle(d,p,a=0) must use d=diameter
  • dpf_rectangle(w,h,p,a=0)
    • dpf_square(w,p,a=0)
  • dpf_npolygon(s,p,a=0) whereas s amount of sides

each function returns single 2d point, whereas

  • p ranges between 0…1, at any resolution
  • a is the additional rotate angle (default: 0)

Discrete Polygon Functions

Polygon Functions use Point Functions to create an array/list of 2d points to describe a polygon; n amount of segments:

Creating Polygons

  • dp_ellipse(r1,r2,n=12,a=0)
  • dp_circle(r,n=12,a=0)
  • dp_circle(d,n=12,a=0) must use d=diameter
    • all above use dpf_ellipse() to construct the polygon
    • ellipse and circle is approximated with high count of n-sided polygon
  • dp_rectangle(w,h,n=12,a=0)
  • dp_square(w,n=12,a=0)
    • two above use dpf_npolygon(sqrt(2)/2,4) and ​dp_scale() if required
  • dp_npolygon(r,s,n=12,a=0,start=0,end=360) whereas s = amount of sides of the polygon, s​ > n * 2 for good approximation
Screenshot from 2018-12-24 12-22-25
Square, Rectangle, Circle and Ellipse
Screenshot from 2018-12-25 20-29-21
N-Sided Polygon (s=3..12)

Manipulating Polygons

  • dp_translate(p,t) where as t is a number or array [x,y]
  • dp_scale(p,t) where as s is a number or array [x,y]
  • dp_rotate(p,a)
  • dp_center(p,center=[true,true])

further:

  • ​​dp_subdivide(p,n=2)
    • n amount of subdivisions per segment
  • dp_distort(a,s=1,f=1)
    • s amplitude of distortion
    • f frequency of distortion
Screenshot from 2018-12-24 13-10-24
N-Sided Polygon (n=3..6) with Distortion (s=0..3 with 0.5 step)
  • dp_morph(a,b,p)
    • morphs between two polygons (a and b), preferably both with same amount of segments and sufficient segments to have smooth transition
    • p range between 0..1
Screenshot from 2018-12-24 09-02-30
Morphing from square to circle and/or n-polygons in between (n=32 amount of segments)

Query Polygons

  • [[minx,maxx],[miny,maxy]] = dp_bounds(p)

and finally

  • dp_polygon(p)
    • creates an ordinary polygon OpenSCAD object
    • Note: you no longer can access the individual vertices

Discrete Mesh Functions

Mesh Functions use Polygon Functions to create an array with two elements:

  1. list of 3d points
  2. list of faces using indexes of the 3d points

Creating Meshs

  • dm_cube(s,center=false)
    • s = side length or
    • s = array of [w,d,h] or [x,y,z]
  • dm_cylinder(r,h=1,center=false,n=12)
    • dm_cylinder(r1,r2,h=1,center=false,n=12)
    • dm_cylinder(d,h=1,center=false) must use d=diameter
    • dm_cylinder(d1,d2,h=1,center=false,n=12) must use d1= and d2=
  • dm_sphere(r,center=false,n=12)
    • dm_sphere(d,center=false,n=12) must use d=diameter
Screenshot from 2018-12-25 09-19-29
Cubes, Cylinders, Cones and Sphere at different polygon resolutions

Cube and Cylinder are created by extruding dp_rectangle respectively dp_circle, whereas the Sphere is discretely done.

  • dm_torus(ri=1,ro=4,ni=48,no=48,ai=0,ao=0)
    • ri inner radius
    • ro outer radius
    • ni and no inner and outer n-sided polygon
    • ai and ao inner and outer angle offsets
Screenshot from 2018-12-26 08-29-14
Torus with various inner and outer n-sided polygons
  • dm_extrude(a,b,s,h)
    • a & b: polygons
    • s amount of steps
    • h height (Z wise)
Screenshot from 2018-12-26 11-53-23
Extruding Triangle (3-Sided Polygon) to N-Sided Polygon (s=3..12) linear and with 45 degree twist

Note: the main aim of this library was to extrude two arbitrary polygons correctly; so dm_extrude() is the center of this entire undertake.

  • dm_extrude_rotate(p,n=4,a=0,start=0,end=360)
    • sweep or rotate a 2d polygon, n-sided, used to implement dm_torus()
Screenshot from 2018-12-26 13-56-24
Triangle and Half Circle Extruded Rotational with N-Sides

Manipulating Meshs

  • dm_translate(m,t) whereas t = number or array with [x,y,z]
  • dm_scale(m,s) whereas s = number or array with [x,y,z]
  • dm_rotate(m,r) whereas r = number or array with [x,y,z]
  • dm_center(m,center=[true,true,true])
  • dm_merge(ms) whereas ms is an array of meshes

and more interesting:

  • dm_distort(m,s=1.0,f=1.0)
    • distort the mesh, s amplitude, f frequency
Screenshot from 2018-12-26 11-46-34
Extruding Square to Square with top polygon or mesh distortion; Extruding Square to Circle with light and heavy distortions

Query Meshs

  • [[minx,maxx],[miny,maxy],[minz,maxz]] = dm_bounds(m)

and finally

  • dm_polyhedra(m);
    • creates a polyhedra which allows CSG operations
    • Note: you no longer can access vertices for manipulation

Todo

  • make polygon morph (part of extruding) segment/point count neutral:
    1. using dp_morph() which uses ​dp_nearest(array,point) to morph between nearest points of polygons
      • disadvantage: some edges are missed where near-points don’t catch it
    2. consideration: additional strategies might be required, e.g. if polygon A and B segment count difference is huge, rebalance with using dp_subdivide() to achieve this for smoother morphing and extruding
    3. done: walking through max(len(a),len(b)) through all points and align point indexes linearly a[i*len(a)/max] and b[i*len(b)/max]
  • release code, done
  • extrude along path (e.g. ​dm_extrude_along(a,p))
  • extrude rotate/sweep (e.g. dm_extrude_sweep(a,r)) done: dm_extrude_rotate(p,n,start=0,end=360)
  • more examples, more documentation done: most functions properly illustrated with examples
  • implicit meshes: define objects in implicit form (allows more natural objects with smooth edges), and transform it into meshes, see NodeJS Implicit Mesh as reference
  • CSG operations on polygon (2d) or mesh (3d) level, quite challenging to do since OpenSCAD are single assignment and ​​for() loops must implemented recursively
    • 2D: consider csg2d.js as reference
    • 3D: consider csg.js as reference

Download

https://github.com/Spiritdude/DiscreteOpenSCAD

Related Projects

3D Printing: OpenSCAD Sketches #1

A few OpenSCAD sketches I’m currently work on, and later will publish as well:

Simple Compact Extruder

I used some aluminium MK8-based extruders but realized I required my own parametric extruder using 625ZZ bearing and I looked around and found Compact Bowden Extruder and adapted the overall design but coded it from scratch again:

sampleExtruder

It’s “right handed” by default, but filament can go both directions. The handle is pushed from “inward” with a spring, not so elegant, yet it saves space and filament does not have to go through the handle this way, which I prefer.

simple_compact_extruder() takes following parameters:

  • type:
    • "base": the base attached to the Nema 17 stepper motor
    • "handle": the push handle with the spring
    • "indicator": small indicate to put on the axis of the stepper motor
  • mount:
    • "none": (default) just attaches to Nema 17 stepper motor
    • "mount": simple mount (center)
    • "2020": extends flat (lower left version)
  • btd: Bowden tube diameter (default: 0mm), if 4mm is used, then Bowden tube can be inserted on both sides as guides for flexible filament close to the hobbed gear as shown below.

I use PC4-M6 push fit connector with PTFE tube 4mm OD / 2mm ID as guides, and began to use it right away on 3x printers for first tests:

Later I likely will integrate this design, once proven reliably working, with a Direct Drive Extruder design as well.

Dual E3D V6 Mount on 30mm X Carriage

My X carriage maintains 30mm horizontally distanced M3 mounts x 3 rows 20mm apart – the v_plate() (3 wheels) and h_plate() (4 wheels) as example:

and wanted a parametric dual E3D V6 hotend mount to print dual colors or materials for the Ashtar C #1:

Screenshot-from-2018-12-19-11-09-57-e1545214290923.png

dual_e3d_mount(): there are plenty parameters, but the most important ones:

  • type: "base" (left) or "clamp" for the clamp (right)
  • yoff: Y offset (when mounted the Z offset up), default: 0 (front one), 20 (middle and top)
  • nd: nozzle distance (Y-wise), default: 22 (most close possible), 35 (top one)

Example

First attempt to use it:

This design has been not yet printed but not yet in use, but soon as alternative to Chimera (dual hotends) or Cyclops (dual to one / mixing) hotends – two main issues:

  • part cooler needs to be narrow enough to sit aside of each other
  • part cooler should extend too much Y-wise too much, as the routing belt of the Ashtar C come into the way

The “Dual E3D V6 mount” was derived from preview designs as used for the Ashtar K:

The first one used two pairs of M3 screws, whereas the other more simple one requires in its base version just one pairs of M3 to mount the E3D V6 hotend and the mount itself to the X carriage; in case a slight Y offset is used, two pairs of M3 are required again.

 

I will update this post once the designs are published, after thorough testing in real life.