CamBam
News:
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
June 24, 2017, 16:38:44 pm


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Is Snap-to-intersection available or being considered as a plug-in  (Read 791 times)
airnocker
Wookie
****
Offline Offline

Posts: 338


View Profile
« on: January 11, 2017, 21:00:47 pm »

Is Snap-to-intersection available or being considered as a plug-in?  I've searched the forum and available plug-ins but do not find such.

Thanks
Logged

airnocker

Everything depends on everything else
lloydsp
CNC Jedi
*****
Online Online

Posts: 6895



View Profile
« Reply #1 on: January 11, 2017, 21:09:36 pm »

Nocker, I don't know of that just now.

One way to deal with it until such a plug-in exists (an 'ersatz' method, but it works) is to draw points at intersections (edit/intersection Points).  Snapping to points is already supported in the UI.

Lloyd
Logged

"Pyro for Fun and Profit for More Than Fifty Years"
airnocker
Wookie
****
Offline Offline

Posts: 338


View Profile
« Reply #2 on: January 11, 2017, 22:03:04 pm »

Thanks Lloyd.  That is what I've been doing as a current work around for years.  Drawing rectangles to represent oval mounting tabs on AC low power transformer mounts, drawing in diagonals across corners to derive center of rectangle, then adding a "point" at the intersections.  Done this numerous times before and was hoping for the snap-to-intersection "privilege".  Wink Wink
Logged

airnocker

Everything depends on everything else
lloydsp
CNC Jedi
*****
Online Online

Posts: 6895



View Profile
« Reply #3 on: January 11, 2017, 22:14:27 pm »

Well... I'm not in a position to research it, but it should be possible.  If intersections can be found in order to make points at them, then they should be detectable to make 'snap' work.

I don't know enough about that to speak authoritatively about it.

Lloyd
Logged

"Pyro for Fun and Profit for More Than Fifty Years"
dh42
Administrator
CNC Jedi
*****
Online Online

Posts: 4436



View Profile WWW
« Reply #4 on: January 11, 2017, 23:25:11 pm »

Hello,

A workaround: Menu Edit/intersection points > creates point at intersection of selected objects, then you can use them as snap points.

oops, sorry, I don't see Lloyd reply ..

++
David
« Last Edit: January 11, 2017, 23:27:42 pm by dh42 » Logged
airnocker
Wookie
****
Offline Offline

Posts: 338


View Profile
« Reply #5 on: January 12, 2017, 04:18:48 am »

Lloyd and David, now Edit > Intersection Points for selected objects works perfectly for me.  I've never noticed that menu item.  (I misread Lloyd suggestion of this originally, sorry Lloyd).

Many thanks.
Logged

airnocker

Everything depends on everything else
onekk
Wookie
****
Offline Offline

Posts: 267


View Profile
« Reply #6 on: January 21, 2017, 09:21:07 am »

I use a mechanism similar to this "in some of my plugins that draw shapes" I add a "Construction" Layer and my code adds the "important points" as a Polyline in this layer, so it is easy when the figures are costructed to select and move the different figures allining the centers of each figure, but is a workaround, and my work is done at the creation time.

It has not to be too difficult to add a plugin that do it in automated ways, here one of my methods to find a line intersection point, if p1,p2 and bp1,bp2 are the diagonals of of a rectangle the pti point is the center.

the methods return true if the intersection exist, otherwise false.

Code:
static bool LinesIntersect(Point2F p1, Point2F p2, Point2F bp1, Point2F bp2, out Point2F pti)
{
double dxa = p2.X - p1.X;
double dya = p2.Y - p1.Y;
double dxb = bp2.X - bp1.X;
double dyb = bp2.Y - bp1.Y;

double d = (dya * dxb - dxa * dyb);

double t1 = ((p1.X - bp1.X) * dyb + (bp1.Y - p1.Y) * dxb)/ d;

if (double.IsInfinity(t1))
{
pti = new Point2F (double.NaN, double.NaN);
return false;
}

// Find the point of intersection.
pti = new Point2F(p1.X + dxa * t1, p1.Y + dya * t1);
return true;
}

Regards
Logged

Carlo D. (onekk)

eShapeoko #343 750x1000 mm + GRBL + bCNC + CamBam
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.12 seconds with 19 queries.

Copyright © 2008 HexRay Ltd. | Sitemap