nekonihonjin,
Here, maybe a little better.
As previously the 3dfaces are flattened and transformed into LWpoly.
If an LWpoly ends up close to colinear, it is rejected.
Command move is used to place the LWpoly in an empty space
in order to preserve your original set of 3DFaces.
A rectangle slightly bigger than this set is drawn to enclose it.
Command boundary is started with the set of LWPoly and the Rectangle
selected. Island detection is set to yes, and Object type to polyline.
At this point, the command awaits that you select points to define the external
and internal contours of your set.
The resulting boundaries created are kept.
We erase the set of flattened LWpoly, to make it easier to select
the correct boundaries.
You are prompted to select the boundaries to retain;
The rest of boundaries are erased.
This is close to the method used by VVA in program
ECOExcept that I could not get ECO to keep the right boundaries,
also only the external one would be created.
(defun c:test
(/ bb en ent i p p1 p2 pol rec ss ss1 w
) (prompt "\n Select 3dFaces: ") )
)
)
(setq bb
(ssboundingbox ss1
) )
(command "_BOUNDARY" "_A" "_B" "_N" ss1 rec
"" "_I" "YES" "_O" "POLYLINE" "" )
)
)
;; colinear_p ;
;; Return true if point is within 20 seconds of vector v1->v2 ;
;; ;
(defun colinear_p
(p v1 v2
/ xp yp
) (< (abs (- (* (- (cadr v1
) yp
) (- (car v2
) xp
)) (* (- (car v1
) xp
) (- (cadr v2
) yp
)))) 1e
-4
) )
;; butlast, Returns the list with last item removed. ;
;; Returns midpoint between two points ;
)
;; ;
;; mk_lwp by Alan J Thompson (Modified by ymg for closed poly) ;
;; ;
;; Argument: pl, A list of points (2d or 3d) ;
;; Create an LWPolyline at Elevation 0, on Current Layer. ;
;; Return: Entity Name ;
;; ;
(defun mk_lwp
(pl
/ isclosed
) )
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
)
)
)
)
;; ;
;; Selection Set Bounding Box - Lee Mac ;
;; Returns a list of the lower-left and upper-right WCS coordinates of a ;
;; rectangular frame bounding all objects in a supplied selection set. ;
;; s - [sel] Selection set for which to return bounding box ;
;; ;
(defun ssboundingbox
( ss
/ a b i m n o
) )
)
)
)
)
)