JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Is center() broken or am I?

    General Discussions
    1
    2
    771
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • faithhack
      faithhack last edited by

      Trying out V2 stuff...

      pin = center({axes:[true,true,false]}, cylinder({startRadius: 4.5, endRadius: 4.5, height: 38}))

      produces the same object in the same place as:

      pin = cylinder({startRadius: 4.5, endRadius: 4.5, height: 38})

      I would have expected the first one to be centered on X/Y and sitting on the Z plane. Am I missing something?

      Also, do I have to always define 'startRadius' and 'endRadius' for a cylinder? I would think there would be a 'radius'. Maybe I'm just lazy...

      1 Reply Last reply Reply Quote 0
      • faithhack
        faithhack last edited by faithhack

        And the answer is... I'm broke 😌
        I was treating the center({axes:[true, true, false]}, object) like the old object({center:[true,true,false]}) which is not the case since primitives are now created centered at [0,0,0] by default.
        Since the primitive is created centered by default at [0,0,0], changing the axes on a new part doesn't really have an effect.
        Picking a consistent default is probably the 'right thing(tm)' to do since the old primitives where very inconsistent - round things like cylinders and sphere where centered on X/Y but not Z and cubes where created with a corner at [0,0,0].
        Hopefully new docs will have little warnings for those transitioning from V1 to V2 and maybe some helpful examples for porting old designs over.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB | Contributors