Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Johannes
 
Posts: n/a
Default How to Draw an arc which is 1/4 of a circle?

Is there a way to draw an arc which is 1/4 of a circle?
It looks like Shapes.addcurve only draw bezier curve, but how do I make the
curve a 1/4 of a circle?

I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
draw 1/4 of a circle.


  #2   Report Post  
Bernard Liengme
 
Posts: n/a
Default

Excel was not designed for this
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Johannes" wrote in message
...
Is there a way to draw an arc which is 1/4 of a circle?
It looks like Shapes.addcurve only draw bezier curve, but how do I make
the
curve a 1/4 of a circle?

I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
draw 1/4 of a circle.




  #3   Report Post  
Tushar Mehta
 
Posts: n/a
Default

As Bernard noted, XL really isn't ideal for this, but you can use the
Office-level capabilities to your advantage. Turn on the macro
recorder (Tools | Macro Record new macro...) to get the code for the
below:

Create a circle with the Drawing toolbar's Oval button (hold down SHIFT
to force a circle rather than a generic oval).

Select this circle and copy + Paste Special | Image (PNG) format.

Select the pasted object and from the Picture toolbar (it should show
up automatically when the graphic is selected), use the Crop button to
crop the appropriate horizontal 1/2 and the appropriate vertical 1/2.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Is there a way to draw an arc which is 1/4 of a circle?
It looks like Shapes.addcurve only draw bezier curve, but how do I make the
curve a 1/4 of a circle?

I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
draw 1/4 of a circle.



  #4   Report Post  
Andy Pope
 
Posts: n/a
Default

Hi,

Here is a function that will draw a freeform arc.
The separate x and y radius allow you to draw ovals.

'-------------------------------
Sub FourQuadarents()
Dim shpArc As Shape

Set shpArc = CreateArc(100, 100, 0, 90)
Set shpArc = CreateArc(100, 100, 90, 180)
Set shpArc = CreateArc(100, 100, 180, 270)
' colour segement
CreateArc(100, 50, 270, 360).Fill.ForeColor.SchemeColor = 43

End Sub

Function CreateArc(XRadius As Single, YRadius As Single, _
StartAngle As Single, EndAngle As Single) As Shape
'
Dim intAngle As Integer
Dim dblA1 As Double
Dim dblB1 As Double
Dim dblA2 As Double
Dim dblB2 As Double
Const PI = 3.14159265358979

With ActiveSheet.Shapes.BuildFreeform( _
msoEditingAuto, XRadius, YRadius)
For intAngle = StartAngle To EndAngle
dblA2 = XRadius + (Cos((intAngle * (PI / 180))) * XRadius)
dblB2 = YRadius - (Sin((intAngle * (PI / 180))) * YRadius)
.AddNodes msoSegmentLine, msoEditingAuto, dblA2, dblB2
Next
.AddNodes msoSegmentLine, msoEditingAuto, XRadius, YRadius
Set CreateArc = .ConvertToShape
End With

End Function

Cheers
Andy

Johannes wrote:
Is there a way to draw an arc which is 1/4 of a circle?
It looks like Shapes.addcurve only draw bezier curve, but how do I make the
curve a 1/4 of a circle?

I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
draw 1/4 of a circle.



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #5   Report Post  
Jean Ruch
 
Posts: n/a
Default


"Johannes" schrieb im Newsbeitrag
...
Is there a way to draw an arc which is 1/4 of a circle?
It looks like Shapes.addcurve only draw bezier curve, but how do I

make the
curve a 1/4 of a circle?

I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it

to
draw 1/4 of a circle.



hello Johannes,

You always have the possibility to use standard equations of a cicle
(in cartesian or better polar coordinates)

You will for example get half a circle with positive y-values and
centered on the origin
(simplest version) if you put:

in Column AA from A3 to A39 a series from 0 to 180, step 5

in column B (standing for x= OP *cos (theta) = rho * cos (theta))
with the formula
in B3=2*$E$1*COS(D3*PI()/180)

The figure in E1 stands for the radius of your circle

in column C, corresponding to y = OPsin Theta = rho sin Theta with the
Formula

in C3 =2*$E$1*SIN(D3*PI()/180)

Make your diagram from the Range B3:C39

If you want a complete circle centered on the origin,

complete the series in Column A up to 360
and copy down the formulas in Columns B and C
the new range for your diagram will be B3:C75


take care that the x and y axes have the same absolute size for the
same values....

If you want only the first quadrant ( in the trigonometric sense),
limit the Diagram

for equivalent 0 to 90 ° i.e use the Range B3:C21


You are free to choose any angle you want for the beginning of your
curve
(the first column corresponds to values in °); Your 1/4 circle should
end for a value in ° incremented with + 90 in your first Column)


regards

Jean



  #6   Report Post  
Jon Peltier
 
Posts: n/a
Default

One of the AutoShapes is an arc, and if you hold down Shift while drawing it, the
arc will be constrained to equal height and width. If you turn on the macro
recorder, you will get the following code:

ActiveSheet.Shapes.AddShape(msoShapeArc, 350.25, 63.75, 114#, 114#).Select

where the four numerical arguments are the left, top, width, and height of the arc.
The default height is the top right (North to East) quadrant of the circle, but you
can use a combination of

Selection.ShapeRange.Flip msoFlipHorizontal
Selection.ShapeRange.Flip msoFlipVertical

to orient the arc the way you want it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Johannes wrote:
Is there a way to draw an arc which is 1/4 of a circle?
It looks like Shapes.addcurve only draw bezier curve, but how do I make the
curve a 1/4 of a circle?

I also tried Shapes.BuildFreeForm().AddNodes(), but I couldn't get it to
draw 1/4 of a circle.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't find draw toolbar?? oldferd New Users to Excel 1 May 26th 05 07:20 PM
Drawing a circle on a protected sheet Tonso Excel Discussion (Misc queries) 3 April 9th 05 09:22 PM
How to draw chat by entering equation Anne Charts and Charting in Excel 5 March 19th 05 02:43 AM
Excel should let me circle a cell or number in the spreadsheet fo. BTaylor Excel Discussion (Misc queries) 2 March 8th 05 03:00 PM
How do I easily draw in Excel the Upper and Lower limits of a con. Judy Charts and Charting in Excel 3 January 12th 05 09:21 AM


All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"