Store Patterned Data
-
I'm trying to store patterned data to recheck the design for later use of different coloured panels.
Process Steps :
-
Select a patterned model.
-
The patterns are convert into a group and in a layer "Patterns" and be invisible temporary.
-
Only the sub-dividing faces are shown , later I can open the patterned group.
The problem is the patterned group is copied and invisible , but the edges which are drawn in a layer " Patterns " cut and divide each face that is not a panel. I try to learn the code from Tig's example. Very good example , I wonder how can I clear the edges that cut faces ?
def group_hide_patterns #EDGES-GROUP model=Sketchup.active_model edges=[] ss=model.selection ss.grep(Sketchup;;Face).each{|face| edges << face.edges} ss.grep(Sketchup;;Edge).each{|edge| edges << edge} edges.flatten! edges.uniq! edges.compact! ents=model.active_entities group=ents.add_group(edges) group.name="patterns" edge_layer = model.layers.add("Patterns") if group.name="patterns" ss.each{|e| e.layer = edge_layer if e.is_a? Sketchup;;Group } edge_layer.visible = false end end
-
-
Groups/components will separate geometry, so keeping panel divisions in a separate group.entities will mean they won't cut faces that remain inside in another entities context.
It is much better to use layers to hide/show groups or component-instances and keep all of your raw geometry [edges and faces] on Layer0. Layers or using Hidden=true don't separate geometry.BUT if you have an edge that is splitting a face [i.e. they must all be in the same context] - aka a coplanar edge - then there are several examples of code to delete such edges.
Here's one [pretty much unpublished] pick the meat off the bones...### Delete Coplanar Edges # TIG (c) 2008-2013 ### require 'sketchup.rb' ### module TIG def self.deleteCoplanarEdges_validate_selection() Sketchup.active_model.selection.each{|e| if e.is_a?(Sketchup;;Edge) && e.faces.length==2 return true break end#if } return false end def self.deleteCoplanarEdges() model=Sketchup.active_model edges=model.selection.grep(Sketchup;;Edge).find_all{|e| e.faces.length==2 } togos=[] counter=0 model.start_operation("Delete Coplanar Edges") edges.each{|e| next unless e.valid? if e.faces[0].normal.dot(e.faces[1].normal) > 0.99999999 && e.faces[0].material == e.faces[1].material && e.faces[0].back_material == e.faces[1].back_material togos << e counter+=1 Sketchup;;set_status_text(("Coplanar Edges Erased = #{counter}"),SB_PROMPT) end#if } model.active_entities.erase_entities(togos) model.commit_operation end ### unless file_loaded?(__FILE__) UI.add_context_menu_handler{|menu| if self.deleteCoplanarEdges_validate_selection() menu.add_item("Delete COPLANAR Edges"){self.deleteCoplanarEdges()} end#if } end#unless file_loaded(__FILE__) end#module
-
I rethink again , maybe I have to separate between panel faces and pattern group ?
-
Thank You So much,Tig. It works !
This is the idea to revise a model from architect by storing data at the first time. And later use to recheck data for tagging panels , and take the panel out in order that the facade engineer can do the life size panels to do mapping back on sub-dividing panels.
The method I do :
The subdividing faces are in the "Layer0".
The patterns are in the Layer-"Patterns".
So , they are not mix together in the same layer.For the shortage time to "delete coplanar edges or patterns" , I have to select edges by degrees and use your code to delete edges because the group edge and original edges are overlap that I have to delete original edges.So , it doesn't affect to bring tagging panels out , and I can recheck the patterned data to do retag panels.
For the store patterned data , maybe it comprise of 3 functions :
1.Make edge group
2.Select Coplanar edges by degrees
3.Delete Coplanar edges selection
Advertisement