修改了下代码,试试下面的
 - (defun c:tt ()
- (if (and (setq e1 (car (xdrx_entsel
- "\nSelect the first polyline<Exit>:"
- '((0 . "LWPOLYLINE"))
- )
- )
- )
- (setq e2 (car (xdrx_entsel
- "\nSelect second polyline <Exit>:"
- '((0 . "LWPOLYLINE"))
- )
- )
- )
- )
- (progn
- (setq g1 (xdge::constructor e1)
- ;;Construct the geometric entity of the first polyline
- g2 (xdge::constructor e2)
- ;;Construct the geometric entity of the second polyline
- )
- (if (setq gint (xdge::constructor "kCurveCurveInt3d" g1 g2))
- ;;Construct AcGeCurveCurveInt3d object from two geometric entities
- (progn
- (setq num (xdge::getpropertyvalue gint "overlapcount"))
- ;;Get the number of overlapping segments
- (setq i -1
- ss (ssadd)
- )
- (repeat num
- (setq i (1+ i)
- g (xdge::getpropertyvalue gint "getOverLapRanges" i)
- ;;Get the overlapping curve range parameters of the i-th segment
- intv1 (car g)
- ;;Get the range AcGeInterval object of the overlapping part of the first curve
- param (xdge::getpropertyvalue intv1 "getbounds")
- ;;Get the upper and lower range of curve parameters from AcGeInterval
- )
- ;(setq e (xd::curve:getsub e1 (car param) (cadr param) 0))
- (setq e (xdge::setpropertyvalue g1 "setinterval" (car param) (cadr param) ))
- ;;Call the general LISP function library function to deduct part of the curve entity (geometric entity)
- (xdge::entity:make e)
- ;;Generate database AcDbPolyline object
- (xdrx_setpropertyvalue
- ;;Set color 6, constant width 60
- (entlast)
- "color"
- 6
- "constantwidth"
- 60.0
- )
- (ssadd (entlast) ss)
- )
- (xdrx_prompt
- "\n"
- num
- "overlapping segments found, marked in magenta."
- )
- (sssetfirst nil ss)
- )
- )
- (xdge::free)
- )
- )
- (princ)
- )
|