Subscribe to this thread
Home - General / All posts - rotate a grid.
yves61
469 post(s)
#28-Apr-26 13:57

I am looking for some SQL coding in order to rotate a grid (drawing). I do not need rotating each cell of the grid separately, but the whole grid without breaking the alignment. Any help is appreciated. Thanks.

artlembo


3,468 post(s)
#28-Apr-26 18:50

I thought this would work, but it does not meet your criteria for breaking the alignment. So, you'll have to do it with a script. I've included both the SQL I tested (which won't give you what you want), and the script, which will work.

UPDATE [Drawing]

SET [Geom (I)] = Rotate([Geom (I)],45)

.

.

.

.

Sub Main

 Set theDrawing = document.ComponentSet("zones")

 Set theAnalz = document.NewAnalyzer

 theAnalz.Rotate theDrawing, theDrawing.objectset, -45

End Sub

artlembo


3,468 post(s)
#28-Apr-26 19:00

forgot to ask, is this for Manifold 8 or Manifold 9. My answers above are for Manifold 8.

apo
204 post(s)
#29-Apr-26 06:38

In M9, that I assume you are using based on your previous questions, the geomrotate function allows you to inject a rotation center which might be the centroid of the whole grid. Therefore the query is rather simple

VALUE @ROTATIONCENTERX FLOAT64X2 = ( SELECT GeomCenter(GeomConvexHull(GeomMergePoints([Geom]), TRUE, 0),0)  FROM [Drawing] );

SELECT [mfd_id], GeomRotate([Geom], @ROTATIONCENTERX, -60)

INTO [New Drawing 2]

FROM [Drawing];

Hope it helps

artlembo


3,468 post(s)
#29-Apr-26 21:07

clever. You can also update the drawing instead of creating a new drawing.

VALUE @ROTATIONCENTERX FLOAT64X2 = ( SELECT GeomCenter(GeomConvexHull(GeomMergeAreas([geom]), TRUE, 0),0) 

FROM [drawing] );

--

--

UPDATE [drawing]

SET [geom] =  GeomRotate([drawing], @ROTATIONCENTERX, -45)

in this case, my drawing contained areas, so I used a GeomMergeAreas.

yves61
469 post(s)
#30-Apr-26 18:35

To all : your suggestions / solutions are much appreciated. I will try these , and come back if needed.

Thanks.

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.