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

pts=[[-2,-2,0],[2,-2,0],[2,2,0],[-2,2,0]]
grp1=Sketchup.active_model.active_entities.add_group
ent1=grp1.entities
face1=ent1.add_face pts
face1.pushpull 3

grp2=Sketchup.active_model.active_entities.add_group
ent2=grp2.entities
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

punched_box=grp2.subtract(grp1)

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

punched_box.name = ''

or explode the group…

john

Thanks!
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
tr0=Geom::Transformation.scaling(scaleX,scaleY,scaleZ)
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…

john

First please find attached a sample .skp .dxf filemvf-403.zip (345.1 KB)

Second
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
testcompo=Sketchup.active_model.definitions[compName]
if testcompo
compDef=testcompo
else
compDef = Sketchup.active_model.definitions.add(compName);
end

return compDef

end

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
group.entities.add_line([0,0,0],[100,100,100])
# change the group to a component instance
comp = group.to_component
# add a new layer
Sketchup.active_model.layers.add('test_layer')
# name the new component
comp.definition.name = 'test_grp_to_comp'
comp.layer = 'test_layer'

john

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.

regards

Gyula

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.