Visio Guy

Visio Discussions => General Visio => Topic started by: Noisy Cricket on October 06, 2016, 04:09:44 PM

Title: Mimic crane movement - which control point is leading!?
Post by: Noisy Cricket on October 06, 2016, 04:09:44 PM
Hi all,

I'm looking into having a visio sheet that shows a revolving crane from the side and top.
There will be 2 control points that can manipulate the crane boom.
The side view controls the slewing angle (angle between crane boom and horizon) and the top view control controls the rotation of the whole crane.

Plan is that when control #1 is moved, #2 should follow in the other view and vice versa but I can't get my head around how to manage this. Maybe a Setf and depends function supported by user data?

Any thoughts?!


Thanks in advance,


Gijs

Gijs
Title: Re: Mimic crane movement - which control point is leading!?
Post by: wapperdude on October 06, 2016, 04:32:40 PM
the SETATREF set of functions is what you need.  It allows the control point to be slaved and retain independent control.  There's a SETATREF post in the User submitted section that I did.  A variety of techniques are shown in the attached files.

Wapperdude
Title: Re: Mimic crane movement - which control point is leading!?
Post by: vojo on October 06, 2016, 04:54:48 PM
Side view should be cosine of top view control point

Top view should be the X length of the side view from reference point

Setatref is one option
Guard is another
    Side view would have guard around x control....Y would move vertical...
    then would need to recalculate up/down boom length and angle for controller point

    Top view would have guard around Y controller....X would move horizontally
    Trick here would Y = guard (control.X * sin(angle off X)) kind of thing....<sin would need to the equation to translate
    X into Y ...sin if truly a circle....ellipse algebra if not.

a lot of shapes do the guard sin kind of thing for control points on an isometric shape
Title: Re: Mimic crane movement - which control point is leading!?
Post by: wapperdude on October 06, 2016, 05:48:13 PM
Here's a post that does just 2-D implementation of slaved control points: http://visguy.com/vgforum/index.php?topic=5450.msg21617#msg21617 (http://visguy.com/vgforum/index.php?topic=5450.msg21617#msg21617)

It shows basic technique which should be adaptable.

HTH
Wapperdude
Title: Re: Mimic crane movement - which control point is leading!?
Post by: Noisy Cricket on October 06, 2016, 06:47:32 PM
Hi everyone,

Thanks for the tips. I've not used the setatref function to date so it might take me a while to understand it and what's worse I also don't know my way yet with controls.... For some reason they tend not to do what I'd expect them to do.

I'll give it a  go tomorrow.

Are there any other typical applications?


Title: Re: Mimic crane movement - which control point is leading!?
Post by: wapperdude on October 06, 2016, 07:45:26 PM
Check out the "What's with SETATREF" post.  The attached files have quite a few examples.  Good starting point.



Title: Re: Mimic crane movement - which control point is leading!?
Post by: Noisy Cricket on October 06, 2016, 09:30:58 PM
Seems to be fairly straightforward and works perfectly for the two views on the crane boom. There's a couple of things bothering me and that's that the boom length isn't fixed.

The top view should control the slewing angle (as the boom has a constant length) and vice versa, the side view would also drive the slewing angle.

Secondly, the hook/wire doesn't seem to want to follow when the boom is raised/lowered.


Last but not least: How the hell do these controls work! is there a "logic" to them and what are the differences in behaviour that can be selected?!

I'll try and upload what I have tomorrow.

Regards, & thanks in advance,


Gijs
Title: Re: Mimic crane movement - which control point is leading!?
Post by: wapperdude on October 06, 2016, 09:52:05 PM
The controls are moveable points, duh.  The key is, they're local to the shape that the shapesheet belongs to.  The coordinates are defined relative to width and height of the shape.  That works fine for simple shapes.

It can get a little more involved with grouped shapes as the coordinates need to be translated from the parent to the sub shape.  If all you're doing is controlling the subshape PinX and PinY, it's straight forward.  Assume the group is Sheet.3, then, subshape PinX = Sheet.3!Controls.Row_1, and PinY = Sheet.3!Controls.Row_1.Y.  But, if you're trying to control an entry in the subshape's Geometry section, then, you need to translate the Sheet.3 coordinates to subsheet coordinates.  They're not the same.  Enter LoctoPar function.  That's really the only magic.

Wapperdude
Title: Re: Mimic crane movement - which control point is leading!?
Post by: Noisy Cricket on October 09, 2016, 06:33:45 PM
Hi all,

I seem to have the "simple" setatrefs down as the 3 views seem to synchronise.
There's 2 things that I can't seem to get to work:

1) link between the section view and top view of the crane where the boom beginy and endy need to synchronise with the other boom's beginx and endx. I'm getting a circular reference error.

2) manipulate the "wire" which subsequently raises and lowers the cargo.

I've attached the file for reference and would be very grateful for some guidance
Suggestions to easily manipulate the boom (regardless of section) is also welcome.


