diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp
index 19475a083bc00a46a4311d987d9c19541d964787..f89f7d691504663c6b29be4adcf502d3e60ad995 100644
--- a/Geo/GModelIO_OCC.cpp
+++ b/Geo/GModelIO_OCC.cpp
@@ -1878,27 +1878,7 @@ bool OCC_Internals::applyBooleanOperator
 }
 
 bool OCC_Internals::_transform(const std::vector<std::pair<int, int> > &inDimTags,
-                               BRepBuilderAPI_Transform *tfo)
-{
-  for(unsigned int i = 0; i < inDimTags.size(); i++){
-    int dim = inDimTags[i].first;
-    int tag = inDimTags[i].second;
-    if(!isBound(dim, tag)){
-      Msg::Error("Unknown OpenCASCADE entity of dimension %d with tag %d",
-                 dim, tag);
-      return false;
-    }
-    tfo->Perform(find(dim, tag), Standard_False);
-    if(!tfo->IsDone()){
-      Msg::Error("Could not apply transformation");
-      return false;
-    }
-    bind(tfo->Shape(), dim, tag);
-  }
-  return true;
-}
-
-bool OCC_Internals::_gtransform(const std::vector<std::pair<int, int> > &inDimTags,
+                               BRepBuilderAPI_Transform *tfo,
                                BRepBuilderAPI_GTransform *gtfo)
 {
   for(unsigned int i = 0; i < inDimTags.size(); i++){
@@ -1909,12 +1889,24 @@ bool OCC_Internals::_gtransform(const std::vector<std::pair<int, int> > &inDimTa
                  dim, tag);
       return false;
     }
-    gtfo->Perform(find(dim, tag), Standard_False);
-    if(!gtfo->IsDone()){
-      Msg::Error("Could not apply transformation");
-      return false;
+    TopoDS_Shape result;
+    if(tfo){
+      tfo->Perform(find(dim, tag), Standard_False);
+      if(!tfo->IsDone()){
+        Msg::Error("Could not apply transformation");
+        return false;
+      }
+      result = tfo->Shape();
+    }
+    else if(gtfo){
+      gtfo->Perform(find(dim, tag), Standard_False);
+      if(!gtfo->IsDone()){
+        Msg::Error("Could not apply transformation");
+        return false;
+      }
+      result = gtfo->Shape();
     }
-    bind(gtfo->Shape(), dim, tag);
+    bind(result, dim, tag);
   }
   return true;
 }
