• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

No pushpull when touching ????

Scheduled Pinned Locked Moved Developers' Forum
15 Posts 3 Posters 185 Views
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.
  • K Offline
    ksor
    last edited by 12 Feb 2012, 18:49

    I have these two fully encapsled methods:

    def makePulley(diameter, profile)
                    # rotate profile 90Β°
                    tr = Geom;;Transformation.rotation([(diameter.to_f/2),0,0], [1,0,0], 90.degrees)
                    @entities.transform_entities(tr, profile)
                    # remskiven laves ud fra profilen
                    profile.followme(@entities.add_circle([0,0,0], [0,0,1],diameter.to_f/2, 48))
                end
    

    and

                def pull_krave(diameter, bredde)
                    # En krave til nippelskruer laves efter angivne dimensioner
                    krvFlade  = @entities.add_face(@entities.add_circle([0,0,-0.05.mm], [0,0,-1],diameter.to_f/2, 48))
                    krvFlade.pushpull(bredde)
                end
    
    

    The first method makes the upper 'half' of the attached picture - the pulley - the second method makes the cylinder under the pulley - they seems to work fine, BUT

    What you can't see on the picture is that there is a small amount of 'air' (0.05.mm ) between the pulley and the cylinder. You can see in the second method that the circle has a center in [0,0,-0.05.mm] - I would like to have that center in [0,0,0] BUT if I do that, the pushpull won't work at all - it only makes the circle !

    • why ?

    pulley.jpg

    Best regards
    KSor, Denmark
    Skype: keldsor

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 13 Feb 2012, 00:13

      In the second method don't add geometry to @entities but rather add it to into a group
      grp1=@entities.add_group()
      gents=grp1.entities
      so then do
      krvFlade = gents.add_face(@entities.add_circle([0,0,0], [0,0,-1],diameter.to_f/2, 48))
      etc
      The cylinder's geometry won't interact with the pulley's geometry.
      You can explode the groups on completion if desired.

      You could in fact add all of your new geometry inside separate groups, with sub-groups for the various pulleys and their parts.
      You could even convert the pulley groups into components and then add new instants of them as needed etc...

      TIG

      1 Reply Last reply Reply Quote 0
      • K Offline
        ksor
        last edited by 13 Feb 2012, 09:56

        @tig said:

        In the second method don't add geometry to @entities but rather add it to into a group
        grp1=@entities.add_group()
        gents=grp1.entities
        so then do
        krvFlade = gents.add_face(@entities.entities.add_circle([0,0,0], [0,0,-1],diameter.to_f/2, 48))
        etc
        The cylinder's geometry won't interact with the pulley's geometry.
        You can explode the groups on completion if desired.

        You could in fact add all of your new geometry inside separate groups, with sub-groups for the various pulleys and their parts.
        You could even convert the pulley groups into components and then add new instants of them as needed etc...

        I beleave it should be:

        krvFlade = gents.add_face(grp1.entities.add_circle([0,0,0], [0,0,-1],diameter.to_f/2, 48))
        
        

        or else the circle has no "inner face" - right ?

        Best regards
        KSor, Denmark
        Skype: keldsor

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 13 Feb 2012, 10:30

          You are quite right! Another stupid typo from my copy/paste πŸ˜’ I must take more care... I only have a few seconds allocated to answer each post [that's my excuse πŸ˜‰ ]...
          OR to be exact, the code could be

          krvFlade = gents.add_face(gents.add_circle([0,0,0], [0,0,-1], diameter.to_f/2, 48))
          

          because we've made a reference to grp1 entities named ' gents' πŸ˜„

          At least you understand the concept behind what I was [trying to] show !
          That is - make the connected geometry [all off it 😳 ] inside a group to avoid it interfering with layer creations that can be inside their own groups...

          PS: I'm not clear why you need to use diameter.to_f/2 when making the circle, because you can [should] initially set/get/pass ' diameter' as a length so then there's no need to mess on with it later, since halving it as a length will work without changing its class:?

          TIG

          1 Reply Last reply Reply Quote 0
          • K Offline
            ksor
            last edited by 13 Feb 2012, 10:46

            @tig said:

            PS: I'm not clear why you need to use diameter.to_f/2 when making the circle, because you can [should] initially set/get/pass ' diameter' as a length so then there's no need to mess on with it later, since halving it as a length will work without changing its class:?

            I get a DIAMETER from the inputbox, but the circle method needs a RADIUS - that's why ...

            but maybe I should call the argument 'radius' and make the calculation in the call instead.

            Best regards
            KSor, Denmark
            Skype: keldsor

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 13 Feb 2012, 11:12

              NO, you miss my point.
              I understand the input in the dialog is a 'diameter' BUT because it's already a ' length' as you set it to say 100.mm initially you don't need to do the .to_f step...
              Dividing a 'length' by 2 is fine - it returns a new 'length' half as big.

              TIG

              1 Reply Last reply Reply Quote 0
              • K Offline
                ksor
                last edited by 13 Feb 2012, 12:55

                OK - now I can make those two parts of the pulley - the wheel and the cylinder - as two separate groups !

                Now I want to drill a hole through BOTH of them for the shaft - but I can't because they are different groups !

                I think I'll have to make a third group for the hole because of the pushpull won't work if the "beginning circle" is made on the buttom of the cylinder (like my problems makeing the cylinder under the pulley !) and that's making it all even worse !

                It can't be true it is SO sofisticated to do such trivial things !

                I thing I need a sample code for:

                1. making a hole in a cylinder for a shaft
                2. sort of moving all entities from one group X into another group Y - maybe as a sub-group in group Y or just "entities" in group Y

                I cant find samples out there - do you have any links ?

                Best regards
                KSor, Denmark
                Skype: keldsor

                1 Reply Last reply Reply Quote 0
                • T Offline
                  TIG Moderator
                  last edited by 13 Feb 2012, 14:19

                  Why not spend a few minutes to work out the cross-section of the pulley+axle+hole as a profile face... then do a FollowMme around [any] circle ?
                  That way it's all done in one go...
                  Sometime you need to break down what you are doing into separate steps, other times doing it all in one go proves to be the best...
                  Like you might do 'by hand', which will prove better than making all of the separate parts and combining them later...Capture.PNG

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • K Offline
                    ksor
                    last edited by 13 Feb 2012, 14:44

                    Of cause I do !

                    But then I DON'T find out - how to build up a group bit by bit and it could be nice too.

                    But I'll finish my pulley script with your idea !

                    Best regards
                    KSor, Denmark
                    Skype: keldsor

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      TIG Moderator
                      last edited by 13 Feb 2012, 15:49

                      If you want to build it up in parts you can.
                      I suggest you make a container group that holds all of the sub-groups.
                      Then when you explode sub-groups the geometry still stays inside the 'container'.
                      IF you have a reference to a face or can get a reference to it later [perhaps from face.classify_point()] then creating a circle on the face and pushpulling it through to the other side of the object [you know the 'thickness ?] is quite possible and should then leave the 'hole'...

                      Why not do a simple 'practice' on a dead simple box with a smaller square drawn on it, that is then extruded through the box by exactly the box's thickness to leave a hole...

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • K Offline
                        ksor
                        last edited by 13 Feb 2012, 15:52

                        @tig said:

                        If you want to build it up in parts you can.
                        I suggest you make a container group that holds all of the sub-groups.
                        Then when you explode sub-groups the geometry still stays inside the 'container'.
                        IF you have a reference to a face or can get a reference to it later [perhaps from face.classify_point()] then creating a circle on the face and pushpulling it through to the other side of the object [you know the 'thickness ?] is quite possible and should then leave the 'hole'...

                        Why not do a simple 'practice' on a dead simple box with a smaller square drawn on it, that is then extruded through the box by exactly the box's thickness to leave a hole...

                        Yeah,I'll give it a try - thx

                        Best regards
                        KSor, Denmark
                        Skype: keldsor

                        1 Reply Last reply Reply Quote 0
                        • Dan RathbunD Offline
                          Dan Rathbun
                          last edited by 13 Feb 2012, 17:11

                          @tig said:

                          PS: I'm not clear why you need to use diameter.to_f/2 when making the circle, because you can [should] initially set/get/pass ' diameter' ***** as a length ***** so then there's no need to mess on with it later, since halving it ***** as a length ***** will work without changing its class:?

                          @TIG.. you're confusing him.

                          It's class **Length** ... and the method to use is diameter.to_l .. so rephrase as:

                          @unknownuser said:

                          PS: I'm not clear why you need to use diameter.to_f/2 when making the circle, because you can [should] initially set/get/pass ' diameter' as a Length class object,
                          diameter = diameter.to_l
                          ... so then there's no need to mess on with it later, since halving it as a Length instance, will work without changing its class. (FYI: Length is a subclass of Float class.)

                          @Keld: see the API's entry for the Length and Numeric classes.

                          I'm not here much anymore.

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            TIG Moderator
                            last edited by 13 Feb 2012, 18:34

                            No Dan... you need the 'back-story'... in his dialog the default value for diameter is already predetermined to be a 'length' [say 100.mm ] - or it ought to be!
                            So any new value he types in stays a 'length' e.g. 150.mm
                            Therefore to find half of it to use as a radius he divides it by 2.
                            He does not need to convert the diameter into a 'float' [.to_f] OR to a 'length' [.to_l] or into anything else for that matter - it's already 'the right type' [a 'length'] and he can use it directly in his methods...
                            What I said stands.

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • Dan RathbunD Offline
                              Dan Rathbun
                              last edited by 13 Feb 2012, 20:10

                              So does what I said.. the class name begins with a capital, as ALL class identifiers do.

                              HE was not understanding that you meant the Ruby Length class... he thought it was the plain old English word length. (Re-read his responce.)

                              I know he doesn't need to use .to_f ...
                              That's why at the end, I said that "FYI: Length is a subclass of Float class."

                              But.. excuse for chiming in ... he's confused enuff already.. I will bow out. Sorry, if I got yur dander up, there TIG.

                              I'm not here much anymore.

                              1 Reply Last reply Reply Quote 0
                              • T Offline
                                TIG Moderator
                                last edited by 13 Feb 2012, 20:18

                                I did put it in Ruby red to stress it was somehow 'special' without going into the added confusion of 'classes' - with an example to explain it too...
                                OK it maybe ought to have a 'capital-letter', but we all say float not **F**loat quite a lot too without much of an issue !
                                But no dander is up [yet]... πŸ˜‰

                                TIG

                                1 Reply Last reply Reply Quote 0
                                • 1 / 1
                                1 / 1
                                • First post
                                  1/15
                                  Last post
                                Buy SketchPlus
                                Buy SUbD
                                Buy WrapR
                                Buy eBook
                                Buy Modelur
                                Buy Vertex Tools
                                Buy SketchCuisine
                                Buy FormFonts

                                Advertisement