Jump to content
Sign in to follow this  
J. Miller

Control Points Before & After

Recommended Posts

Hello,

I am trying to determine if a user has moved a certain Control point. When would I collect the original position location of the control point (prior to user movement) and where would I collect the new position of the control point (after the user has moved it). this is an event enabled PIO.

Thanks,

Jeff Miller

Share this post


Link to post
Hello,

I am trying to determine if a user has moved a certain Control point. When would I collect the original position location of the control point (prior to user movement) and where would I collect the new position of the control point (after the user has moved it). this is an event enabled PIO.

Thanks,

Jeff Miller

That depends on what you want to do with it.

Is it only the first time the user moved it, or each time( each object refresh) the position doesn't match the original ? OR Each time moved, not always on object refresh ?

You could also add the startposition on the object creation event into a second field, this way you can compare that value with the current stored value each time the script gets calculated.

Another way is mentioned in the above post and this will only trigger an event when the point is CHANGED, and not on each object refresh.

Choose wisely ;)

Edited by hippothamus

Share this post


Link to post

I want to move another control point if the control point in question is moved by the user. (Similar to a dimension, moving the text in relation to the dimension line, but allowing the user to place text where they want it. So it (the text) would have to change each time the user moves the control point (dimension line) in question. I need to determine the offset distance between the two control points prior to movement and relocate the second control point (the text) after the movement based on the original offset distance. I am hoping the vsoStateGetParamChng function will work for me.

Jeff

Share this post


Link to post

vsoStateGetParamChng will do what you want. One thing to note - the expected parameter index assigns and index to the x and y of the control point, but if you look at the parameter list in the Plug-In Editor, each pair only gets one ID. In other words, if you're looking at IDs in the Editor, add one at every ControlPoint0nY.

I believe there are other posts in this forum on using states.

-Josh

Share this post


Link to post

The problem with using vsoStateGetParamChng in VS with control points is that a control point consists of 2 parameters (X and Y). You only get one parameter change notification per event with VS so you can see that X has changed but you don't know about Y, or the previous value of Y.

(I don't even know if control points changes send any info for vsoStateGetParamChng because of this limitation in VS.)

I think you may still need to rely on the old methods and store the old values in another set of fields and compare them during the reset event to determine if the control points have been moved and how far. You may be able to use event notifications to tell the object was reset by a control point move but you won't be able to determine the previous value unless you store it.

Share this post


Link to post

When the user moves the first control point it will trigger the parameter change event. In turn you can then set the location of the second control point and the text with SetRField.

Share this post


Link to post

so when or where in the script can i determine the existing difference between the two Control points (prior to the user move)so that I can store this information in a field for later use

vsoStateGetParamChng( objectHan , widgID, paramIndex ,oldValue) returns an "unknown" when a control Point is moved.

Jeff

Share this post


Link to post

You can't get the previous value so you have to store the "current value" from the reset as the "old value" to be examined in the next reset if that makes any sense.

You can do the compare in the beginning of the reset event.

You have to check for IsNew to see if it's the first time the object is being placed and handle that case separately since there will be on "old value"

In the reset compare the "old value" that you have stored in another parameter(s) (based on the previous reset event with) the values currently in the control point.

If they are different you know the user has moved to control point and you can calculate the difference using the "old value" and the current value.

At the end of the script always copy the current control point values into the "old value" fields so they will be ready for the next possible move.

Share this post


Link to post

Thanks for all the input.

I give this a shot.

Providing an offset parameter is another way, its just not as robust.

Jeff

Share this post


Link to post

From what you describe what you want it is very easy.

Your plugin will reset (I think) when the user changes the position of the controlpoint 1.

All you have to do is place CP2 on a distance from CP1. When CP1 changes, CP2 will change the same way. No need for special event stuff.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...