@@ -1925,7 +1917,7 @@ bool OCC_Internals::translate(const std::vector<std::pair<int, int> > &inDimTags
   gp_Trsf t;
   t.SetTranslation(gp_Pnt(0, 0, 0), gp_Pnt(dx, dy, dz));
   BRepBuilderAPI_Transform tfo(t);
-  return _transform(inDimTags, &tfo);
+  return _transform(inDimTags, &tfo, 0);
 }
 
 bool OCC_Internals::rotate(const std::vector<std::pair<int, int> > &inDimTags,
@@ -1936,7 +1928,7 @@ bool OCC_Internals::rotate(const std::vector<std::pair<int, int> > &inDimTags,
   gp_Ax1 axisOfRevolution(gp_Pnt(x, y, z), gp_Dir(ax, ay, az));
   t.SetRotation(axisOfRevolution, angle);
   BRepBuilderAPI_Transform tfo(t);
-  return _transform(inDimTags, &tfo);
+  return _transform(inDimTags, &tfo, 0);
 }
 
 bool OCC_Internals::dilate(const std::vector<std::pair<int, int> > &inDimTags,
@@ -1947,7 +1939,7 @@ bool OCC_Internals::dilate(const std::vector<std::pair<int, int> > &inDimTags,
   t.SetTranslationPart(gp_XYZ(x,y,z));
   t.SetVectorialPart(gp_Mat(a, 0, 0, 0, b, 0, 0, 0, c));
   BRepBuilderAPI_GTransform gtfo(t);
-  return _gtransform(inDimTags, &gtfo);
+  return _transform(inDimTags, 0, &gtfo);
 }
 
 bool OCC_Internals::copy(const std::vector<std::pair<int, int> > &inDimTags,
diff --git a/Geo/GModelIO_OCC.h b/Geo/GModelIO_OCC.h
index b553a79cc528e185c65bafd9068654818691a8bb..64252e8129a861e2dabe6e9eccb9cab11a37b44b 100644
--- a/Geo/GModelIO_OCC.h
+++ b/Geo/GModelIO_OCC.h
@@ -82,12 +82,9 @@ class OCC_Internals {
                   bool fixsmalledges, bool fixspotstripfaces, bool sewfaces,
                   bool makesolids=false, double scaling=0.0);
 
-  // apply a geometrical transformation (does not modify Shape)
+  // apply a geometrical transformation
   bool _transform(const std::vector<std::pair<int, int> > &inDimTags,
-                  BRepBuilderAPI_Transform *tfo);
-
-  // apply a G geometrical transformation (modifies Shape : affinity...)
-  bool _gtransform(const std::vector<std::pair<int, int> > &inDimTags,
+                  BRepBuilderAPI_Transform *tfo,
                   BRepBuilderAPI_GTransform *gtfo);
 
   // add circle or ellipse arc
diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index f55ef80766a335325ceaf056071e61fa745fcd63..32eaf13f36092e2e0beb985b103ac1d343c089bb 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -8661,7 +8661,7 @@ yyreduce:
       if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){
         yymsg(1, "Warning Dilate OCC: Dilatation (second argument) + Translation (first argument) ");
         r = GModel::current()->getOCCInternals()->dilate
-                  (dimTags, (yyvsp[(3) - (9)].v)[0], (yyvsp[(3) - (9)].v)[1], (yyvsp[(3) - (9)].v)[2], (yyvsp[(5) - (9)].d), (yyvsp[(5) - (9)].d), (yyvsp[(5) - (9)].d));
+          (dimTags, (yyvsp[(3) - (9)].v)[0], (yyvsp[(3) - (9)].v)[1], (yyvsp[(3) - (9)].v)[2], (yyvsp[(5) - (9)].d), (yyvsp[(5) - (9)].d), (yyvsp[(5) - (9)].d));
       }
       else{
         r = GModel::current()->getGEOInternals()->dilate
@@ -8681,7 +8681,7 @@ yyreduce:
       if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){
         yymsg(1, "Warning Dilate OCC: Dilatation (second argument) + Translation (first argument) ");
         r = GModel::current()->getOCCInternals()->dilate
-                  (dimTags, (yyvsp[(3) - (9)].v)[0], (yyvsp[(3) - (9)].v)[1], (yyvsp[(3) - (9)].v)[2], (yyvsp[(5) - (9)].v)[0], (yyvsp[(5) - (9)].v)[1], (yyvsp[(5) - (9)].v)[2]);
+          (dimTags, (yyvsp[(3) - (9)].v)[0], (yyvsp[(3) - (9)].v)[1], (yyvsp[(3) - (9)].v)[2], (yyvsp[(5) - (9)].v)[0], (yyvsp[(5) - (9)].v)[1], (yyvsp[(5) - (9)].v)[2]);
       }
       else{
         r = GModel::current()->getGEOInternals()->dilate
diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y
index 4be93093fe980001cf68774e8bd41be15e0f8560..f9a95a667d7550e9a53800c89615f065ed25409d 100644
--- a/Parser/Gmsh.y
+++ b/Parser/Gmsh.y
@@ -2319,7 +2319,7 @@ Transform :
       if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){
         yymsg(1, "Warning Dilate OCC: Dilatation (second argument) + Translation (first argument) ");
         r = GModel::current()->getOCCInternals()->dilate
-                  (dimTags, $3[0], $3[1], $3[2], $5, $5, $5);
+          (dimTags, $3[0], $3[1], $3[2], $5, $5, $5);
       }
       else{
         r = GModel::current()->getGEOInternals()->dilate
@@ -2336,7 +2336,7 @@ Transform :
       if(factory == "OpenCASCADE" && GModel::current()->getOCCInternals()){
         yymsg(1, "Warning Dilate OCC: Dilatation (second argument) + Translation (first argument) ");
         r = GModel::current()->getOCCInternals()->dilate
-                  (dimTags, $3[0], $3[1], $3[2], $5[0], $5[1], $5[2]);
+          (dimTags, $3[0], $3[1], $3[2], $5[0], $5[1], $5[2]);
       }
       else{
         r = GModel::current()->getGEOInternals()->dilate