"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 = nilputs 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=nilWAS [still is] the safe and correct way to default the object's layer, without recourse to using a 'name' at all...
Similarlyentity.material=nilandface.back_material=nilwill also default those, without recourse to using a 'name' at all...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement