• Login
sketchucation logo sketchucation
  • Login
🔌 Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

Help with .followme

Scheduled Pinned Locked Moved Developers' Forum
7 Posts 3 Posters 177 Views 3 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.
  • D Offline
    dacastror
    last edited by 26 Feb 2013, 21:23

    Hi guys, I am making a plugin where I need to use .followme and I'm having bug splat with some curves, an attached two example curves that give me problems
    curves
    here a fragment of my code

    model = Sketchup.active_model
    sel = model.selection
    ent = model.entities
    selec = []
    selec.clear
    sel.each{|ob| selec.push(ob) if ob.is_a?(Sketchup;;Edge)}
    if selec.size == 0
       UI.messagebox "Please select a Curve"
       return
    end
    
    radio_tubo = 10.0.cm
    lados_tubo = 8
    pts=[]
    pts.clear
    pts=selec[0].vertices.collect{|v| v.position} 
    
    
    if Sketchup.version.to_f < 7.0
       model.start_operation("Draw tube")
    else
       model.start_operation("Draw tube", true)
    end
       grupo = ent.add_group
       entities = grupo.entities
       normal_cir = (pts[0].vector_to pts[1]).normalize
       circle = entities.add_circle pts[0], normal_cir, radio_tubo, lados_tubo
       cara = entities.add_face circle
       cara.reverse!.followme selec
       #selec.each{|edge| edge.erase!}
    model.commit_operation
    
    qq="OK"
    

    I try to test the plugin TubeAlongPath.rb with radius = 10 cm and also the bug occurs
    plugin
    I've noticed that with smaller r no problem (for example r = 2 cm)

    I do not know how to fix this, in advance thank you for your help

    (google translator)

    .

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 26 Feb 2013, 21:37

      entities.add_circle does NOT return a Sketchup::Curve object.
      It returns an Array of Sketchup::Edge objects, that make up the curve.

      So line 27 should be:
      edges = entities.add_circle( pts[0], normal_cir, radio_tubo, lados_tubo )

      ... and line 28:
      cara = entities.add_face( edges[0].curve )

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • D Offline
        dacastror
        last edited by 26 Feb 2013, 22:01

        Thanks Dan, I modified my code.
        My problem persists, someone can see the problem?

        1 Reply Last reply Reply Quote 0
        • S Offline
          sdmitch
          last edited by 26 Feb 2013, 22:58

          Your problem in not so much your code but the curve itself, 320x0.42cm segments. Reducing the number of segments or scaling the curve up 100x worked without Bug Splat. Also reducing the circle size to 1cm worked as well. The 10cm circle is just to big for the curve.

          Nothing is worthless, it can always be used as a bad example.

          http://sdmitch.blogspot.com/

          1 Reply Last reply Reply Quote 0
          • D Offline
            dacastror
            last edited by 27 Feb 2013, 01:38

            Thanks for the reply sdmitch, give me a first clue
            what worries me is that the user of the plugin do this and generate a bug splat on, I would like in this case simply do not tube, but do not understand how to calculate the minimum length allowed for this case

            1 Reply Last reply Reply Quote 0
            • S Offline
              sdmitch
              last edited by 27 Feb 2013, 02:29

              It is probably more a function of the angle between segments than the length of the segments. In this case, the maximum radius is something between 4 and 5cm.

              Nothing is worthless, it can always be used as a bad example.

              http://sdmitch.blogspot.com/

              1 Reply Last reply Reply Quote 0
              • D Offline
                dacastror
                last edited by 2 Mar 2013, 05:30

                you sent me on the right track, thanks sdmitch

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

                Advertisement