OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Corel User Forums > CorelDRAW > General

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-10-2010, 10:55
fungel
Guest
 
Posts: n/a
Default Measuring area of basic shape in meters squared

Hi,

I was wondering if anybody had a macro to measure the area inside a shape in meter squared? I am using Draw X4...

I have found some code but it does not work...

Sub Area()
ActiveDocument.Unit = cdrMillimeter
MsgBox Round(ActiveDocument.ActiveShape.Curve.Area, 2)
End Sub

Ta.

Fungel
Reply With Quote
  #2  
Old 10-10-2010, 11:31
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Area Macros

Alex’s Curve Works Macro will do this:

http://www.oberonplace.com/products/...curvestats.htm

Also Alex’s P macro:

http://macromonster.com/index.php?mo..._desc=127&id=9

-Shelby
Reply With Quote
  #3  
Old 10-10-2010, 11:35
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Area

As for your code, it is better to use the DisplayCurve, this way you can get the area of shapes like rectangles and ellipses and not just a curve.

Code:
Sub Area()
    ActiveDocument.Unit = cdrMillimeter
    MsgBox Round(ActiveShape.DisplayCurve.Area, 2)
End Sub
-Shelby
Reply With Quote
  #4  
Old 10-10-2010, 14:53
fungel
Guest
 
Posts: n/a
Default That is fantastic

Hey Shelby,

That is fantastic

I changed code to meters squared:

Just wondering if there is a way up putting the word "meter squared" after the number coming up so I never get confused with what it is!

Sub Area()
ActiveDocument.Unit = cdrMeter
MsgBox Round(ActiveShape.DisplayCurve.Area, 2)
End Sub

Ta.

Fungel
Reply With Quote
  #5  
Old 10-10-2010, 22:07
shelbym's Avatar
shelbym shelbym is offline
Senior Member
 
Join Date: Nov 2002
Location: Cheyenne, WY
Posts: 1,769
Blog Entries: 9
Send a message via ICQ to shelbym Send a message via AIM to shelbym Send a message via MSN to shelbym Send a message via Yahoo to shelbym
Default Area

Sure just do this:
Code:
Sub Area()
    ActiveDocument.Unit = cdrMeter
    MsgBox Round(ActiveShape.DisplayCurve.Area, 2) & " meter squared"
End Sub
-Shelby
Reply With Quote
  #6  
Old 14-10-2010, 09:00
fungel
Guest
 
Posts: n/a
Default Thank you - it works great.

Thanks Shelby,

That is exactly what I was looking for

Ta.

Fungel.
Reply With Quote
  #7  
Old 03-03-2011, 09:56
grzjanik grzjanik is offline
Member
 
Join Date: Mar 2010
Location: Lodz, Poland
Posts: 86
Send a message via Skype™ to grzjanik
Default Area

Welcome.
I work for Corel 12, and unfortunately, this script does not work. If I could ask you to rework it to version 12
Thank you and best regards.

It shows an error in this line:

MsgBox Round(ActiveShape.DisplayCurve.Area, 2) & " meter squared"

I hope you will help.

Last edited by grzjanik; 03-03-2011 at 10:00.
Reply With Quote
Reply

Tags
area


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

Advanced Search
Display Modes

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 Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Basic array/control question Gadget CorelDRAW/Corel DESIGNER VBA 5 07-02-2008 06:23
Urgent Help: Alex: with Corel VBA and Visual basic program amollondhe CorelDRAW/Corel DESIGNER VBA 1 23-11-2006 08:57
Visual Basic 2005 shelbym CorelDRAW/Corel DESIGNER VBA 5 03-11-2006 21:30
Visual basic and text box Mark Hockert CorelDRAW/Corel DESIGNER VBA 0 08-06-2006 14:19
Curveworks Fillet Gives Visual Basic Error wetpuppy CurveWorks 2 05-08-2005 10:08


All times are GMT -5. The time now is 08:03.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com