TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: wll85 on July 24, 2010, 04:17:36 AM
-
:-) thx .
-
Post what code you have, and we can help you towards a solution.
-
Didn't Luis do something like this?
-
Didn't Luis do something like this?
Yes, I think that guy did something similiar, but remember it was without the curves implementation, as far I recall.
-
Didn't Luis do something like this?
Yes, I think that guy did something similiar, but remember it was without the curves implementation, as far I recall.
LoL
Your predecessor, LE? :lmao:
-
Didn't Luis do something like this?
Yes, I think that guy did something similiar, but remember it was without the curves implementation, as far I recall.
LoL
Your predecessor, LE? :lmao:
Yep, that's the one.... the routine it is named AutoWalls, btw :)
-
I suppose you could cheat :evil:
(http://www.theswamp.org/screens/leemac/Bound.gif)
-
And it begins.... :lmao:
-
And it begins.... :lmao:
:-D :-D
-
I shan't tease...
(defun c:bound ( / *error* var old ss objs lst poly bbox )
(vl-load-com)
;; © Lee Mac 2010
(defun *error* ( msg )
(and old (mapcar 'setvar var old))
(or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
(princ (strcat "\n** Error: " msg " **")))
(princ)
)
(setq var '("CMDECHO" "OSMODE") old (mapcar 'getvar var))
(mapcar 'setvar var '(0 0))
(if (and
(ssget "_:L" '((0 . "~VIEWPORT,~*TEXT")))
(setq *off*
(cond
(
(getdist
(strcat "\nSpecify Width <"
(rtos
(setq *off*
(cond ( *off* ) ( 1.0 ))
)
)
"> : "
)
)
)
( *off* )
)
)
)
(progn
(vlax-for o
(setq ss
(vla-get-ActiveSelectionSet
(vla-get-ActiveDocument
(vlax-get-acad-object)
)
)
)
(setq objs
(cons
(apply 'append
(vl-remove-if 'vl-catch-all-error-p
(mapcar
(function
(lambda ( x )
(vl-catch-all-apply 'vlax-invoke (list o 'offset x))
)
)
(list *off* (- *off*))
)
)
)
objs
)
)
)
(vla-delete ss)
(setq lst
(apply 'append
(mapcar
(function
(lambda ( os / s )
(if (not (vlax-curve-isClosed (car os)))
(append
(list
(vlax-ename->vla-object
(entmakex
(list
(cons 0 "LINE")
(cons 10 (vlax-curve-getStartPoint (car os)))
(cons 11 (vlax-curve-getStartPoint (cadr os)))
)
)
)
(vlax-ename->vla-object
(entmakex
(list
(cons 0 "LINE")
(cons 10 (vlax-curve-getEndPoint (car os)))
(cons 11 (vlax-curve-getEndPoint (cadr os)))
)
)
)
)
os
)
os
)
)
)
(vl-remove nil objs)
)
)
)
(setq Poly
(LWPoly
(setq bbox
(LM:BBox->List
(apply '(lambda ( ll ur / d ) (setq d (* 0.1 (distance ll ur)))
(list (polar ll (angle ll ur) (- d))
(polar ur (angle ll ur) d )
)
)
(LM:GetBoundingBox lst)
)
)
)
1
)
)
(
(lambda ( s )
(mapcar '(lambda ( x ) (ssadd x s)) (cons poly (mapcar 'vlax-vla-object->ename lst)))
)
(setq ss (ssadd))
)
(vl-cmdf "_.-boundary" "_A" "_I" "_Y" "_B" "_N" ss "" ""
(polar (car bbox) (angle (car bbox) (caddr bbox)) (* 0.01 (distance (car bbox) (caddr bbox)))) ""
)
(mapcar 'vla-delete lst)
(entdel poly)
(if (setq tmp (car (nentselp (car bbox))))
(entdel tmp)
)
)
)
(mapcar 'setvar var old)
(princ)
)
(defun LM:GetBoundingBox ( lst / ent ll ur bBoxs )
;; © Lee Mac 2010
(setq bBoxs
(apply 'append
(mapcar
(function
(lambda ( x / ll ur )
(vla-GetBoundingBox x 'll 'ur)
(list (vlax-safearray->list ll) (vlax-safearray->list ur))
)
)
lst
)
)
)
(mapcar
(function
(lambda ( operation )
(apply (function mapcar) (cons operation bBoxs))
)
)
'(min max)
)
)
(defun LM:BBox->List ( bbox )
;; © Lee Mac 2010
(mapcar
(function
(lambda ( funcs )
(mapcar
(function
(lambda ( func ) ((eval func) bbox))
)
funcs
)
)
)
'((caar cadar) (caadr cadar)
(caadr cadadr) (caar cadadr))
)
)
(defun LWPoly ( lst cls )
(entmakex
(append
(list
(cons 0 "LWPOLYLINE")
(cons 100 "AcDbEntity")
(cons 100 "AcDbPolyline")
(cons 90 (length lst))
(cons 70 cls)
)
(mapcar '(lambda ( p ) (cons 10 p)) lst)
)
)
)
-
Hehehehe.... trust you Lee to come up with something... that well... just works!
-
Hehehehe.... trust you Lee to come up with something... that well... just works!
Thanks - I'm glad it works for you - it is a touch cheating using the boundary command, but without it the code would probably be a lot lot longer... :|
-
Hehehehe.... trust you Lee to come up with something... that well... just works!
Thanks - I'm glad it works for you - it is a touch cheating using the boundary command, but without it the code would probably be a lot lot longer... :|
did this little mickey mouse vlisp, by drawing the same items as the first post, the only condition is to convert those to lwpolylines and join them before calling the routine,
see if works or if it is useful:
-
Lee Mac ,thanks your "bound" idea! :wink:
LE3 ,thanks for share your way to get it,it works. :-)