Thank you VovKa ...
... in the meantime I solved it too
and it also works with various segment groups
I will study your code, because what you do is always interesting !
if you want to do some tests, use the attached dwg
thanks
bye
==========
Regarding 3dpolyline JOIN, ideas:
1. Project to XY (Z->0)
2. JOIN
3. Modify the Z coordinate to the original corresponding 3D point and regenerate the 3D polyline
==========
;|
Project the selection set curve to the XY plane, Z=0
|;
(setq plane
(xdge::constructor
"kPlane" '
(0 0 0) '
(0 0 1.0))) ;Coordinate origin 0,0, normal vector (0 0 1.0) AcGe kPlane
(setq g
(xdge::constructor x
)) ; Generate AcGe curve from AcDb curve
(setq g1
(xdge::getpropertyvalue g
"orthoproject" plane
)) ;Geometric curves are orthogonally projected onto the plane plane
(setq e1
(xdge::entity:make g1
)) ;Generate entity after projection
(if (xdrx_object_isa x
"AcDb2dPolyline") (xdrx_polyline_convertto e1)
) ;_ end of if
;If it is 2d Polyline, convert it to lwpolyline
(xdrx_entity_matchprop x e1)
;The entity attributes match the original curve, color, layer, linetype....
(xdrx_object_swapid e1 x)
;Entity ObjectId exchange to ensure that the newly generated curve entity name remains unchanged
(xdrx_entity_delete e1)
;Delete the original curve
(xdge::free g)
;Geometric curve entities release memory
) ;_ end of lambda
(xdrx_pickset->ents ss)
;Select set to entity table
) ;_ end of mapcar
(xdge::free plane)
;Geometry plane object releases memory
) ;_ end of defun
;|
Two-dimensional points query the original three-dimensional point table to obtain the coordinate Z value.
Make a new table ((x y) z)
|;
) ;_ end of defun
(if (and (xdrx_initssget
"\nSelect Curve<Exit>:") (setq ss
(xdrx_ssget '
((0 .
"*line,arc,ellipse,circle")))) ) ;_ end of and
;|
Save the 3dpolyline vertex table for later querying the Z value corresponding to the two-dimensional point
( ((x1 y1) z1)((x2 y2) z2) ... ((xn yn) zn) )
|;
(setq pts
(xdrx
-getpropertyvalue ss
"vertices") ;Select set curve vertex table
pts
(xd::
list:flat
-point pts
) ;One level bracket point table
) ;_ end of lambda
pts
) ;_ end of mapcar
) ;_ end of setq
(_Project->XY ss)
;;3dpolyline -> lwpolyline
(xdrx-curve-join ss)
;; LWPOLYLINE JOIN
) ;_ end of setq
) ;_ end of foreach
(setq pl3d
(xdrx
-3dpolyline
-make nPnts
)) ;;Generate new 3dpolyline
) ;_ end of progn
) ;_ end of if
)
=============
The above LISP code uses the XDRX-API, which can be downloaded from
https://github.com/xdcad/XDrx-API and is updated at any time.
The XDRX API encapsulates AcDb, AcEd, AcGe, AcBr... C++ library, using C++ methods to develop LISP programs.Thousands of Lisp functions are available.