- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am fairly new to AutoLisp, but I tried to make my onw Bounding Box lisp. I am aware of Lee Mac's Bounding Box lisp but it is too complex for my current understanding of AutoLisp and plus I want to make my own. So, I wrote my code but I have 2 problems.
1) I am getting the following eror:
; error; bad argument type: lentityp
In order to fix this I tried to change the (ssget) with (car(entsel)) but then I lost the ability to multi-select objects.
2) I can't figure out how to draw the rectangle. With RECTANG command I need only 2 points to draw a rectangle (first corner point and other corner point). So why my code is wrong?
(defun c:BoundingBox()
(setq SelectionSet (vlax-ename->vla-object (ssget)))
(vla-GetBoundingBox SelectionSet 'minExt 'maxExt)
(setq minExt (vlax-safearray->list minExt)
maxExt (vlax-safearray->list maxExt))
(princ minExt)
(princ maxExt)
(princ)
(setq StartPoint (vlax-3D-point (car(minExt)) (cadr(minExt)) (caddr(minEnt))))
(setq EndPoint (vlax-3D-point (car(maxExt)) (cadr(maxExt)) (caddr(maxEnt))))
(setq ModelSpace (vla-get-ModelSpace doc))
(vla-AddPolyline ModelSpace StartPoint EndPoint)
)
If possible I don't wath the code to be more complicated than this.
Thanks in advance!
Solved! Go to Solution.