Thanks in advance for your time and consideration
Title: Re: Mimic crane movement - which control point is leading!?
Post by: wapperdude on October 10, 2016, 03:22:06 PM
I took a quick look at your drawing.  Don't believe SETATREF is needed.  Setf, Getref should be fine.  Plenty of examples for those fcns.

A change I would make.  For the boom arm, make LocPin X = 0, LocPin Y = 0.  That way, the begin point is the reference, i.e., the anchor point for all boomarm actions.  Then,vIsit would lock, once the begin point is correctly placed, I would lock it down with the guard function.

There needs to be some interactive math governing the boomarm end point and the control points.  Consider the side view.  A control point is used to raise and lower the boom.  The x-, y- position would be funtion of a control point via cos, sin fcns.  This cntl pt need only slide, horizontally (or vertically, but not both) to effect the boom arm up/down motion.  So, the canto pts linear motion uses trig fcns to move boomarm end point.

Similarly, for the top view, a 2nd cntl pt to effect the rotation.  In this case, you may have to incorporate ang360 fcn to help keep the end point in the correct quadrant.

Finally, there's some math to coordinate these views.  Trying to explain this makes it seem really complicated.  My suggestion is to find Visio shapes that mimic some of the actions you want, e.g., angle measurement shapes.  Look at shapesheet to see what's done, what formulas used.  I have a busy day, so can't provide much timely help.

Wapperdude
Title: Re: Mimic crane movement - which control point is leading!?
Post by: Noisy Cricket on October 10, 2016, 06:34:57 PM
I've never understood the use of getref.

Apart from that, at this point, I think everything works where the crossectional view primarily follows the plan and profile views.
Only thing that I can't get a grip on is the overall length of the boom (or the actual boom length).

Having said that, my interest in working on this particular file has ebbed away.... to wait for another day.
Title: Re: Mimic crane movement - which control point is leading!?
Post by: wapperdude on October 10, 2016, 07:13:42 PM
Getref is just the fcn to grab a cell.  It's almost exclusively used with SETF.  Which brings up the question, why is SETF not defined so that getref is unnecessary?

So, if you want to add a value or something into a cell, you use SETF(GETREF(theTargetCell),the quantity).  Nothing spectacular.  SETF is rude, overwrites whatever is currently in the cell ... more or less.

Wapperdude
Title: Re: Mimic crane movement - which control point is leading!?
Post by: wapperdude on October 10, 2016, 09:47:16 PM
Since you're shelving this project, I didn't spend too much time on it.  But, I did want to put something together for your future reference.

There are only two controls:  one to raise lower the boom, and one to rotate the boom, 360 deg.  Could add a 3rd to rasie/lower the load... leave that to you.

The sideview has the controls.  The other views are slaved to the motion of the side view.  Note, no SETF or SETATREF needed for this task.  Just control points, some trigonometry, and necessary shape references.

Enjoy!
Wapperdude
Title: Re: Mimic crane movement - which control point is leading!?
Post by: Noisy Cricket on October 14, 2016, 06:07:04 AM
Hi!

Much appreciated. This "boost" might just want me to take it off the shelf again.
Lowering the load would be great and maybe one could even make the load "sense" that it's on deck and then release it!?

I'll have a look and see.

Thanks again.

Gijs\
Title: Re: Mimic crane movement - which control point is leading!?
Post by: wapperdude on October 14, 2016, 03:49:39 PM
Is this for work or for fun?

Adding control to move load...raise/lower, follow boom arm relatively easy.  Making an arbitrary, detachable load would take some code.

I think "in the neighborhood" VBA commands could detect/identify the "hook" relative to a load, ask user to attach/release.  Likewise, attached load could detect its position relative to ship deck...inside deck boundary, too high for release.  Those sort of things.  Very sure takes more than what shapesheet alone could provide.

Pretty sure it's all do-able.

Title: Re: Mimic crane movement - which control point is leading!?
Post by: Noisy Cricket on October 26, 2016, 06:07:43 PM
Hi Wapper,

Making the sheet is for fun, application is work related.... best of both worlds?
Just can't  get the control points to do what I want them to do because I don't understand them.
Also haven't worked with "in the neighbourhood"-VBA code (spatial neighbours?) but it's good to know there's always more to learn :)

Also looking to see if anyone could code something similar easily in Java or other app-like browser enabled piece of software to avoid having to deploy visio shapes (not everyone has visio in our organisation)

Title: Re: Mimic crane movement - which control point is leading!?
Post by: wapperdude on October 27, 2016, 03:18:14 PM
As bit of encouragement, and, perhaps, a starting point for further development, the attached Visio file has 3 controls: raise / lower boom arm, rotate boom arm, raise/lower hook.  Also, 2 macros:  one to attach load to the hook and one to release the load.  The macros will only work for side view as written, but can be modified to do the other views.

Wapperdude
Title: Re: Mimic crane movement - which control point is leading!?
Post by: Noisy Cricket on October 27, 2016, 05:58:52 PM
Suppose a "setf" pushing pinx/y to the endx/y of the crane wire would also work to connect?

I'll have a look soonest because right now it's...... WEEKEND! (and time for bok bier!)

And 4 nations rugby starts tomorrow :)