Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
Is there any Lisp to create boundaries for enclosed objects automatically ?? (line,polyline,arc,circle)
Solved! Go to Solution.
Hi all,
Is there any Lisp to create boundaries for enclosed objects automatically ?? (line,polyline,arc,circle)
Solved! Go to Solution.
Sure there is, but if you want lisp, you'll have to write it, cos I am not going to post it... If you need other alternative solution, here is it - it's called SuperBoundary...
https://www.superboundary.com/
HTH., M.R.
Hi, Marko.
That looks pretty cool. In what language was it written?
Can it create a boundary (not a dumb boundingbox) around mtext?
John F. Uhden
There is a cost for superboundary can appreciate that.
Mtext boundary maybe use TXT2GEOM 1st it blows apart the text way better that the built in one. But still need to do a boundary somehow.
Thinking about it now explode text and do a crosssection style draw lines at a spacing, then somehow trim inside. Need to work out pt order to keep.
Try this [minimally tested]. It makes a perimeter area around [slightly outboard of] the selected objects, runs a BOUNDARY command picking locations at small increments throughout that area, and gets rid of the surrounding-area perimeter object as well as the Polyline coinciding with it that BOUNDARY creates.
(defun C:BM ; = Boundary Multiple
(/ ss n minpt maxpt eLL eUR LL UR stepH stepV base pt)
(if
(setq ss (ssget '((0 . "LINE,*POLYLINE,ARC,CIRCLE,SPLINE,ELLIPSE"))))
(progn ; then
(repeat (setq n (sslength ss)); determine extents of selected objects
(vla-getboundingbox (vlax-ename->vla-object (ssname ss (setq n (1- n)))) 'minpt 'maxpt)
(setq
eLL (vlax-safearray->list minpt)
eUR (vlax-safearray->list maxpt)
LL (if LL (mapcar 'min eLL LL) eLL)
UR (if UR (mapcar 'max eUR UR) eUR)
); setq
); repeat
(command
"_.isolateobjects" ss ""
"_.zoom" LL UR "_.zoom" "0.9x"
"_.rectangle" ; perimeter area around selected objects
"_none" (setq LL (polar LL (angle UR LL) (* (distance LL UR) 0.05)))
"_none" (setq UR (polar UR (angle LL UR) (* (distance LL UR) 0.05)))
); command
(setq
stepH (/ (- (car UR) (car LL)) 100)
stepV (/ (- (cadr UR) (cadr LL)) 100)
base (polar LL (/ pi 2) stepV)
pt base
); setq
(command "_.boundary" "_advanced" "_island" "_no" "" "")
(repeat 99
(repeat 99 ; row of pick points
(command (setq pt (polar pt 0 stepH)))
); repeat
(setq base (polar base (/ pi 2) stepV) pt base); move up for next row
); repeat
(command
"" ; end Boundary
"_.erase" "_fence" LL (list (car UR) (cadr LL)) "" ""
"_.unisolateobjects"
"_.zoom" "_previous" "_.zoom" "_previous"
); command
); progn
); if
(princ)
); defun
Depending on the typical density of selected objects, the number of locations it breaks the width and height of the surrounding area into may be able to be reduced, or may need to be increased. Change the 100's and the 99's [two of each] to whatever number of divisions you want to try, and one fewer than that, respectively.
[If you have .BLIPMODE turned ON, you can watch it pick its points as it goes along. The blips will be cleared by the ZOOMs at the end.]
EDIT: One thing that maybe it should be adjusted for [if possible] is that it sometimes includes a Polyline around the collective Polylines in the smaller areas -- the highlighted one here, as produced in your sample drawing:
It didn't do that in my own drawing trial -- turning off island detection is intended to prevent it. I don't know why it does it in your drawing. And since it doesn't always do it, I'm not sure how to do anything about it.