Does anyone know of a way to calculate the area, number of nodes and perimeter length of a closed curve using VBA in Corel Draw 12?
I know there are CAD add-in tools that do this...but I need to perform these calculations on approximately 4000 shapes and the CAD tools require that you manually click a button to get the data in each drawing file. I would like to automate the process by simply passing the data directly into a database or excel worksheet.
Any ideas?
Graham H.
Here's what I have so far for node count and perimeter length. The area part doesnt work..I'm still working on it and came across my post as I starting again in Google..."Area, Node Count and Perimeter Length of a Closed Curve" -- I thought it was the answer! but no..
Dim doc1 As Document Set doc1 = OpenDocument("W:\Shapes\Drawings\Cornice\SC-001.cdr")
Dim perimeter, surface As Double Dim nodes As Integer Dim i As Integer
Dim segment As New SegmentRange Dim seg As segment doc1.Pages(3).Layers("Layer 1").Shapes(1).CreateSelection
i = 0
'perimeter
For Each seg In ActiveShape.curve.Segments i = i + 1 If seg.Type = cdrCurveSegment Then segment.Add seg End If Next seg perimeter = segment.length MsgBox "All segment segments have total length of " & segment.length & """" 'area surface = ActiveShape.curve.area 'doesn't work
'nodes
nodes = i
To get the area of the closed curve:
I had to install X4. The code is ActiveShape.Curve.Area
Donezo!
Hi, Try with CADinTools for CorelDraw, it work with all versions of Corel Draw and Corel Designer, it shows the length and other properties of all selected shapes, and you can copy them to a worksheet, it is tab-separated, visit www.cadintools.com it's free for 15 days, and partially disables after the 15 days.