Jump to content

Ployline with arc and creating a wipeout


Recommended Posts

Posted

Hi I am trying to create a wipeout that will hide the survey information under a design to do this I am copying the outer limits of the design and creating a polyline then converting it to a wipeout.

 

The problem I am having is that the design as ployline arc segments in it. I know that wipeout will not accept any ployline that is not only made up from line segments.

 

I have tried the attached lisps to change the arcs to line segments but i do not know enough about lispto edit them for my uses.

 

The problem with these lisps is that they make the whole ployline in to segments as i only want the arcs converted and not the lines.

 

Also why do wipeouts need to made up of line segments

wipeout shortcut.lsp

segments.lsp

segment(by lee mac).LSP

Posted

I assume you are using paperspace and a viewport to to present the plans. If so, why not just simply freeze in that viewport the layers (i.e. the survey information that will change under the new design) you don't want displayed where if necessary create additional layers where you only want to hide part of the survey data. I.e. if you want some of the trees picked up on there, yet not others, make a TREES_OFF layer and freeze that in the viewport etc. That is what I would do anyway.

Posted

hello Sunny .

 

This might not be typical but it would help you if your polyline arcs are small sized and they could be ignored anyway . :)

 

(defun c:Test (/ ss lst)
 (if
   (and
     (setq ss (car (entsel "\n Select a closed Polyline :")))
     (member (cdr (assoc 0 (entget ss)))
             '("LWPOLYLINE" "POLYLINE")
     )
     (vlax-curve-isclosed ss)
   )
    (progn
      (setq lst (vl-remove-if-not
                  '(lambda (x)
                     (eq (car x) 10)
                   )
                  (entget ss)
                )
      )
      (entmakex
        (append
          (list (cons 0 "LWPOLYLINE")
                (cons 100 "AcDbEntity")
                (cons 100 "AcDbPolyline")
                (cons 90 (length lst))
                (cons 70 1)
          )
          (mapcar
            (function (lambda (p) (cons 10 (list (cadr p) (caddr p)))))
            (reverse lst)
          )
        )
      )
      (command "_.wipeout" "" (entlast) "_yes")
    )
    (princ)
 )
 (princ)
)

Tharwat

Posted

Something that might work is a pface this is like a solid object you can create a pface same way as a pline add a series of points then count down.

 

Try a simple shape first also when you create pafce use the Elev command to put it with a Z value above your survey you must use the hide option for it to work Shade plot hidden

Posted

Thanks Tharwat for the response i have tested your code and it is very simular to how i manualy do it.

 

i used the PEDIT command and the the DECURVE option.

 

Then convert it in to a wipe using: (wipeout shortcut.lsp)

 

But there are the sneeky one or two big curves.

When i am generaly doing my wipeouts at the moment i explode the polyline to isolate te single curve and then use a lisp a bit like (segment(by lee mac).LSP)

 

I could create a lisp but i do not know of a way to differintiat between a big curve witch i need to use the segment lisp on it and a small curve which i need to replace with a single line

Posted

Thar's a clever idea .

 

You should explode the Polyline first then convert the arcs that were within the polyline to Lee's routine then use the command PEDIT to rejoin the the pieces of the exploded

polyline to a polyline again then use the command wipeout .

 

That works fine .

Posted
Thar's a clever idea .

Thanks for increasing the size of my head.

I was looking for a way to automate this and will work on a lisp and or script

 

I assume you are using paperspace and a viewport to present the plans. If so, why not just simply freeze in that viewport the layers (i.e. the survey information that will change under the new design) you don't want displayed where if necessary create additional layers where you only want to hide part of the survey data. I.e. if you want some of the trees picked up on there, yet not others, make a TREES_OFF layer and freeze that in the viewport etc. That is what I would do anyway.

