Jump to content

Lisp to find partially overlaping dimension


Guest kruuger

Recommended Posts

Guest kruuger

Hello

 

Is there any lisp routine to find overlapping dimension (like on picture below)

It's hard to see dim's like this. It happen very often when we use DIMCONTINUE.

And it cause big problem in manufacturing process.

 

Someone can help:(

Thank you

 

Kruuger

overlap dims.jpg

Link to comment
Share on other sites

Guest kruuger

Hi Michaels

I know overkill but this is not exactly what i want.

OV delete dims. We need to play with fuzz distance.

I'm not so good in lisp to fix OV to work for me

 

thanks

kruuger

Link to comment
Share on other sites

You can use this code to select all dimensions according to their style name ,

(sssetfirst nil(ssget "_X" '((0 . "DIMENSION")(3 . "[color="red"][b]YourStyleName[/b][/color]"))))

 

Tharwat

Link to comment
Share on other sites

Guest kruuger
You can use this code to select all dimensions according to their style name ,

(sssetfirst nil(ssget "_X" '((0 . "DIMENSION")(3 . "[color=red][b]YourStyleName[/b][/color]"))))

Tharwat

my all dims are with the same style.

what i want achive is too find these overlap dims (maybe flag them) and of course correct these mistakes.

kruuger

Link to comment
Share on other sites

You could check for intersections between the dimensions, however this method will only use the boundingbox of the dimensions and so will not be 100% accurate.

 

To demonstrate my point, try this code on two overlapping dimensions:

 

(defun c:test ( / e1 e2 )
 (vl-load-com)

 (if
   (and
     (setq e1
       (LM:SelectifFoo
         (lambda ( x )
           (eq "DIMENSION" (cdr (assoc 0 (entget x))))
         )
         "\nSelect First Dimension: "
       )
     )
     (setq e2
       (LM:SelectifFoo
         (lambda ( x )
           (eq "DIMENSION" (cdr (assoc 0 (entget x))))
         )
         "\nSelect Second Dimension: "
       )
     )
   )
   (foreach x
     (LM:GroupbyNum
       (vlax-invoke
         (vlax-ename->vla-object e1) 'IntersectWith
         (vlax-ename->vla-object e2) AcExtendNone
       )
       3
     )
     (command "_.point" "_non" x)
   )
 )

 (princ)
)

;;-------------------=={ Select if Foo }==--------------------;;
;;                                                            ;;
;;  Continuous selection prompts until the predicate function ;;
;;  foo is validated                                          ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  foo - predicate function taking ename argument            ;;
;;  str - prompt string                                       ;;
;;------------------------------------------------------------;;
;;  Returns:  selected entity ename if successful, else nil   ;;
;;------------------------------------------------------------;;

(defun LM:SelectifFoo ( foo str / e )
 ;; © Lee Mac 2010
 (while
   (progn
     (setq e (car (entsel str)))
     
     (cond
       (
         (eq 'ENAME (type e))

         (if (not (foo e)) (princ "\n** Invalid Object Selected **"))
       )
     )
   )
 )
 e
)

;;-----------------=={ Group by Number }==--------------------;;
;;                                                            ;;
;;  Groups a list into a list of lists, each of length 'n'    ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  l - List to process                                       ;;
;;  n - Number of elements by which to group                  ;;
;;------------------------------------------------------------;;
;;  Returns:  List of lists, each of length 'n'               ;;
;;------------------------------------------------------------;;

(defun LM:GroupByNum ( l n / a b )
 ;; © Lee Mac 2010
 (while l
   (
     (lambda ( i )
       (while (< 0 i)
         (setq a (cons (car l) a) l (cdr l) i (1- i))
       )
       (setq b (cons (reverse a) b) a nil)
     )
     n
   )
 )
 (reverse b)
)

  • Funny 1
Link to comment
Share on other sites

That one is pretty much bad drafting habits. Continuations should be just that. A continuation in the same direction of the previous dim. Not overlays. -David

Link to comment
Share on other sites

Guest kruuger

Thanks Lee for the code.

Probably now this needs to be combined with checking of DXF code for dim's to see if the dimensions are continued, maybe one dim include another etc.

 

Is it possible to make reactor for DIMCONTINUE command?

After command we move cursor to the left or right side of dimension and new dimension flip to correct side.

 

kruuger

Link to comment
Share on other sites

  • 9 months later...

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...