Sketchup puts the text "Difference" in 3D DWG/DXF export

The problem occurs when a punched hole is created please find below the sample code

face1=ent1.add_face pts
face1.pushpull 3

edges2=ent2.add_circle(ORIGIN, [0,0,1], 1, 12)  # create the hole
new_face = ent2.add_face edges2
new_face.pushpull 3

punch hole


If you export this punched_box group to 3D DWG or DXF the text “Difference” is included for every instance.
It is very annoying. If it is exported into DXF format at least it can be seen where the problem is. (even it can be deleted from the DXF file but it is a very clumsy solution)

The Sketchup version is 2017 Pro = ''

or explode the group…


It works.

By the way I have a much more complicated problem.
It is similar to this problem.
Sometimes in the sketchup 3D dwg export the text “group # 999” is added to certain components. (999 stands for 3 digit numbers)

This components are created with
instance = entities.add_instance instance_def,tr0

if you don’t name the definition, then SU will use ‘Group’ or ‘Component’ and append ‘#’ + number sequence to any ‘unique’ copies…

adding an example .skp and a .dxf [which can be opened in a text editor] may help explain what’s happening…


First please find attached a sample .skp .dxf (345.1 KB)

I do not uderstand your comment about naming a component.
Actually I am developing a tool for arranging luminaries and other objects. Now it consists of several thousand of lines. However every new component is created by the following method
def find_comp_make(compName)
# search for component with name compName if not found create an empty component with this name
if testcompo
compDef = Sketchup.active_model.definitions.add(compName);

return compDef


My real problem is that the union (and subtract) method is not working on components just on groups.
By the way to_component method is not working with groups.
So I have to save a group to a .skp file so that it could be used as component.

I had a quick look at both files and you have a some of basic issues, which may be contributing to unexpected behaviour…

it appears you are using layers and groups incorrectly…

layers only control visibility and can not contain or isolate geometry…

there are many posts on how SU uses layers…

Solid Tools only works on groups or components that are #manifold?

to_component works for me? try this…

# Add a group to the model.
group = Sketchup.active_model.entities.add_group
# change the group to a component instance
comp = group.to_component
# add a new layer
# name the new component = 'test_grp_to_comp'
comp.layer = 'test_layer'


This is a problem with the native solid tools. They don’t modify the existing groups/components as you would expect but creates new groups.

Thanks a lot!

I think so you solved one of my big puzzles of SU Ruby.
Now I have to rethink everything about ruby codes I have written so far.
By the way I think so it is a very ugly thing.
It should not be so.

It especially disturbing for me because I am developing an excel based SU ruby toolbox.
The components are always referenced by name in this toolbox.



When the designers created the Pro solid tools, they decided that if you applied one of the operations to a ComponentInstance, you would want the changes to apply to just that instance, not to the ComponentDefinition. So, they spun off a new Group to hold the modified geometry, named it “Difference”, and deleted the original. As you have seen, unless you know about this behavior it can break your logic (both in Ruby code and in the GUI).

Many people have criticized this behavior. There are some extensions that work around it, such as Jim’s Trim and Keep, and @eneroth3’s solid tools.

1 Like

Thanks for your further information.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.