Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm creating a function for marking elements in a dwg.
So far it works fine, but somehow it has some strange behavior with blocks.
Clicking the same block insert (same entity) in different places will, sometimes, get me a different (incorrect) bounding box (?)
Even clicking inserts of the same block (different entity) in the same place can result in an incorrect bounding box, at occasions.
...and I can't find why...
Any thoughts / help would be very welcome.
Here's an extraction of the code used/needed to create the box, for INSERTs.
(the actual routine is much bigger and does a few things more, like setting color & transparency etc.)
(defun C:test ( / gw dist ue ed et ll ul ur lr ne) (vl-load-com) (setq gw "1") ; Global Width for polylines (setq dist 1.5) ; bounding box Border Distance ; ue = user selected entity ; ed = entity data ; et = entity type ; ll = lower left ; ur = upper right ; ul = upper left ; lr = lower right ; ne = new entity (princ "\nSelect object to mark:") (while (setq ue (entsel)) (setq ed (entget (car ue))) (setq et (cdr (assoc 0 ed))) (cond ((= et "INSERT") ; Block (setq obj (vlax-ename->vla-object (car ue))) (setq box (vl-catch-all-apply 'vla-getboundingbox (list obj 'minpt 'maxpt))) (setq ll (vlax-safearray->list minpt)) (setq ur (vlax-safearray->list maxpt)) (setq ul (list (- (car ll) dist)(+ (cadr ur) dist))) (setq lr (list (+ (car ur) dist)(- (cadr ll) dist))) (command "_.rectangle" ul lr) (setq ne (entget (entlast))) (setq ne (subst (cons 43 (atof gw))(assoc 43 ne) ne)) (entmod ne) ) ) ) )
Solved! Go to Solution.