!tBPyYyjOQgVzlwFvEI:matrix.org

CadQuery Showcase

573 Members
3 Servers

Load older messages


SenderMessageTime
11 Sep 2023
@_discord_305026483758563340:t2bot.ioheadofgearsimage.png
Download image.png
16:03:36
@_discord_305026483758563340:t2bot.ioheadofgears I've been building a number of assemblies of parts, and for a while was struggling to position them relative to each other.

I suppose I could generate them in such a way as to ensure that they are placed where I want when I create them, but as I've been working through the process I don't necessarily know for sure where they're going to sit at the end.

They're functionally a bunch of tubes stacked on top of each other.

Here are a couple of helper functions I wrote to allow myself to quickly mix and match and inspect things. I'm working with both cadquery and build123d objects, and they use different bounding box functions and notation, so there's a check to see which I'm dealing with.

It feels like a bit of an ugly hack, and there's probably a better or more elegant way to do this, but it works.

def stack_this_under_that(this, that):
    if isinstance(this, cq.occ_impl.shapes.Compound):
        this_top = this.BoundingBox().zmax
    else:
        this_top = this.bounding_box().max.Z

    if that == 'Z':
        that_bottom = 0
    else:
        if isinstance(that, cq.occ_impl.shapes.Compound):
            that_bottom = that.BoundingBox().zmin
        else:
            that_bottom = that.bounding_box().min.Z

    move_z = that_bottom - this_top

    this.move(bd.Location((0,0,move_z),(0,0,0)))

    return

def stack_this_on_that(this, that):
    if isinstance(this, cq.occ_impl.shapes.Compound):
        this_bottom = this.BoundingBox().zmin
    else:
        this_bottom = this.bounding_box().min.Z

    if that == 'Z':
        that_top = 0
    else:
        if isinstance(that, cq.occ_impl.shapes.Compound):
            that_top = that.BoundingBox().zmax
        else:
            that_top = that.bounding_box().max.Z

    move_z = that_top - this_bottom

    this.move(bd.Location((0,0,move_z),(0,0,0)))
    return
16:03:36
@_discord_896482168103125002:t2bot.ioRoger Maitland#7070 build123d Joints are designed specifically for this (see https://build123d.readthedocs.io/en/latest/joints.html). Each part defines one or more Joint(s) (RigidJoint in this case) then the user uses joint1.connect_to(joint2) and the parts are placed appropriately no matter how they were originally designed. 16:07:16
@_discord_305026483758563340:t2bot.ioheadofgears Ooooh yeah that would certainly do it 16:08:26
@_discord_209043174960660490:t2bot.ioJern#4673 Nice, I am concerned about the "hollow geometry" on the threaded sections in your image, maybe this explains some of the invalid results you were seeing earlier? I know Roger has said that OCCT is notoriously bad at helical sweeps/cuts? 16:08:40
@_discord_305026483758563340:t2bot.ioheadofgearsimage.png
Download image.png
16:15:02
@_discord_305026483758563340:t2bot.ioheadofgears Hmm I get the same appearance when making a hollow bare cylinder
show(bd.Cylinder(10,25) - bd.Cylinder(8,25))
16:15:02
@_discord_209043174960660490:t2bot.ioJern#4673 No, that looks fine to me, please refer to your image above and look at the left-hand-side threaded part vs. the right-hand-side threaded part 16:15:50
12 Sep 2023
@_discord_1151057877994328117:t2bot.iomark_71213 joined the room.07:33:30
@_discord_643692926890934273:t2bot.iomarkymark_hh joined the room.07:57:21
@_discord_643692926890934273:t2bot.iomarkymark_hh changed their display name from Markymark to markymark_hh#0.13:13:39
@_discord_643692926890934273:t2bot.iomarkymark_hh changed their display name from markymark_hh#0 to markymark_hh.13:13:41
@_discord_792456819011485707:t2bot.iolanquarden joined the room.17:30:30
@_discord_450384267478827038:t2bot.iotN changed their display name from tN to tn.29#0.20:28:28
13 Sep 2023
@_discord_186253289476587521:t2bot.ioDraek#9615 Nice stuff man ! 18:14:26
14 Sep 2023
@_discord_642129792828964874:t2bot.ioqdx45 joined the room.15:34:10
@_discord_124742966806970370:t2bot.iothatonelutenist joined the room.21:25:19
15 Sep 2023
@_discord_695417718706536449:t2bot.iodiz#1680 changed their display name from diz#1680 to diz1680#0.16:37:59
@_discord_695417718706536449:t2bot.iodiz#1680 changed their display name from diz1680#0 to diz1680.16:38:00
@_discord_695417718706536449:t2bot.iodiz#1680IMG_6223.jpg
Download IMG_6223.jpg
16:38:02
@_discord_695417718706536449:t2bot.iodiz#1680 Microscope camera adaptor and eyepiece extender (to match focus) 16:38:22
@_discord_145964579946496001:t2bot.iobranor joined the room.18:29:25
16 Sep 2023
@_discord_228550340583227393:t2bot.ioisawu joined the room.09:30:04
17 Sep 2023
@_discord_601512982849126410:t2bot.ioviolet joined the room.06:11:40
@_discord_1002444658779111424:t2bot.iomarce changed their display name from marce to marce2104#0.08:28:14
@_discord_1002444658779111424:t2bot.iomarce changed their display name from marce2104#0 to marce2104.08:28:16
@_discord_500792050426445824:t2bot.io.duser1 joined the room.11:39:35
@_discord_860253588752039957:t2bot.iokevwo joined the room.17:39:16
18 Sep 2023
@_discord_1153387911169978459:t2bot.iodaniel_49364 joined the room.17:52:14
19 Sep 2023
@_discord_1153621863461830678:t2bot.iozealous_axolotl_37267 joined the room.09:21:46

Show newer messages


Back to Room ListRoom Version: 9