PDA

View Full Version : Query regarding line nodes



Tecnik
05-04-2006, 01:48 AM
Hi there,

I have a several subroutines for moving things round a page and they all work fine, I've posted an example below:-

Sub moveRight()
Selection.ShapeRange.IncrementLeft 7.5
End Sub

I've been trying a number of different ways to apply the same sort of thing to a line node but haven't had any success.

Please can someone tell me if this is possible? I was trying to do something like this:-

Sub movePoint()
Selection.ShapeRange.Nodes(1).IncrementLeft -7.5
End Sub


=====================================================

Update:
Since posting the code above I've come a lot closer to what I want.
Here's the new code:-
Sub movePoint4()
Set Nds = Selection.ShapeRange.Nodes
With Nds
pointsArray = .Item(2).Points
currXvalue = pointsArray(1, 1)
currYvalue = pointsArray(1, 2)
'MsgBox (currXvalue & currYvalue)
.SetPosition 2, currXvalue + 10, currYvalue + 10
End With
End Sub

The problem I'm having now is that the move 10,10 seems to move the node to the position 10,10 on the current page instead of adding 10 to the x and y positional values.
I think this is due to currXvalue and currYvalue being wrong.

Does anyone have any ideas as to why this could be? It's as if the current x and y position are in different units to the move I'm trying to do.

Thanks

Nick

fumei
05-04-2006, 10:04 PM
Could you explain the purpose and intention of this?

Tecnik
05-05-2006, 01:09 AM
Hi Gerry,

Thanks for the reply. Sorry, I'd not explained enough.

Basically, lets say I've drawn a horizontal line on a page. If I then select the line and click on 'edit points' two nodes appear, one on each end of the line. If you then click and drag one of the nodes you can alter it's position, and therefore the length and angle of the line.
What I'm trying to do is create a macro for moving the node so I can then assign that to a keyboard shortcut, for example 'shift' and the arrow keys, rather than using the mouse.

I've done this for moving lines and boxes round the page and they work fine. I've also taken it as far as creating macro's that move items by a larger increment when say the 'alt' and arrow keys are used together.

I know it's splitting hairs, but I've noticed that when I try edit the position of a node on a horizontal line, and constrain it's movement using the Shift key, sometimes the new line has a step in it. It's as if the node has a new vertical position even though I've constrained it's movement to the horizontal.

I was trying to work forward from an example I found in the 'Microsoft Visual Basic Help' which says:-


This example moves node two in the third shape on the active document to the right 200 points and down 300 points. The third shape must be a freeform drawing.
with this example:-
With ActiveDocument.Shapes(3).Nodes
pointsArray = .Item(2).Points
currXvalue = pointsArray(1, 1)
currYvalue = pointsArray(1, 2)
.SetPosition 2, currXvalue + 200, currYvalue + 300
End With

When I try this the node moves to the position 200,300, not 200 to the right and 300 down as mentioned and that's what I can't understand.

Hope this helps.

Thanks,

Nick