sketchucation logo sketchucation
    • Login
    1. Home
    2. jorre
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 4
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Edges problem

      Is there maybe a way to divide an object into triangles?
      because the add_face instruction can draw traingles..

      is there a function for this?

      thanks

      posted in Developers' Forum
      J
      jorre
    • RE: Edges problem

      i left out the part of coloring the attributed items..

      still only top of the walls don't get copied?
      so why doesn't all the edges get copied into the group except te top of the walls?
      because i use every point of all the edges?

      doesnt face = gentities.add_face(edges2) work like it should?
      or don't i use it correctley

      edit::

      i now changed something in my sketchupdesign..
      i made the top of the wall smaller area's..
      originaly the walls was one big area..
      nog lets say every area has 4 different wall's..
      and now it works like it should..

      but it isnt very good for the usage in sketchup..
      i think is must be possible to draw the whole big area..
      but how?

      http://img9.imageshack.us/img9/5190/bapi.jpg

      posted in Developers' Forum
      J
      jorre
    • RE: Edges problem

      @tig said:

      First make an array of all active faces...
      Then go through that and make a reduced array of faces+attributes...
      Now process the list of found faces...
      Perhaps, copy/move the faces' edges into the group and group.add_lines...edges.find_faces, for the set, as you go - no need to find all the vertices ?

      Seems your present code copies all faces ?

      all the faces where there is an entity (attribute)

      entities.each do |entity|
      

      before i copied all the faces into a group, but for some reason sketchup forgot to copy all of the objects.. there where usualy 2 or 3 faces that didnt get copied into the group.. but they had attributes

      posted in Developers' Forum
      J
      jorre
    • Edges problem

      hi
      i'm working on a project where i have to copy some objects to another layer..
      mostly it are rectangle objects..
      with these objects there is no problem..
      but i also need to copy walls.. but the walls aren't rectangle objects, because in my project they have 76 startpoints of the edges..
      you can see in the code that only objects with attributes get a copy..
      but in the picture i marked the part of the wall that has got an attribute, and the part that doesnt have an attribute.

      i dont really understand why sketchup copy's the side of the wall instead of the top of the wall.. i think there most be something wrong with my methode of copying the edges..

      maybe someone knows where there is an error in my code 😉

      model = Sketchup.active_model
      	entities = model.active_entities
      	layers = model.layers
      	new_layer = layers.add("Preview layer")
      	group = entities.add_group
      	group.layer = new_layer
      	gentities = group.entities
      	entities.each do |entity|
      		if (entity.typename == "Face")		
      			edges = entity.edges
      			edges2 = Array.new
      			edges.each do |edge|
      				p1 = edge.start.position
      				p2 = edge.end.position
      				edges2.push(gentities.add_line(p1, p2))
      			end
      			face = gentities.add_face(edges2)
      			context = entity.get_attribute "locon", "context_info"
      			if(context != nil && face != nil)
      				face.material = $context_info_color[context]
      				face.back_material = $context_info_color[context]
      			end
      		end
      	end
      	pages = model.pages
      	page = pages.add "Preview"
      	activelayer = model.active_layer = layers[2]
      	layer = model.active_layer
      	layers.each do |layer|
      		if (layer.name == "Preview layer")
      			page.set_visibility layer, true
      		elsif
      			page.set_visibility layer, false
      		end
      	end
      	group.locked = true
      

      http://img219.imageshack.us/img219/1685/79324521.png

      posted in Developers' Forum
      J
      jorre
    • 1 / 1