Jump to content

Recommended Posts

Posted

Code on post #39 has been changed and updated...

 

Sincerely, M.R.

:D

  • Replies 51
  • Created
  • Last Reply

Top Posters In This Topic

  • marko_ribar

    17

  • kwwong6

    12

  • Lee Mac

    9

  • MSasu

    6

Top Posters In This Topic

Posted Images

Posted

Thank for your code. Really fast and good, but just cannot for rotated block only. I now try to make other program for all of this, maybe need some days to finish it. If good I will post out.

  • 1 year later...
Posted (edited)

I've changed code just a little since my last post... Hope you'll now use it well...

 

I'll attach lsp due to its size...

 

M.R.

 

[EDIT : Even more modified BBox.lsp - only lack are blocks within blocks and blocks that overlap each other - that's why it's advised that you save DWG and then proceed to run routine]

 

[EDIT : It were 3 downloads till I reattached new version]

BBox.lsp

Edited by marko_ribar
reattached lisp
Posted

Lisp reattached...

 

Regards, M.R.

Posted

Hi Marko

I have thinking to another way to find the limits (bounding box) of a spline. The idea is to find the limits of some projections of spline on x, y and z axis.

This is a VERY limited tested version, but I think it might be useful.

 

(defun spline_bb (e / p1 p2 d ax bb)
 (vla-getboundingbox (vlax-ename->vla-object e) 'p1 'p2)
 (setq p1 (vlax-safearray->list p1)
       p2 (vlax-safearray->list p2)
       d  (distance p1 p2)
       p1 (mapcar '- p1 (list d d d))
       p2 (mapcar '+ p2 (list d d d))
       ax (mapcar '(lambda (n) (sp e n)) '((t nil nil) (nil t nil) (nil nil t)))
       bb (mapcar
            (function
              (lambda (p)
                (mapcar
                  (function
                    (lambda (f a n)
                      ((eval f) (vlax-curve-getclosestpointto a (pp p n)))
                      )
                    )
                  '(car cadr caddr)
                  ax
                  '((t nil nil) (nil t nil) (nil nil t))
                  )
                )
              )
              (list p1 p2)
           )
       )
 (mapcar 'entdel ax)
 bb
 )

;point projection on axis
(defun pp (p n) (mapcar 'if n p '(0.0 0.0 0.0)))

;spline projection on axis
(defun sp (e n)
 (entmakex
   (mapcar
     (function
       (lambda (x)
         (if
           (member (car x) '(10 11))
           (cons (car x) (pp (cdr x) n))
           x
           )
         )
       )
     (vl-remove-if '(lambda (x) (member (car x) '(-1 5 330 67 410 8 210 62 11))) (entget e))
     )
   )
 )

Posted (edited)

Stefan, why do you think it's very limited tested version... I think it's even better than first your code - it doesn't iterate 500 times while running... I've already implemented into my BBox.lsp and see no lack... Thanks, Stefan, you are really genius... And first code was real master piece and now this second, without (vlax-curve-getfirstderiv)...

 

All the best, M.R.

 

[EDIT : I forgot ab HELIXes]

 

Reattached lisp [it was 1 download till now]...

BBox.lsp

Edited by marko_ribar
  • 5 weeks later...
Posted (edited)

my version:

(defun test (c)
 ;; This code is written on the basis of code 'highflyingbird'
 ;; http://www.theswamp.org/index.php?topic=45785.msg509260#msg509260
 (mapcar (function (lambda (p)
                     (list (car (vlax-curve-getClosestPointToProjection c p '(0 1 0) t))
                           (cadr (vlax-curve-getClosestPointToProjection c p '(1 0 0) t))
                           (caddr (vlax-curve-getClosestPointToProjection c (reverse p) '(0 1 0) t))
                     )
                   )
         )
         '((-1e12 -1e12 0) (1e12 1e12 0))
 )
)
(defun c:bbox (/ a) (setq a (test (car (entsel)))) (vl-cmdf "_box" "_non" (car a) "_non" (cadr a)))

111.jpg

Edited by Elpanov Evgeniy
added link
  • 1 year later...
Posted

I've updated my BBox.lsp... Still it's little buggy, but that depends on complexity of DWG... I think that now it's still little better than it was... You can download it from my previous post...

 

Regards, M.R.

  • 2 months later...
Posted
I've updated my BBox.lsp... Still it's little buggy, but that depends on complexity of DWG... I think that now it's still little better than it was... You can download it from my previous post...

 

Regards, M.R.

 

Hi ,marko,

no function definition: ACET-SS-UNION ??? why?

Posted
Hi ,marko,

no function definition: ACET-SS-UNION ??? why?

 

This is standard ACET-... function provided within Express Tools for ACAD... Check your installation of ACAD software and make sure you checked option for including Express Tools...

Posted
This is standard ACET-... function provided within Express Tools for ACAD... Check your installation of ACAD software and make sure you checked option for including Express Tools...

 

Thanks marko ,I know :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...