Help.Outer shell

Can anyone show me how to create a 3 component outer shell automatically after I explode the component? I am trying to create a dynamic component

Hey, not sure what you are trying do accomplish? What is the end goal of your DC and why do you need to make 3 outer shells to make it? Posting your file with what you have already got will help us help you.

I want to create a DC of a board that can change the radius of curvature.
I saw one similar, and they hid the lines so it looked like a complete board,and i wonder how they can outer shell themselves when labeled

There is no ‘outer shell’ function in the DC extension, you would need a Ruby script to do that. You have the idea of the 3 parts with hidden lines correct, it looks like a single board. The curve can be managed by adjusting the length and width with the LenXY or Z attributes of the curved child component. I still do not understand why you need it to outer shell? Is it for some other extension that needs solid components?

can you help me with the ruby ​​script.
I want to make a DC containing many such curved plates. If I solder each plate individually, it will take a lot of time.

make an in-between component that contains parts (solid groups do not leave residue) then you can select (right click menu) in outliner and outer shell that

Dynamic Mitred Steel UB - Model - 3D Warehouse

this can be the trigger point for the script

note that this can be reinstated with swap with its saved definition, or another with a saveas current size reference, this case lenY

2 Likes

If you’re using opencutlist, then you can do things like this with one level of DC group within the part component without the need to outershell.

3 Likes

can someone tell me what is wrong, i am new to rubi script

entities = Sketchup.active_model.entities
=> #Sketchup::Entities:0x0000014f82bf62b0
dc = entities[0]
=> #Sketchup::ComponentInstance:0x0000014f82746b70
t1 = entities[1]
=> nil
t2 = entities[2]
=> nil
t11 = group1.outer_shell(group2).outer_shell(group3)
Error: #<NameError: undefined local variable or method `group1’ for main:Object>

:in `' SketchUp:in `eval' => nil

1 Like

thanks but this doesn’t work for me

several…

This is okay, however keep in mind:
The #entities method returns an Entities object containing the entities in the root of model.

That is correct, you associated the ComponentInstance - which is the only one at the root of the model - to dc variable.

as you can see both association is returned nil (nothing) because the entities collection does not contains the elements with that index.

The error describing that `group1’ is undefined (group2, group3 also not a) method or variable.

In fact, the definition of instance assigned to dc contains the 3 (group) instances you are looking for.
if you associate like

# make the instance unique, so you will not chage other instances they maybe exist
dc = dc.make_unique
dc_ents = dc.definition.entities
group1 = dc_ents[0]
group2 = dc_ents[1]
group2 = dc_ents[2]
t11 = group1.outer_shell(group2).outer_shell(group3)
# then you can explode `dc` and get the solid "unwrapped"
dc.explode

You can ask your Ruby related questions in a corresponding category: Ruby API - SketchUp Community

How to post code correctly in the forum:

3 Likes

thanks bro, but it’s still giving me some error. and can i remove the make unique code and replace it with component?

make the instance unique, so you will not chage other instances they maybe exist

dc = dc.make_unique
dc_ents = dc.definition.entities
group1 = dc_ents[0]
group2 = dc_ents[1]
group2 = dc_ents[2]
t11 = group1.outer_shell(group2).outer_shell(group3)

then you can explode dc and get the solid “unwrapped”

dc.explode
Error: #<NoMethodError: undefined method `make_unique’ for nil:NilClass>

:1:in `' SketchUp:in `eval' => nil
1 Like

PLEASE post your code according Instruktion here:
How to post code correctly in the forum:
[How to] Post correctly formatted and colorized code on the forum?


Well. There is a typo in my code above, group2 asgined twice… sorry, I did not tested it yesterday :blush:.

the proper one should be:

entities = Sketchup.active_model.entities
dc = entities[0]
dc = dc.make_unique
dc_ents = dc.definition.entities.to_a
group1 = dc_ents[0]
group2 = dc_ents[1]
group3 = dc_ents[2]
t11 = group1.outer_shell(group2).outer_shell(group3)
dc.explode

o_s1

Be aware that this snippet is handling the special case where there is nothing else in a model, just a component containing, 3 solid groups/component.

Post your model you are trying on, if you still heve an issue.

2 Likes

thanks bro

I want to write code to automatically outer shell DC when switching from component to group, can you guide me. Or where can i find references

I don’t quite understand what this means.
However I have an idea how to merge (outer shell) solids inside any selected component then explode this selected component.
I guess, it’s okay to merge first inside and then explode the outer component you selected.
I can call it something like “Explode to Solid”.

I’m busy right now, but the evening (CET) I will check.
Please post your model, containing some DCs you are talking about, and I can test on it as well.

1 Like

Dot Cong.skp (14.8 KB)

I mean link the ruby ​​code to this DC, so when I use explode it will automatically outer shell.
sorry for my confusing writing. i used google translate :sweat_smile:

hm. trouble is it’s translating what you need literally, but outer shell is also a tool in sketchup, hence the confusion.

can you tell us in your language ? chances are someone understands, or at least can check with other translating tools ?

2 Likes

Tôi muốn tìm hiểu về cách làm cho Dynamic component của mình liên kết với 1 mã Ruby . Để khi tôi explode nó từ Component ra Group, nó sẽ tự hàn những group con bên trong.