• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

PROBLEM WITH PUSHPULL VECTOR

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 277 Views 2 Watching
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.
  • A Offline
    artmusicstudio
    last edited by 13 Oct 2013, 13:39

    hi,
    with this code (the FAKTOR is only fpr inch/cm recaltulation )


    model = Sketchup.active_model
    entities = model.active_entities
    rl1 = [-50/faktor/100,0/faktor/100,20/faktor/100]
    rl2 = [-50/faktor/100,10/faktor/100,30/faktor/100]

       group40 = entities.add_group
                     entities2 = group40.entities
                     new_line = entities2.add_line rl1, rl2
                     length = new_line.length
                     
                         centerpoint = rl2
                                                    # Create a circle perpendicular to the normal or Z axis
                         vector = rl1
                         vector2 = vector.normalize!
                     
                         edges = entities2.add_circle centerpoint, vector2, 3
                      
                         kreis = entities2.add_face edges
                  kreis.pushpull length
    

    i normally (and even in the beginning of this ruby-script (other cylinder)
    can pushpull along the line without any problem.

    BUT

    at the end of the script the same code lets the circle turn to an undefined angle.
    absolutely crazy.
    any idea how to fix it? >> screenshot
    thanx.
    stan


    131013-PROBLEM VECTORt.jpg

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 13 Oct 2013, 14:00

      Use
      vector2 = new_line.line[1] ### i.e. its vector
      Do NOT use the point-array rl1 as a vector !
      Also be aware that:
      if vector2==Z_AXIS && rl1.z==0
      The face will be made facing downwards even if the vector2 says 'up' !
      This occurs in manual SketchUp... try drawing a flat circle on the ground and in the air - the face at z=0 faces downwards...
      If the face orientation is important use something like:
      kreis.reverse if vector2==Z_AXIS && rl1.z==0

      TIG

      1 Reply Last reply Reply Quote 0
      • A Offline
        artmusicstudio
        last edited by 13 Oct 2013, 14:03

        hi tig,
        you are the greatest, as always.
        it works.
        it's funny, that "my" wrong syntax works at the beginning of the ruby...god knows....will correct all of them.

        again a step nearer to my first ruby (for everyone then, of course)

        regards and thax
        stan

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

        Advertisement