sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Virtual entities or model

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 264 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.
    • T Offline
      TheDro
      last edited by

      I was wondering if it was possible to create a "virtual" entities or model variable where I can make lines and faces without affecting the model I'm working on. The reason for this is that I want to create a cube like this:

      	def cubecomp(x,y,z)
      		
      		orig = Geom;;Point3d.new 0,0,0
      		pts = []
      		pts[0] = orig
      		pts[1] = orig + x
      		pts[3] = orig + y
      		pts[2] = pts[1] + x + y
      		
      		cubeface = entities.add_face pts
      		cubeface.pushpull - z.length, true
      		cube = cubeface.all_connected
      

      The potential problem I'm afraid of is that if one of the vertices of the cube is on an edge that is already in the model, I will select it with the all_connected method. What I would like to do is something like virtualEntities = Entities.new and use this to build the cube. Later, I want to copy this cube to several different locations.

      Does anyone know if something like this is possible or if there is a safe work around?

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        This might be better in the Ruby sections...
        In the meanwhile... It won't work as show as cubeface = entities.add_face(pts) doesn't have entities defined.
        The reference 'entities' could be model.entities or model.active_entities BUT as you surmised it could result in a clash with preexisting geometry...
        It's best in these circumstances to add the new geometry into a new group so it remaining unconnected to other stuff you can always explode the group afterwards if you must have the contents in a particular entities set - or make a component definition etc.
        To add a group use
        ents=model.active_entities group=ents.add_group() gents=group.entities
        then add things to 'gents'...
        cubeface=gents.add_face(pts)
        etc etc You have references to 'group' and 'gents'... just as you started with 'model' and 'active_entities'...
        The geometry inside 'group' is separated from the rest of the model unless you use group.explode...

        TIG

        1 Reply Last reply Reply Quote 0
        • T Offline
          TheDro
          last edited by

          Sweet. Thanks a lot TIG, that should work.

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

          Advertisement