Problem adding a face's edges to a layer.
-
After
add_face
to model:ent_group = @master_group.entities.add_face([@entity[0]+@block_x,@entity[1]+@block_y,@entity[2]+@block_z],[@entity[3]+@block_x,@entity[4]+@block_y,@entity[5]+@block_z],[@entity[6]+@block_x,@entity[7]+@block_y, @entity[8]+@block_z])
I attempt to place it on a layer:
ent_group.layer=@entity_layer
Problem is the face goes on the
@entity_layer
but its edges remain on "layer0". I verified that ent_group reports a face object, and tried to move its edges on the layer byent_group.edges.layer=@entity_layer
, but the edges remained on "layer0". -
Your
ent_group
is a reference to the newly madeface
- that's what the 'add_face' method returns.
So
ent_group.layer=@entity_layer
Changes its layer - nothing else.
A face and it's edges CAN be put onto different layers but can lead to confusion if one layer is on and the other off, because layers don't separate connected geometry [unlike CAD] they simply affect things' visibility and erasing a visible connected-edge then affects an invisible face.
To change the face's edges as well as the face itself use this...
ent_group.edges.each{|e|e.layer=@entity_layer}
Alternatively if the new face and its edges are inside a group and you want everything inside that group on that layer try
@master_group.entities.each{|e|e.layer=@entity_layer}
to change the face and edges in one go... -
Tig, Your suggestion added the face edges to the layer imported from Acad. But, I still had to assign the face separately.
ent_group.layer=@entity_layer ent_group.edges.each{|e|e.layer=@entity_layer}
Got it, thanks. Didn't think to extract edges from entity_group.
My app. appears to keep everything on layer0, but allows the other layers to control visibility. Is that one SketchUp layers work? In SketchUp, I am able to move entities to layers other then layer0.
Do you know where can I go for a explanation of SketchUp layers?
-
Sketchup layers are relatively straight forward.
Any 'drawing element' can have a layer.
That layer can be on/off to control its visibility.
Having a different layer does not separate something from connected geometry - so a face on one layer with its edges on another is still tied together. If you switch off the face layer so you only see the edges and then erase an edge when you switch the face layer back on the face will NOT be there as it relied on that edge for its very existence. To separate geometry you must make a group or component - then what happens to external objects will not affect what's within the group etc...
So, place all connected geometry on the same layer*** and group/compo it, give the group/instance a layer that you then switch on/off to control visibility.
***It's normally best to use the default-layer [called 'Layer0' in the EN-US locale] for this 'raw' stuff. However you could say put it all onto any other layer if you wanted to control things within a group...I think your initial question related to extracting data from a DXF... Here the objects you make will each have a layer assigned to them. In CAD, unlike a SKP layers do separate geometry. The CAD equivalent to 'Layer0' is layer '0' which is often used for the contents of Blocks etc, where they display the properties of the Block's layer, rather than those of layer '0' itself - rather like faces with the default material inside a group/instance displaying the group/instance's material even when they are still the 'default'...
I suggest that your DXF extraction duplicates the different CAD objects' layers, and if they are within a CAD Block then make an equivalent SKP Component [keeping the layering of the parts] with Instances on the Inserts' on layers to suit...See this simple tutorial http://www.youtube.com/watch?v=7swKSFCE3AU
or buy this http://www.dummies.com/how-to/content/how-to-avoid-problems-with-layers-in-google-sketch.html -
Tig, Thanks.
Advertisement