Hi, I have 2 3Dpolyline in my drawing. The first has the correct X Y (Lat,Lon) coordinates but not the correct Z values in the vertexes. The second is close to him has the correct Z values but not the correct X Y. I need to move the vertexes of the second according to those of the first but without changing the Z values. Any idea for this kind of task?
Thanks in advance
Solved! Go to Solution.
Hi, I have 2 3Dpolyline in my drawing. The first has the correct X Y (Lat,Lon) coordinates but not the correct Z values in the vertexes. The second is close to him has the correct Z values but not the correct X Y. I need to move the vertexes of the second according to those of the first but without changing the Z values. Any idea for this kind of task?
Thanks in advance
Solved! Go to Solution.
Solved by cadffm. Go to Solution.
Or properties palette,
but this isn't accurate (or better, you don't know the exact X Y values to set XY accurately.
Sebastian
Or properties palette,
but this isn't accurate (or better, you don't know the exact X Y values to set XY accurately.
Sebastian
A sample file with 3D polylines would help provide a possible solution. It's not clear how the vertices of the 3dpoly with the correct z value correlate, if at all, with the 3dpoly with the correct x ad y values.
Here's an approach that might yield a satisfatory solution.
In the image below it is assumed that the red 3dpoly has the correct x,y values and the green 3dpoly has the correct z values The yellow plane lies n the XY plane and is present to help visualize the 3D nature of the lines.
A copy is made of the red 3dpoly and then going to the top view flatten is used to project it to the XY plane where extrude is used to make a surface prependicular to the xy plane. Using 3dforbit, a view is choosen that is deemed the best orientation for projecting the green 3dpoly onto the surfaces created from the red 3dpoly. The result will look something like this.
We want the line formed by the intersetion of the magenta surfaces with the cyan surfaces. Since there isn't a command (that I am aware of) to find the intersection of sufaces you can create thin solids for each set of surfaces by first using thicken on the surfaces with a small value and then create a single solid from all the magenta solids and then all the cyan solids. The Boolean intersect command is then used to find the intersection of the two solids. shown in white below.
From here a 3Dpoly can be created from the vertices along one edge of the white solid.
A sample file with 3D polylines would help provide a possible solution. It's not clear how the vertices of the 3dpoly with the correct z value correlate, if at all, with the 3dpoly with the correct x ad y values.
Here's an approach that might yield a satisfatory solution.
In the image below it is assumed that the red 3dpoly has the correct x,y values and the green 3dpoly has the correct z values The yellow plane lies n the XY plane and is present to help visualize the 3D nature of the lines.
A copy is made of the red 3dpoly and then going to the top view flatten is used to project it to the XY plane where extrude is used to make a surface prependicular to the xy plane. Using 3dforbit, a view is choosen that is deemed the best orientation for projecting the green 3dpoly onto the surfaces created from the red 3dpoly. The result will look something like this.
We want the line formed by the intersetion of the magenta surfaces with the cyan surfaces. Since there isn't a command (that I am aware of) to find the intersection of sufaces you can create thin solids for each set of surfaces by first using thicken on the surfaces with a small value and then create a single solid from all the magenta solids and then all the cyan solids. The Boolean intersect command is then used to find the intersection of the two solids. shown in white below.
From here a 3Dpoly can be created from the vertices along one edge of the white solid.
Will the two of them always have the same number of vertices? If so, it should not be complicated to use the 'Coordinates VLA property, and just replace every third number [the Z coordinate of each vertex] in one of them with those from the other, then impose the revised list on the one you want to change. Does that sound like it would work?
EDIT:
For example, this works for me [in minimal testing]:
(defun C:3DPXYR ; = 3DPolyline XY coordinates Replacement
(/ 3dXY 3dZ XYobj Xobj XYcoords Zcoords n newcoords)
(if
(and
(setq 3dXY (car (entsel "\n3DPoly with correct XY coordinate values: ")))
(member '(100 . "AcDb3dPolyline") (entget 3dXY))
(setq 3dZ (car (entsel "\n3DPoly with correct Z values to have other's XY values imposed: ")))
(member '(100 . "AcDb3dPolyline") (entget 3dXY))
(= (vlax-curve-getEndParam 3dXY) (vlax-curve-getEndParam 3dZ)); same # of vertices
(= (vlax-curve-isClosed 3dXY) (vlax-curve-isClosed 3dZ)); either both closed or both open
); and
(progn ; then
(setq
XYobj (vlax-ename->vla-object 3dXY)
Zobj (vlax-ename->vla-object 3dZ)
XYcoords (vlax-get XYobj 'Coordinates)
Zcoords (vlax-get Zobj 'Coordinates)
); setq
(repeat (setq n (length Zcoords))
(setq newcoords
(cons
(nth
(setq n (1- n))
(if (= (rem n 3) 2) Zcoords XYcoords)
; take every third one from Z list, others from XY
); nth
newcoords
); cons
); setq
); repeat
(vlax-put Zobj 'Coordinates newcoords); impose revised coordinates
); progn
(prompt "\nMust be two 3DPolylines with same number of vertices."); else
); if
(prin1)
)
It could omit the check on whether they're either both open or both closed, if preferred, or the no-go prompt could be extended to mention that requirement.
Will the two of them always have the same number of vertices? If so, it should not be complicated to use the 'Coordinates VLA property, and just replace every third number [the Z coordinate of each vertex] in one of them with those from the other, then impose the revised list on the one you want to change. Does that sound like it would work?
EDIT:
For example, this works for me [in minimal testing]:
(defun C:3DPXYR ; = 3DPolyline XY coordinates Replacement
(/ 3dXY 3dZ XYobj Xobj XYcoords Zcoords n newcoords)
(if
(and
(setq 3dXY (car (entsel "\n3DPoly with correct XY coordinate values: ")))
(member '(100 . "AcDb3dPolyline") (entget 3dXY))
(setq 3dZ (car (entsel "\n3DPoly with correct Z values to have other's XY values imposed: ")))
(member '(100 . "AcDb3dPolyline") (entget 3dXY))
(= (vlax-curve-getEndParam 3dXY) (vlax-curve-getEndParam 3dZ)); same # of vertices
(= (vlax-curve-isClosed 3dXY) (vlax-curve-isClosed 3dZ)); either both closed or both open
); and
(progn ; then
(setq
XYobj (vlax-ename->vla-object 3dXY)
Zobj (vlax-ename->vla-object 3dZ)
XYcoords (vlax-get XYobj 'Coordinates)
Zcoords (vlax-get Zobj 'Coordinates)
); setq
(repeat (setq n (length Zcoords))
(setq newcoords
(cons
(nth
(setq n (1- n))
(if (= (rem n 3) 2) Zcoords XYcoords)
; take every third one from Z list, others from XY
); nth
newcoords
); cons
); setq
); repeat
(vlax-put Zobj 'Coordinates newcoords); impose revised coordinates
); progn
(prompt "\nMust be two 3DPolylines with same number of vertices."); else
); if
(prin1)
)
It could omit the check on whether they're either both open or both closed, if preferred, or the no-go prompt could be extended to mention that requirement.
Thank you very much. The code works great but in my case the number of vertex is not to same. So I had to do it manually.
Thanks again sir
Thank you very much. The code works great but in my case the number of vertex is not to same. So I had to do it manually.
Thanks again sir
@yu85.info wrote:
.... in my case the number of vertex is not to same. So I had to do it manually. ....
That seems the only possible way, under the circumstances. You would need to make choices about which vertices you assigned which values from which vertices of the other Polyline, if they don't match up one for one. Maybe if you could define some criteria for determining that, it could be automated, but it's hard to imagine.
@yu85.info wrote:
.... in my case the number of vertex is not to same. So I had to do it manually. ....
That seems the only possible way, under the circumstances. You would need to make choices about which vertices you assigned which values from which vertices of the other Polyline, if they don't match up one for one. Maybe if you could define some criteria for determining that, it could be automated, but it's hard to imagine.
Its ok sir, do not bother yourself sometimes I just have to deal with my mistakes manually 🙂
Its ok sir, do not bother yourself sometimes I just have to deal with my mistakes manually 🙂
Can't find what you're looking for? Ask the community or share your knowledge.