OberonPlace.com Forums

OberonPlace.com Forums (http://forum.oberonplace.com/index.php)
-   Macros/Add-ons (http://forum.oberonplace.com/forumdisplay.php?f=21)
-   -   macro for break curve and join curve (http://forum.oberonplace.com/showthread.php?t=1543)

mgmcs 25-05-2006 20:29

macro for break curve and join curve
 
Hi,
After using weld,trim,'convert to curves' or any such option, you see one node being shown with a larger square than others. Thats the starting point from where a machine will cut the figure. Corel decides this starting pt by default. But we can change it thru foll steps:-
1. select the shape tool.
2. click on any other node u want as the new starting point.
3. select the 'break curve' option
4. select the 'auto-close curve' option

this is now the new starting pt for cutting the object. Now my problem starts here........
I want to automate this using a macro. I tried recording a macro for this. but corel does not generate any code for step1&2. so how do i know where the user has clicked ? and second, if u record the entire process & see the generated code, it will show a set of coordinate points and not just x & y. Where will i get these from in my macro.

this is difficult to explain thru a thread, but if anyone has tried it before, pls help.

thanks,
maggie

wOxxOm 26-05-2006 15:07

just fast tips, going home now:

Code:

dim sh as shape, n as node, x as double, y as double, shift&
if activedocument.getuserclick (x,y,0,true,cdrCursorNodeEdit)=0 then
  set sh=activepage.selectshapesAtPoint(x,y,true)
  if sh.shapes.count>0 then
    set sh=sh.shapes(1)
    set n=sh.Curve.FindNodeAtPoint(x,y)
    if not n is nothing then
      n.breakapart
      sh.curve.nodes.last.joinWith sh.curve.nodes.first
    end if
  end if
end if

this code was written just in two minutes here, in browser, I didn't test it


by the way I do this operation manually (very rarely) - here is a tip: assign j to node-join, Shift-J to node-break-apart, then double click you node - you will enter node-edit with this node selected, press Alt-J, draw a marqee around two resulting nodes, press J

mgmcs 26-05-2006 22:01

at the first try, ur code worked !! thanks a lot. I have been trying this for so long. The macro that Corel generated was like this. -
Dim crv As Curve
Set crv = ActiveDocument.CreateCurve()
With crv.CreateSubPath(5.168406, 8.88498)
.AppendLineSegment 5.168406, 6.549606
.AppendLineSegment 2.019587, 6.549606
.AppendLineSegment 2.019587, 8.88498
.AppendLineSegment 5.168406, 8.88498
End With
ActiveSelection.Curve.CopyAssign crv
OrigSelection(1).Curve.Closed = True

and i was trying to manipulate this. I will go thru your code in detail and will test for a couple of options. will get back in case of any furthur problem. but thanks a lot. u were of great help. :-)


All times are GMT -5. The time now is 04:28.

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