vDrawing.rotate
Posted: 25 Nov 2020, 19:31
Hi
We have a question How to rotate a vDrawing space.
We use that code to rotate a cad design the code work fine and the cad design image in our app screen rotate well
but when we read the point values of the different entities that make up the design they are with the pre-rotation values. Is there any way that after rotation these changes apply to the points that make up the design entities?
Thanks
rotate code
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim vDrawing As CADImage = CADImage.CreateImageByExtension("..\..\..\..\..\Files\Entities.dxf")
vDrawing.LoadFromFile("..\..\..\..\..\Files\Entities.dxf")
'visualization must be completed before rotation
vDrawing.Draw(Image1.CreateGraphics(), New RectangleF())
vDrawing.Rotate(CADImport.FaceModule.Axes.Z, 90) 'rotate by 90 degrees
vDrawing.GetExtents()
' adjusting visualization sizes to the control area:
Dim vRect As RectangleF
Dim vRatio As Double = vDrawing.AbsHeight * Image1.ClientSize.Width / (vDrawing.AbsWidth * Image1.ClientSize.Height)
If vRatio > 1 Then
vRect = New RectangleF(0, 0, (Image1.ClientSize.Width / vRatio), Image1.ClientSize.Height)
Else
vRect = New RectangleF(0, 0, Image1.ClientSize.Width, (Image1.ClientSize.Height * vRatio))
End If
'---------------------------------------------------
vDrawing.Draw(Image1.CreateGraphics(), vRect)
We have a question How to rotate a vDrawing space.
We use that code to rotate a cad design the code work fine and the cad design image in our app screen rotate well
but when we read the point values of the different entities that make up the design they are with the pre-rotation values. Is there any way that after rotation these changes apply to the points that make up the design entities?
Thanks
rotate code
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dim vDrawing As CADImage = CADImage.CreateImageByExtension("..\..\..\..\..\Files\Entities.dxf")
vDrawing.LoadFromFile("..\..\..\..\..\Files\Entities.dxf")
'visualization must be completed before rotation
vDrawing.Draw(Image1.CreateGraphics(), New RectangleF())
vDrawing.Rotate(CADImport.FaceModule.Axes.Z, 90) 'rotate by 90 degrees
vDrawing.GetExtents()
' adjusting visualization sizes to the control area:
Dim vRect As RectangleF
Dim vRatio As Double = vDrawing.AbsHeight * Image1.ClientSize.Width / (vDrawing.AbsWidth * Image1.ClientSize.Height)
If vRatio > 1 Then
vRect = New RectangleF(0, 0, (Image1.ClientSize.Width / vRatio), Image1.ClientSize.Height)
Else
vRect = New RectangleF(0, 0, Image1.ClientSize.Width, (Image1.ClientSize.Height * vRatio))
End If
'---------------------------------------------------
vDrawing.Draw(Image1.CreateGraphics(), vRect)