OberonPlace.com Forums Cannot rotate a virtual shape with the same precision as a shape
 Blogs Gallery FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

#1
16-01-2011, 11:37
 runflacruiser Senior Member Join Date: Jun 2009 Location: Pigeon Forge, TN USA Posts: 811
Cannot rotate a virtual shape with the same precision as a shape

Hi.
I have a simple function that rotates a line for example.
Draw a line and angle it at whatever angle, say a 3 inch 45 degree line.
The function will return the angle for rotation that rotates the line until it's at it's thinnest horizontal width.

I use a virtual shape to greatly improve speed.
But...
When I create a virtual shape the angle for the prec (precision value) that I enter cannot seem to be less than .5
For a regular shape, not a virtual shape, I can use any value ie .01

Here's the function. Just pass the shape to it.

Code:
```Private Function rotateIt2(s As Shape) As Double
'Dim s As Shape
Dim dup As Shape
Dim thinnestw As Double
Dim angle As Double
Dim rotToThinW As Double, prec As Double

prec = 0.25
'Set dup = s.TreeNode.GetCopy().VirtualShape 'use a virtual shape instead.
Set dup = s.Duplicate
thinnestw = 10000
angle = 0

For angle = 0 To 20 Step prec
dup.Rotate prec
If dup.SizeWidth < thinnestw Then
thinnestw = dup.SizeWidth
rotToThinW = angle
ElseIf dup.SizeWidth > thinnestw And angle <> 0 Then
GoTo exitMe:
End If
Next angle
exitMe:
dup.Delete
rotateIt2 = rotToThinW + prec
End Function```
Any ideas?
-John
#2
19-01-2011, 14:34
 runflacruiser Senior Member Join Date: Jun 2009 Location: Pigeon Forge, TN USA Posts: 811
virtual shape bug

Hi.
Ok.
Here's a solid testing code and result file.
The code simply creates a rectangle then rotates it either as shape or a virtual shape duplicate of it.
It takes a height measurement of the shape at each rotation angle in the loop.

I'm getting unexpected results.
I also attached a results file with my results to the test.

Code:
```Sub testVirtualShapeRotation()

Dim s As Shape, sDup As Shape
Dim dAngle As Double, dStep As Double, dH As Double
Dim lSpace As Long
Dim bUseVirtual As Boolean

''''''''''''''''''''
''''''''''''''''''''

bUseVirtual = True

''''''''''''''''''''
''''''''''''''''''''
lSpace = 1
dStep = 0.01
Set s = ActiveLayer.CreateRectangle2(0, 0, 6, 2)
Set sDup = s.TreeNode.GetCopy().VirtualShape

For dAngle = dStep To 360 Step dStep 'loop to rotate a rectangle and take height measurement

If Not bUseVirtual Then
s.Rotate dAngle 'rotate it!
dH = s.SizeHeight 'height measurement taken
Else 'use our virtual shape instead
sDup.Rotate dAngle 'rotate it!
dH = sDup.SizeHeight 'height measurement taken
End If
ActiveLayer.CreateArtisticText 0, lSpace, dH
lSpace = lSpace + 1
Next dAngle
End Sub```
Anyone?
-John
Attached Files
 virtual_test.cdr (40.8 KB, 365 views)

 Tags virtual shape rotation

 Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home OberonPlace Discussion     Site News     Web site suggestions     Image Gallery     Testing Oberon Products     CurveWorks     SecuriDesign     Calendar Wizard     Oberon Function Plotter     Jigsaw Puzzle Creator     Other Oberon Commercial Products     New product ideas Corel User Forums     CorelDRAW         General         Tutorials         FAQ         Feature requests/wishlist         Macros/Add-ons         Artwork Showcase     Corel DESIGNER         General         Tutorials         FAQ         Feature requests/wishlist         Macros/Add-ons         Artwork Showcase     Corel PHOTO-PAINT         General         Tutorials         FAQ         Feature requests/wishlist         Macros/Add-ons         Artwork Showcase     General         About Corel         Off-Topic Developer Forums     OberonPlace Development Portal     VBA         CorelDRAW/Corel DESIGNER VBA         Corel Photo-Paint VBA         Code Critique     Corel Script         CorelDRAW CS         Corel Photo-Paint CS

 Similar Threads Thread Thread Starter Forum Replies Last Post dungbtl CorelDRAW/Corel DESIGNER VBA 24 28-12-2019 04:56 Joe CorelDRAW/Corel DESIGNER VBA 1 19-02-2009 02:50 Seelenquell CorelDRAW/Corel DESIGNER VBA 15 01-03-2008 08:08 m31uk3 CorelDRAW/Corel DESIGNER VBA 6 08-02-2008 18:50 clausm General 2 22-03-2007 12:02

All times are GMT -5. The time now is 21:29.

 OberonPlace.com - Archive - Top