<p>The <code>union</code> syntax addresses this:</p>
<pre><code>translate([-40,-40,0]) 
difference() {
    union() {
        cube ([90,28,12]);

        translate([20,0,20]) 
        cube([12,12,12]);
    }

    translate([12,-.01,5]) 
    cube([12.7,28.02,14.02]);

    translate([65,-.01,5]) 
    cube([12.7,28.02,14.02]); 
}
</code></pre>
<p>It supports creating an object before the difference syntax is applied.</p>

CC BY-SA 4.0
2021-01-15T16:27:16.317Z
2021-01-16T05:18:13.953Z
2021-01-16T05:18:13.953Z
dan sawyer
<p>The following creates an object with two slots:</p>
<pre><code> translate([-40,-40,0]) difference() {
     cube ([90,28,12]);
     translate([12,-.01,5]) cube([12.7,28.02,14.02]);
     translate([65,-.01,5]) cube([12.7,28.02,14.02]);
</code></pre>
<p>How can the first main cube be extended to be a complex object of the syntax:</p>
<pre><code>cube([60,20,10],center=true);translate([0,0,5])cube([30,20,10],center=true);
</code></pre>
<p>and then use <code>difference</code> to create holes?</p>

CC BY-SA 4.0
2021-01-16T10:09:42.653Z
I fail to see why this question "does not appear to be about tools and applications of 3D printing", since it is about the use of a popular 3D CAD package. Voting to re-open.
Mick
CC BY-SA 4.0
2021-01-16T13:53:48.487Z
@Mick CAD is only so far on topic as it solves a *printing* problem. You need to show how this operation you try is related to 3D printing - for example "cutting up" to print in parts. for "remove one part" you'd have to point out *why* this is not a simple CAD question but related to 3D printing, for example by telling something like "I want to print with 2 materials in my MMU. I have a model and want to put color A in most but color B in the cutout."
Trish
CC BY-SA 4.0
2021-01-16T15:30:46.370Z
Both Mick and Trish raise very valid points. Dan, if you can edit your question to make it more applicable to 3D Printing then the question could be re-opened, otherwise we fear than we may become a "non-3D Printing related CAD" support site, if you see what I mean. See our [on-topic](https://3dprinting.stackexchange.com/help/on-topic) page and [CAD Questions - Review](https://3dprinting.meta.stackexchange.com/questions/501/cad-questions-review). Hi and welcome to SE.3DP, btw! :-)
Greenonline
<openscad>
How to combine difference with concatinate object
dan sawyer
# How to combine difference with concatinate object

(Asked by: username_0 on 2021-01-15)

The following creates an object with two slots:

```
 translate([-40,-40,0]) difference() {
     cube ([90,28,12]);
     translate([12,-.01,5]) cube([12.7,28.02,14.02]);
     translate([65,-.01,5]) cube([12.7,28.02,14.02]);

```

How can the first main cube be extended to be a complex object of the syntax:

```
cube([60,20,10],center=true);translate([0,0,5])cube([30,20,10],center=true);

```

and then use `difference` to create holes?

**Tags:** openscad

> **Comments:**
> **username_1**: I fail to see why this question "does not appear to be about tools and applications of 3D printing", since it is about the use of a popular 3D CAD package. Voting to re-open.  
> **username_2**: @username_1 CAD is only so far on topic as it solves a *printing* problem. You need to show how this operation you try is related to 3D printing - for example "cutting up" to print in parts. for "remove one part" you'd have to point out *why* this is not a simple CAD question but related to 3D printing, for example by telling something like "I want to print with 2 materials in my MMU. I have a model and want to put color A in most but color B in the cutout."  
> **username_3**: Both username_1 and username_2 raise very valid points. Dan, if you can edit your question to make it more applicable to 3D Printing then the question could be re-opened, otherwise we fear than we may become a "non-3D Printing related CAD" support site, if you see what I mean. See our [on-topic](https://3dprinting.stackexchange.com/help/on-topic) page and [CAD Questions - Review](https://3dprinting.meta.stackexchange.com/questions/501/cad-questions-review). Hi and welcome to SE.3DP, btw! :-)  

---

## 1 answers

### Answer by username_0 on 2021-01-15. Score: 3 | Accepted answer

The `union` syntax addresses this:

```
translate([-40,-40,0]) 
difference() {
    union() {
        cube ([90,28,12]);

        translate([20,0,20]) 
        cube([12,12,12]);
    }

    translate([12,-.01,5]) 
    cube([12.7,28.02,14.02]);

    translate([65,-.01,5]) 
    cube([12.7,28.02,14.02]); 
}

```

It supports creating an object before the difference syntax is applied.


---

