• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Problem while creating a circle ?!

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 2 Posters 262 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.
  • M Offline
    Morgan74
    last edited by 31 May 2010, 16:11

    Hello everybody,

    I'm trying to draw and paint a circle in the center of a Face, so here is my code :

    The current selection is a Face :

    
    center = Sketchup.active_model.selection.first.bounds.center
    normal = Sketchup.active_model.selection.first.normal
    outline = Sketchup.active_model.entities.add_circle(center,normal,10)
    circle = Sketchup.active_model.entities.add_face(outline)
    circle.material = "red"
    
    

    This code draw a circle but "add_face" always return nil so I can't paint in red this new circle !??
    Can't you help me please, because I don't understand the problem?

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 31 May 2010, 19:02

      Since you are drawing onto a face, when you try to make a face from the circle edges, there is already one there, and unfortunately it returns nil if it does not create a new face.

      ` face = Sketchup.active_model.selection.first # Keep track of the original face
      center = face.bounds.center
      normal = face.normal
      outline = Sketchup.active_model.entities.add_circle(center,normal,10)

      assume that the circle edges borders to the new circle and the original face

      circleface = ( circle.first.faces.to_a - [face] ).first
      circleface.material = "red"`

      Thomas Thomassen — SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • M Offline
        Morgan74
        last edited by 31 May 2010, 19:26

        Thanks a lot for your reply!!
        It's really better now !!
        But with circleface = ( **outline**.first.faces.to_a - [face] ).first

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 31 May 2010, 19:53

          ooops! 😳

          Thomas Thomassen — SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

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

          Advertisement