OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   CorelDRAW/Corel DESIGNER VBA (http://forum.oberonplace.com/forumdisplay.php?f=16)
-   -   How would I get the origin point of a rectangle as drawn? (http://forum.oberonplace.com/showthread.php?t=24849)

jlorbz 29-10-2020 12:05

How would I get the origin point of a rectangle as drawn?
 
When a user draws a rectangle they can start in any corner and draw the box in any direction.

I'm trying to figure out how to capture which corner of the box (the box's origin) they started with so that I can place a new object banked to that same corner. Thank you for any help you're able to give.

Would I have to cycle through the points and determine which one is which based on the size or is there an easier way to get it?

shelbym 25-11-2020 13:47

Origin Point of Rectangle
 
The easiest way would be to find the first node of the display curve.

The following will mark the origin point of each rectangle with a red circle:
Code:

Sub FindStartofRectange()
    Dim sr As ShapeRange
    Dim s As Shape
    Dim x As Double, y As Double
   
    Set sr = ActiveSelectionRange
   
    For Each s In sr.Shapes
        s.DisplayCurve.Nodes.First.GetPosition x, y
        ActiveLayer.CreateEllipse2(x, y, 0.125).Fill.UniformColor.RGBAssign 255, 0, 0
    Next s
End Sub

Happy Coding,

-Shelby


All times are GMT -5. The time now is 16:07.

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