Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Locate the point on 3D polyline which is an exact distance from the origin

12 REPLIES 12
SOLVED
Reply
Message 1 of 13
samu3
1733 Views, 12 Replies

Locate the point on 3D polyline which is an exact distance from the origin

Hi All,

 

Here is my challenge: I have a 3d polyline (see the attached dwg, 3d poly in green) that varies in x, y and z.

 

Then I have a line (green) with the exact length of 10 000 drawing units.

 

I want to be able to do either of these two things, which really serve the same goal:

 

1. To rotate the line about the origin in 3D so that the endpoint (10 000 from the origin) touches the 3D polyline.

 

2. To locate the point on the 3D polyline that is exactly 10 000 units from the start of the polyline/origin (not along the poly, measured as a straight line, therefore similar to point 1.)

 

Any suggestions are greatly appreciated,

Samu

12 REPLIES 12
Message 2 of 13
hwalker
in reply to: samu3

I don't know about 3d. I haven't even looked at your drawing, BUT

 

I suggest you draw a sphere which is 10000 in diameter, then where it crosses the 3D polyline is where the end of your straight polyline should go

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 3 of 13
samu3
in reply to: hwalker

Hwalker,

 

Thanks for the reply and that is exactly what I originally did. I could not grab onto the point where the sphere intersected the polyline, but I extruded the 3D polyline as well and used extrim, and by exploding the surface which was left of the 3D polyline extrusion I ended up with a spline, where the endpoint was the exact location on the 3D poly.

 

However, I was hoping to find a quicker and more elegant solution, since  the dwg I sent is just an example of something that will need to be performed tens if not hundreds of times.

 

Thanks,

Samu

Message 4 of 13
hwalker
in reply to: samu3

I've just tried a quick dirty trick which might work

 

This was only in 2D though

 

I made 2 polylines and rotated one, so that the end point was at the APPARENT INTERSECTION of it and the other polyline and it seemed to work.

 

You might need to use a 3D Rotate though

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 5 of 13
samu3
in reply to: hwalker

That's exactly it, I can make it work in 2D, but obviously do not know how to use 3Drotate to make it work in 3D...

 

Samu

Message 6 of 13
hwalker
in reply to: samu3

Unfourtunately you will need a 3D guru for that.

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 7 of 13
SEANT61
in reply to: samu3

Try this command macro (Uses the Sphere intersection method):

 

^C^C_Sphere;end;\\_Imprint;Last;\n;;_Explode;Last;

 

The sequence of events is something like this. 

First, set the PDMODE to something visible.

 

The macro is envoked, the user selects the start of the 3dPoly, enters the desired distance.

 

The appropriate shere is created.

 

The user then selects the 3DPoly.

 

A point is created at the intersection od sphere and Poly.

 

That procedure, and macro call creates this output at the command line.

 

Command: PDMODE
Enter new value for PDMODE <0>: 66
Command:
Command: _Sphere
Specify center point or [3P/2P/Ttr]: end
of
Specify radius or [Diameter] <1.0000>: 10000
Command: _Imprint
Select a 3D solid or surface: Last
Select an object to imprint:
Delete the source object [Yes/No] <N>: n
Select an object to imprint:
Command: _Explode
Select object: Last


************************************************************
May your cursor always snap to the location intended.
Message 8 of 13
JDMather
in reply to: samu3


@Anonymous wrote:

..

 

Any suggestions are greatly appreciated,

Samu


I thought you had access to Autodesk Inventor?

In Inventor I would do a 3D sketch, dimension the line and add coincident constraint.


-----------------------------------------------------------------------------------------
Autodesk Inventor 2019 Certified Professional
Autodesk AutoCAD 2013 Certified Professional
Certified SolidWorks Professional


Message 9 of 13
dbroad
in reply to: SEANT61

SEANT61,

Nice solution, well explained.

 

Here is a programmatic solution.  Save the program with a name that makes sense to you, in your trustedpaths folder, and with a .LSP extension. It changes the endpoint of the line to be at the appropriate point.

;;no error checking.  D.C. Broad 2014
(defun c:test  ( / ep param p1 p2 pt1 pt2 d1 d2 x l ptx ei el d)
  (prompt "Select 3dpoly")
  (setq ep (car (entsel)))
  (prompt "Select line")
  (setq el (car (entsel)))
  (setq ei (entget el))
  (setq d (distance (cdr(assoc 10 ei))(cdr(assoc 11 ei))))
  (setq param (vlax-curve-getparamatdist ep d))
  (setq	p1  (fix param) ;vertex param earlier
	p2  (1+ p1);vertex param later
	pt1 (vlax-curve-getpointatparam ep p1);point at p1
	pt2 (vlax-curve-getpointatparam ep p2)
	d1  (distance pt1 '(0 0 0))
	d2  (distance pt2 '(0 0 0))
	l   (- d2 d1)
	x   (- d d1)
	px  (+ p1 (/ x l))
	ptx (vlax-curve-getpointatparam ep px)) ;linear interpolation
  (prompt "Select line")
  (entmod (subst (cons 11 ptx) (assoc 11 ei) ei));assume 2nd point.
  (princ))

 

Architect, Registered NC, VA, SC, & GA.
Message 10 of 13
samu3
in reply to: dbroad

SEANT61 and dbroad,

 

Both the macro and lisp work great - exactly what I was looking for, thank you!

 

Regardingt the macro: I tried imprint before, but find it curious that you have to explode the sphere before the imprinted point appears... Had no idea, until now.

 

I was also able to get really close by gripping onto the right end of the line, with the dynamic input turned on I locked the length to be 10 000, and then brought the end of the line down to the 3d poly and snapped onto it.

JD, I do have Inventor, and what you described is how I would have done it. I am doing this in AutoCAD to feed my own curiosity and also help a guy who only has AutoCAD.

Thank you!

Samu

Message 11 of 13
fellowsgary2939
in reply to: samu3

I ran the routine outlined, but it only prompted for a 3D polyline, which it failed to select and thus aborted.

 

Any ideas why it failed?

Message 12 of 13
fellowsgary2939
in reply to: dbroad

It will not do anyhting when it is ran. Any thoughts? It asks to select the 3D polyline, but does nothing. Thoughts appreciated.
Message 13 of 13
dbroad
in reply to: fellowsgary2939

Did you have a 3d polyline to select in the drawing?

 

Did you select it?

 

Did you have another line?

 

Did you select it?

 

Post a drawing you attempted to use it with.

Architect, Registered NC, VA, SC, & GA.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost