Jump to content

mutilple wipeout


JORYROJ

Recommended Posts

hi guys, do you have any idea how to create multiple wipeout with different rectangle sizes?

for example:

  1. I have 300 rectangles with different sizes
  2. I want to convert all the rectangles into wipeouts
  3. Is there a way that it can be done in just one selection?
  4. I,ve tried using ALL in selection but it only convert just one rectangle.
  5. Can you give mi a tip or an Lisp maybe.

thanks

Link to comment
Share on other sites

 
(defun c:test ( / ss )
 (defun ss->lst ( ss flag / id lst )
   (if (eq 'PICKSET (type ss))
     (repeat (setq id (sslength ss))
       (
         (lambda ( name )
           (setq lst
             (cons
               (if flag (vlax-ename->vla-object name)
                 name
               )lst
             )
           )
         )(ssname ss (setq id (1- id)))
       )
     )
   )
 )
 (if  
   (setq ss 
     (ss->lst 
       (ssget '((0 . "lwpolyline")(70 . 1)))
       nil
     )
   )
   (foreach x ss
     (makewipeout (ent2ptlst x)
       (cdr (assoc 210 (entget x)))
     ) (entdel x)
   )
 ) (princ)
)

;;; ENT2PTLST
;;; Returns the vertices list of the polygon figuring the curve object
;;; Coordinates defined in OCS
(defun ent2ptlst (ent / obj dist n lst p_lst prec)
 (vl-load-com)
 (if (= (type ent) 'ENAME)
   (setq obj (vlax-ename->vla-object ent))
 )
 (cond
   ((member (cdr (assoc 0 (entget ent))) '("CIRCLE" "ELLIPSE"))
    (setq dist (/ (vlax-curve-getDistAtParam
      obj
      (vlax-curve-getEndParam obj)
    )
    50
 )
   n 0
    )
    (repeat 50
      (setq
 lst
  (cons
    (trans
      (vlax-curve-getPointAtDist obj (* dist (setq n (1+ n))))
      0
      (vlax-get obj 'Normal)
    )
    lst
  )
      )
    )
   )
   (T
    (setq p_lst (vl-remove-if-not
    '(lambda (x)
       (or (= (car x) 10)
    (= (car x) 42)
       )
     )
    (entget ent)
  )
    )
    (while p_lst
      (setq
 lst
  (cons
    (append (cdr (assoc 10 p_lst))
     (list (cdr (assoc 38 (entget ent))))
    )
    lst
  )
      )
      (if (/= 0 (cdadr p_lst))
 (progn
   (setq prec (1+ (fix (* 25 (sqrt (abs (cdadr p_lst))))))
  dist (/ (- (if (cdaddr p_lst)
        (vlax-curve-getDistAtPoint
   obj
   (trans (cdaddr p_lst) ent 0)
        )
        (vlax-curve-getDistAtParam
   obj
   (vlax-curve-getEndParam obj)
        )
      )
      (vlax-curve-getDistAtPoint
        obj
        (trans (cdar p_lst) ent 0)
      )
   )
   prec
       )
  n    0
   )
   (repeat (1- prec)
     (setq
       lst (cons
      (trans
        (vlax-curve-getPointAtDist
   obj
   (+ (vlax-curve-getDistAtPoint
        obj
        (trans (cdar p_lst) ent 0)
      )
      (* dist (setq n (1+ n)))
   )
        )
        0
        ent
      )
      lst
    )
     )
   )
 )
      )
      (setq p_lst (cddr p_lst))
    )
   )
 )
 lst
)

;;; MakeWipeout creates a "wipeout" from a points list and the normal vector of the object
(defun MakeWipeout (pt_lst nor / dxf10 max_dist cen dxf_14)
 (if (not (member "acwipeout.arx" (arx)))
   (arxload "acwipeout.arx")
 )
 (setq dxf10 (list (apply 'min (mapcar 'car pt_lst))
     (apply 'min (mapcar 'cadr pt_lst))
     (caddar pt_lst)
      )
 )
 (setq
   max_dist
    (float
      (apply 'max
      (mapcar '- (apply 'mapcar (cons 'max pt_lst)) dxf10)
      )
    )
 )
 (setq cen (mapcar '+ dxf10 (list (/ max_dist 2) (/ max_dist 2) 0.0)))
 (setq
   dxf14 (mapcar
    '(lambda (p)
       (mapcar '/
        (mapcar '- p cen)
        (list max_dist (- max_dist) 1.0)
       )
     )
    pt_lst
  )
 )
 (setq dxf14 (reverse (cons (car dxf14) (reverse dxf14))))
 (entmake (append (list '(0 . "WIPEOUT")
   '(100 . "AcDbEntity")
   '(100 . "AcDbWipeout")
   '(90 . 0)
   (cons 10 (trans dxf10 nor 0))
   (cons 11 (trans (list max_dist 0.0 0.0) nor 0))
   (cons 12 (trans (list 0.0 max_dist 0.0) nor 0))
   '(13 1.0 1.0 0.0)
   '(70 . 7)
   '(280 . 1)
   '(71 . 2)
   (cons 91 (length dxf14))
    )
    (mapcar '(lambda (p) (cons 14 p)) dxf14)
   )
 )
)

Link to comment
Share on other sites

Check this out ...

 

(defun c:TesT (/ ss i sset)
 (if (setq ss (ssget "_:L" '((0 . "LWPOLYLINE,POLYLINE"))))
   (repeat (setq i (sslength ss))
     (setq sset (ssname ss (setq i (1- i))))
     (if (vlax-curve-isclosed sset)
       (command "_.wipeout" "_polyline" sset "_Y")
     )
   )
   (princ)
 )
 (princ)
)

 

Tharwat

Link to comment
Share on other sites

Tharwat' date=' try using an asterisk

;;like this 
(ssget "_:L" '((0 . "*text")))
;or 
(ssget "_:L" '((0 . "*polyline")))

[/quote']

 

Agreed :thumbsup:

 

That was done quickly as a matter of habit only ..:)

 

Thanks

Link to comment
Share on other sites

  • 11 years later...

Hi guys, and thank you for sharing this very helpful lisp, do you have one for multiple circles,

 

Kind regards,

 

Bfr

Link to comment
Share on other sites

If you set your Hatch to Solid, color 255,255,255 and selection method to Objects, it is just as good as a wipeout and doesn't have the issue of only polylines.

Link to comment
Share on other sites

33 minutes ago, SLW210 said:

Doesn't seem to work for circles.

spacer.png\\

 

 

 

there is no option to wipe while creating a circle like Lee Mac's,

but justwipe's option S(selection) is works for circle.

 

i think when user wants wipeout on "multiple" circles,

it is usually applied for visibility of multiple bubble circles and that already exist,

so I think justwipe's option is also valid.

Link to comment
Share on other sites

8 hours ago, SLW210 said:

I get this in AutoCAD 2022 with JustWipe. 

JustWipe.png

 

It's interesting. GIF I posted was executed in autocad 2023.

in the code, the implementation of dividing the circle 50 times is the same.

I think it might be affected by the user environment

because this code use the "command" pline.... 

I agree with it's better use entmakex and trans points Lee Mac's way.

Edited by exceed
Link to comment
Share on other sites

I played with it some more and got all types of shapes, but never a complete circle. When I get back to work, I'll see if I can get a full circle.

 

At any rate for my needs, a solid hatch is just as good if not better most times as well as Lee Mac's, still, the more options the better as far I am concerned.

Link to comment
Share on other sites

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