Jump to content

Finding the distance between objects

Recommended Posts

yo! so I'm exploring another side of VW scripting that ive hurts my brain... lol


i've built a cable tool that makes Soca Breakouts. part of that plugin involves me putting in how far away the fixture is from my soca breakout and it inserts another cable tool plugin that draws a line between the two and displays some important information. thats working great but i want to automate that even more...


i want to implement a feature that will find the distance between the fixture and breakout for me. i just don't understand the math or what functions i should be using to determine the distance. the truss and fixtures aren't always going to be the same orientation.


below is an example of what I'm calling typical setups... i'm assuming that the truss, fixtures, and soca breakout are all in 1 line. (ill add curved truss support some day) so i don't really need to find the x,y,z distance between them i just need the left or right distance relative to the overall rotation and location of everything. 


i've tried using functions like GetSymLoc3D() but it seems to get messy quickly. i've also tried using vs.Perp() and got some good results but only flat angles. i also don't quite understand Math Vectors or how to properly use them.


thanks for the help!



Link to comment

Thanks, ok, so first things first, I am not familiar with the Spotlight tools,lol. (VW Architect version user). But I assume the plugins work the same.

I'm still not following the diagram above. Am trying to figure out what objects are what.

- Is the gray truss a vectorworks object? I assume the magenta ones are the spotlight fixtures, and your custom plugin is the one labelled Soca breakout?

- And the grey lines are also another custom plugin? The cables one?


Each plugin will have an insertion point and a rotation value attached to it. I would start there and use basic trignometry (soh, cah, toa) to get exact locations and orientations of each object. Then using the vs.Distance call on the values you've calculated.


Could you share a dummy vwx file. I also have a Designer version that can open spotlight stuff.




Link to comment

sorry let me simply it. my issue doesn't really have to do with spotlight. the image attached is a representation of what i need to achieve. I'm trying to find distance from the blue object to the white object, then i will insert a plugin object that draws a line and other stuff that distance (represented by the red line).


i drew the red line straight because i don't care about the vertical offset i only care about how far away (left or right) the objects is RELATIVE to the overall angle and location in the drawing. i hope that makes sense. 


this is hard for me to explain. 

Screen Shot 2022-08-04 at 10.50.44 PM.png

Link to comment

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.

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.

  • Create New...