OberonPlace.com Forums How to rotate an open curve
 Blogs Gallery FAQ Members List Social Groups Calendar Search Today's Posts Mark Forums Read

#1
10-11-2017, 13:21
 mtracy Member Join Date: Jun 2012 Location: Niceville, Florida Posts: 31
How to rotate an open curve

Looking for vba to rotate an open curve in such a way that the end nodes are on a horizontal plane. Not align the nodes per say, but rotate the shape based on the position of the nodes on the Y axis.
__________________
Myron Tracy
Accent Signs
#2
10-11-2017, 14:36
 mtracy Member Join Date: Jun 2012 Location: Niceville, Florida Posts: 31

__________________
Myron Tracy
Accent Signs
#3
10-11-2017, 16:56
 mtracy Member Join Date: Jun 2012 Location: Niceville, Florida Posts: 31

Ok, just for giggles here's what I got. Find the radius of any arc.

With the shape tool select the nodes that make up the Arc or curve segment, run the macro and it tells you what the radius is.

Dim n As Node, x1 As Double, y1 As Double, x2 As Double, y2 As Double, os As ShapeRange, x#, y#, w#, h#
ActiveDocument.Unit = cdrInch
Optimization = True
ActiveSelection.Copy
ActiveLayer.Paste
Set os = ActiveSelectionRange

If os.Count <> 1 Then MsgBox ("Select one shape and run macro again!")
ActiveShape.Curve.Nodes.First.GetPosition x1, y1
ActiveShape.Curve.Nodes.Last.GetPosition x2, y2
If x2 <> x1 Then k = -1 Else myangle = -90: GoTo here:
With os(1)
.RotationCenterX = x1
.RotationCenterY = y1
End With
myangle = Atn((y2 - y1) / (x2 - x1)) * 180 / 3.14159265358979
here:
os(1).Rotate k * myangle

os.GetSize w, h
MsgBox Round((h / 2) + (w * w) / (h * 8), 3)
ActiveSelection.Delete
Optimization = False
Application.Refresh

End Sub
__________________
Myron Tracy
Accent Signs

 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 ajesion Macros/Add-ons 8 05-05-2011 11:21 first5mins General 2 21-01-2010 15:57 mgmcs Macros/Add-ons 2 26-05-2006 23:01 diltech CorelDRAW/Corel DESIGNER VBA 1 10-01-2005 17:46 ddonnahoe CorelDRAW/Corel DESIGNER VBA 7 26-04-2004 13:20

All times are GMT -5. The time now is 06:01.

 OberonPlace.com - Archive - Top