I can do it this way but when you have a drawing where you need to show the survey to the side of a road but not under it. Your technique would only allow me the remove the survey or have it under my road. (also i don't have the time to edit our quite extensive survey the on and off layer as there is 19km of road and survey contour everywhere from 100m to 1km from the road)

 

Something that might work is a pface this is like a solid object you can create a pface same way as a pline add a series of points then count down.

Try a simple shape first also when you create pafce use the Elev command to put it with a Z value above your survey you must use the hide option for it to work Shade plot hidden

Unfortunately this is not possible because it will not convert to some of the other programs on this project because they only use 2 axes's (x,y) unlike autoCAD (x,y,z)

 

Thank you all for the replys

Posted (edited)

 

(defun as ( / *acdoc* )
 (setq *acdoc* (vlax-get (vlax-get-acad-object) 'ActiveDocument))
 (cond
   ( (eq AcModelSpace (vlax-get *acdoc* 'ActiveSpace))
     (vlax-get *acdoc* 'ModelSpace)
   )
   ( (vlax-get *acdoc* 'PaperSpace) )
 )
)

(defun solidhatch ( closed_polyline flag )
 (
   (lambda ( hatch )
     (vlax-invoke Hatch 'AppendOuterLoop
       (list closed_polyline)
     )
     (vlax-invoke hatch 'Evaluate)
     (vla-put-color hatch 255)
     (if flag hatch
       (vlax-vla-object->ename hatch)
     )
   )
   (vla-addhatch (as)
      acHatchPatternTypePredefined
      "solid" :vlax-true
   )
 )
)

(defun polyline ( pointslst layer flag )
 (
   (lambda ( e )
     (if (and e flag)
       (vlax-ename->vla-object e) e
     )        
   )
   (entmakex
     (append
       (list
         (cons 0 "LWPOLYLINE")
         (cons 100 "AcDbEntity")
         (cons 100 "AcDbPolyline")
         (cons 90 (length pointslst))
         (cons 70 1)
         (cons 8 layer)
       )
       (mapcar
         (function
           (lambda ( x ) 
             (if (listp x)(cons 10 x)
               (cons 42 x)
             )
           )
         ) pointslst
       )
     )
   )
 )
)

 

try code below

 
(solidhatch 
 (polyline 
   (list 
     '(1. 0. 0.) '(11. 0. 0.) 0.414214 
     '(12. 1. 0.) '(12. 11. 0.) 0.414214 
     '(11. 12. 0.) '(1. 12. 0.) 0.414214 
     '(0. 11. 0.) '(0. 1. 0.) 0.414214
   )  "0" t
 ) t
)

 

See the link below to figure out ;0.414214

http://www.lee-mac.com/bulgeconversion.html

 

__edit__

Thanks to:

Renderman for the solid hatch idea and showing me how to make hatch

Lee Mac for the awesome website

Edited by Lt Dan's legs
Posted
__edit__

Thanks to:

Renderman for the solid hatch idea and showing me how to make hatch

Lee Mac for the awesome website

 

Cheers dude :beer:

Posted

Here's one that creates wipeouts that have with curved objects

;;; OB2WO (gile) -Gilles Chanteau- 10/03/07
;;; Creates a "Wipeout" from an object (circle, ellipse, or polyline with arcs)
;;; Works whatever the current ucs and object OCS

(defun c:ob2wo (/ ent lst nor)
 (vl-load-com)
 (if (and (setq ent (car (entsel)))
   (member (cdr (assoc 0 (entget ent)))
	   '("CIRCLE" "ELLIPSE" "LWPOLYLINE")
   )
   (setq lst (ent2ptlst ent))
   (setq nor (cdr (assoc 210 (entget ent))))
     )
   (progn
     (vla-StartundoMark
(vla-get-ActiveDocument (vlax-get-acad-object))
     )
     (makeWipeout lst nor)
     (initget "Yes No")
     (if
(= (getkword "\nDelete source object? [Yes/No] <No>: ")
   "Yes"
)
 (entdel ent)
     )
     (vla-EndundoMark
(vla-get-ActiveDocument (vlax-get-acad-object))
     )
   )
 )
)


;;; 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)
   )
 )
)

Posted

Wow torggarf that a powerful lisp it does everything i want evertime. still have no idea how it works will get down to reading through it more intenicly later.

 

Thanks to everyone for the help all your ideas have helped me.

 

And Lee Mac i must look through your web site more when i have more time from what i have looked at it looks amasing

 

Turtle out

Posted

You're welcome Turtle,

 

All credit goes to Giles. I just found it and passed it on to you.

 

I'm just one beggar telling another beggar where to find bread...

 

~greg

Posted

Hey turtleman often S is changed to a Z when comparing AuS to USA but yes Lee-mac's site is AmaZZZZing

  • 7 months later...
Posted (edited)

I don't know why, but I wanted to revisit this..

 

 
(defun c:test ( / *error* tracecurve MakeWipeout a tr )
 (defun *error* ( m )
   (or (wcmatch (strcase m) "*BREAK,*CANCEL*,*EXIT*")
     (princ (strcat "\n** Error: " m " **"))
   ) (princ)
 )
 (defun tracecurve ( obj di / cycle st )
   (defun cycle ( st stp seg l )
     (cond
       ( (< (+ st seg) stp )
         (cycle (+ seg st) stp seg
           (cons (vlax-curve-getPointAtParam obj st) l)
         )
       )
       ( t
         (and (< st stp)
           (setq l
             (cons (vlax-curve-getPointAtParam obj st) l)
           )
         )
         (reverse
           (cons (vlax-curve-getPointAtParam obj stp) l)
         )
       )
     )
   )
   (if
     (and (not (minusp di))(not (zerop di))
       (vl-position 
         (vla-get-objectname 
           (cond
             ( (eq 'ENAME (type obj))(vlax-ename->vla-object obj ))
             ( obj )
           )
         ) '("AcDbCircle" "AcDbArc" "AcDbEllipse" "AcDbSpline")
       )
     )
     (cycle 
       (setq st (vlax-curve-getStartParam obj))
       (vlax-curve-getEndParam obj)
       (- (vlax-curve-getParamAtDist obj 0.125) st)
       nil
     )
   )
 )
;;; From troggarf's post
;;; MakeWipeout creates a "wipeout" from a points list and the normal vector of the object
;;; OB2WO (gile) -Gilles Chanteau- 10/03/07
(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)
   )
 )
)
 (if
   (and (setq a (car (entsel "\nSelect an Arc, Ellipse, Circle, or Spline to make a \"Wipeout\": ")))
     (or (setq tr (tracecurve a 0.125))
       (prompt "\nYou must Select an Arc, Ellipse, Circle, or Spline!")
     ) 
   )(progn (makewipeout tr 1)(entdel a))
 ) (princ)
)

Edited by Lt Dan's legs
Delete selected object after creating a wipeout
Posted
I don't know why' date=' but I wanted to revisit this..[/quote']

 

I get the following error:

"Select an Arc, Ellipse, Circle, or Spline to make a "Wipeout":

** Error: ARXLOAD failed **"

 

If it helps:

Windows 7 64 bit

AutoCAD 2013

Posted

Is the code you've posted giving you any problems? The only thing I did differently is switch from ent2lst function to TraceCurve...

 

try this and let me know if it comes back with anything.

 

(vl-load-com)
(vl-remove-if-not
 (function
   (lambda ( x )
     (wcmatch (strcase x t) "*wipeout*")
   )
 ) (vlax-invoke (vlax-get-acad-object) 'listarx)
)

 

To be honest I'm not sure this portion below is needed

 (if (not (member "acwipeout.arx" (arx)))
   (arxload "acwipeout.arx")
 )

Posted
Is the code you've posted giving you any problems? The only thing I did differently is switch from ent2lst function to TraceCurve...

 

To be honest I'm not sure this portion below is needed

 (if (not (member "acwipeout.arx" (arx)))
   (arxload "acwipeout.arx")
 )

 

Thanks Dude,

 

I commented out the conditional statement above as you hinted at and both Gile's routine and your routine are working fine now.

 

nice work

 

~Greg

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