"something minor is messed up in your model"
-
I get this message from Sketchup when I try to save a model that has had geometry added by my script:
"something minor is messed up in your model...".
I click OK to fix it, and everything is fine, but I can't figure out what I'm doing that causes this. It happens consistently. Anyone else seen something like this?
-
It usually has a 'more details...' button - click that for an explanation...
Usually it's because you have zero length lines, gluing-components that are not exactly on a surface, and similar issues that can't be done manually, but are achievable in code... -
Thanks for that, Tig. Here's the result:
@unknownuser said:
Results of Validity Check.
Non-default layer found for CComponentDefinition (106082) - fixed
Not sure what that means, though. In the script, I create a new layer, add a definition to the model, then assign the definition to that new layer, along with all the entities in the definition:
peg_layer = Sketchup.active_model.layers.add "Pegs for Presentation" o = Geom;;Point3d.new(0,0,0) v = Geom;;Vector3d.new(0,0,1) pd = model.definitions.add("pegette") pd.layer = peg_layer ents = pd.entities.add_circle(o, v, 0.5, 16) ents.each {|ent| ent.layer = peg_layer}
I want all the instances of the definition (which I create later) to be on the new layer. Should the definition itself be on the default layer?
-
I'd make the component definition's geometry all on Layer0 [default] then when it's done set the entities onto the required layer - BUT leave the definition alone it can't really have a layer.
When you manually place an instance it goes onto the current layer anyway.
So:peg_layer = Sketchup.active_model.layers.add("Pegs for Presentation") o = Geom;;Point3d.new(0,0,0) v = Geom;;Vector3d.new(0,0,1) pd = model.definitions.add("pegette") ents = pd.entities.add_circle(o, v, 0.5, 16) ents.each {|ent| ent.layer = peg_layer}
If you are placing component instances 'in code' you can control each instance's layer - let's assume the instance's location is at 'point' and you want the instances in the active_entities, you use:
tr = Geom::Transformation.new(point) ins = Sketchup.active_model.active_entities.add_instance(pd, tr) ins.layer = peg_layer
-
Thanks, TIG. That fixed it.
BTW, to anyone else lurking here, Layer0 is referenced with a string:
ents.each {|ent| ent.layer = "Layer0"}
but:
ents.each {|ent| ent.layer = 0}
does not work.
-
entity.layer = nil
puts the entity on the default layer 0. -
I think that the default-layer is now called 'Layer0' in all locales... BUT there was a time that it was named differently for each locale-version.
Soentity.layer=nil
WAS [still is] the safe and correct way to default the object's layer, without recourse to using a 'name' at all...
Similarlyentity.material=nil
andface.back_material=nil
will also default those, without recourse to using a 'name' at all...
Advertisement