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

Virtual entities or model

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 250 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 15 Mar 2011, 21:00

    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
    • T Offline
      TIG Moderator
      last edited by 15 Mar 2011, 22:57

      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 16 Mar 2011, 23:45

        Sweet. Thanks a lot TIG, that should work.

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

        Advertisement