Jump to content

Recommended Posts

Posted (edited)

I need help  on a routine to do the attached DXF

because my productivity is very low when i manually change it...

or atleast automate some parts and ill do the rest. please... i still have 46 files, and most file have a thousand layers to be manually change...

 

tester.dxf

Edited by ScoRm
i change the sample dxf
Posted

I have an idea, why not ask for something like delete all the excess edges?

Posted

To answer your question:

 

  1. How are the dark lines distinguished in your original drawing? By layer? By color? If each pair of the dark lines is unique in some way, a quick ssget on the entire drawing and some filters and other functions can find the pair of dark lines to calculate.
  2. How are the white lines generated? It doesn't seem to be resulting from offset.
  3. How far apart are the dark lines? If there's no exact value, then at least the range.
  4. If you don't have an answer to #1, the least you can do is select the pair of dark lines and white lines individually and the line will be trimmed. But it won't help a lot considering your massive quantity.

Problem is... I don't think I've seen a way where a user does an ssget on the whole lot and finds the pairs of parallel lines together. Don't take my word for it, maybe someone has an answer to this one.

Posted (edited)

This is real quick and dirty drag a line over the 4 lines using 2 getpoints, then pick cut line, pick an outside point.

 

  It may need some consistency in the order of picking. 

 

(defun C:extr ( / oldsnap pt1 pt2 pt3 pt4 fuzz obj1 obj2)
(setq oldsnap (getvar 'osmode ))
(defun doextr ( )
(setq pt2 (getpoint pt1 "\nPick 2nd point"))
(setq ss (ssget "F" (list pt1 pt2)))
(setvar 'osmode 512)
(setq ent (entsel "\nPick match line"))
(setq pt3 (getpoint "\nPick outside"))
(setq fuzz 0.05)
(setvar 'osmode 0)
(command "offset" fuzz ent pt3 "")
(setq pt3 (cdr (assoc 10 (entget (entlast)))))
(setq pt4 (cdr (assoc 11 (entget (entlast)))))
(command "erase" (entlast) "")
(Command "trim" ent "" "F" pt3 pt4 "" "")
(command "extend" ent "" "f" pt1 pt2 "" "")
(setq obj1 (vlax-ename->vla-object(ssname ss 0)))
(setq obj3 (vlax-ename->vla-object (car ent)))
(setq pt1 (vlax-invoke obj3 'intersectWith obj1 acExtendThisEntity))
(setq obj2 (vlax-ename->vla-object (ssname ss (- (sslength ss) 1))))
(setq pt2 (vlax-invoke obj2 'intersectWith obj3 acExtendThisEntity))
(command "erase" ent "")
(command "line" pt1 pt2 "")
)
(while (setq pt1 (getpoint "\nPick 1st point Enter to exit"))
(doextr)
(setq ent (entlast))
(setq pt1 (getpoint "\nPick 1st point Enter to exit"))
(doextr)
(command "pedit" (ssname ss 0) "j" (entlast) (ssname ss (- (sslength ss) 1)) ent "")
(setvar 'osmode oldsnap)
)
)

Like wise started with a quick answer and got inconsistent results one white line is a pline with Z's the other is lines so makes it real hard to automate if a short Line is on end. Why are they different ? Ps Original was plines who exploded one of them ?

 

The line work has Z's making life hard tested on all at 0.0 maybe can set elev of all so works.

Edited by BIGAL
Posted
1 hour ago, Jonathan Handojo said:

To answer your question:

 

  1. How are the dark lines distinguished in your original drawing? By layer? By color? If each pair of the dark lines is unique in some way, a quick ssget on the entire drawing and some filters and other functions can find the pair of dark lines to calculate.
  2. How are the white lines generated? It doesn't seem to be resulting from offset.
  3. How far apart are the dark lines? If there's no exact value, then at least the range.
  4. If you don't have an answer to #1, the least you can do is select the pair of dark lines and white lines individually and the line will be trimmed. But it won't help a lot considering your massive quantity.

Problem is... I don't think I've seen a way where a user does an ssget on the whole lot and finds the pairs of parallel lines together. Don't take my word for it, maybe someone has an answer to this one.

 

1. the white lines are always byLayer, but the darker lines varies and in RGB,

2. they give it to me just like that... 4 lines,2 byLayer, and 2 various RGB colored polylines..

and all they want is to close the 2 Bylayer lines, but maintaining the way the original edges are.

so thats why i came up with that solution. 

3. there is no exact values...

 

 

Posted (edited)

Are all the lines always polylines, or have some of them been exploded?

 

When you have multiple sets in a drawing are they all at the same elevation or at different elevations or different layers?

 

 

Edited by dlanorh
Posted
1 minute ago, dlanorh said:

Are all the lines always polylines, or have some of them been exploded?

 

When you have multiple sets in a drawing are they all at the same elevation or at different elevations?

 

 

all are polylines, i just exploded them so that i can use the command LENGTHEN and DYNAMIC... because it doesn't work on polylines..

Posted
2 hours ago, BIGAL said:

This is real quick and dirty drag a line over the 4 lines using 2 getpoints, then pick cut line, pick an outside point.

 

This sort of works but only does one end as obj1 and obj2 are same pline.  It may need some consistency in the order of picking. Just need to redo the pedit bit for must do 2nd end 1st. Run a defun twice. I am hungry now so later.

 


(defun C:extr ( / oldsnap pt1 pt2 pt3 pt4 fuzz obj1 obj2)
(setq oldsnap (getvar 'osmode ))
(while (setq pt1 (getpoint "\nPick 1st point Enter to exit"))
(setq pt2 (getpoint pt1 "\nPick 2nd point"))
(setq ss (ssget "F" (list pt1 pt2)))
(setvar 'osmode 512)
(setq ent (entsel "\nPick match line"))
(setq pt3 (getpoint "\nPick outside"))
(setq fuzz 0.05)
(setvar 'osmode 0)
(command "offset" fuzz ent pt3 "")
(setq pt3 (cdr (assoc 10 (entget (entlast)))))
(setq pt4 (cdr (assoc 11 (entget (entlast)))))
(command "erase" (entlast) "")
(Command "trim" ent "" "F" pt3 pt4 "" "")
(command "extend" ent "" "f" pt1 pt2 "" "")
(setq obj1 (vlax-ename->vla-object(ssname ss 0)))
(setq obj3 (vlax-ename->vla-object (car ent)))
(setq pt1 (vlax-invoke obj3 'intersectWith obj1 acExtendThisEntity))
(setq obj2 (vlax-ename->vla-object (ssname ss (- (sslength ss) 1))))
(setq pt2 (vlax-invoke obj3 'intersectWith obj2 acExtendThisEntity))
(command "erase" ent "")
(command "line" pt1 pt2 "")
(command "pedit" (ssname ss 0) "j" (entlast) (ssname ss (- (sslength ss) 1)) "")
(setvar 'osmode oldsnap)
)
)

Like wise started with a quick answer and got inconsistent results one white line is a pline with Z's the other is lines so makes it real hard to automate if a short Line is on end. Why are they different ? Ps Original was plines who exploded one of them ?

 

The line work has Z's making life hard tested on all at 0.0 maybe can set elev of all so works.

 

 

 

thank you, it doesnt trim the other side, but hey! ill take it! its easier! thanks a lot!

Posted
5 minutes ago, ScoRm said:

all are polylines, i just exploded them so that i can use the command LENGTHEN and DYNAMIC... because it doesn't work on polylines..

 

OK, and are each group of 4 always on the same layer, and is this the same for all the groups of four?

 

With only a single example it's difficult to get the scope of what is achievable on a drawing basis i.e. how much can be automated

Posted (edited)
4 hours ago, dlanorh said:

 

OK, and are each group of 4 always on the same layer, and is this the same for all the groups of four?

 

With only a single example it's difficult to get the scope of what is achievable on a drawing basis i.e. how much can be automated

 

i attached another one.

 

the first 4 layers are finished

the current layer is what I am doing now

the last 2 layers, doesnt have lines yet.. so i still have to line those, and then extend the 4 lines and, trim the excess...

I add lines on both ends of the darker line and extend them, so that i will know where to trim when I extend the 4 lines

 

please ask more, if still not clear... thank you so much for taking the time.

 

sir how about just the trimming of all excess lines and polylines, is it possible?

I can manually add the line and extend them before trimming all the sides

 

tester2.dwg

Edited by ScoRm
I change the dwg in 2010 version
Posted (edited)

Just ran code again, posted updated above. If the single line is at a different elevation will not work, could be added at by changing the line elev to match obj1.

 

image.png.806abde7cc0ce2b19de3db1e37493a65.png

Edited by BIGAL
Posted (edited)
3 hours ago, ScoRm said:

 

i attached another one.

 

the first 4 layers are finished

the current layer is what I am doing now

the last 2 layers, doesnt have lines yet.. so i still have to line those, and then extend the 4 lines and, trim the excess...

I add lines on both ends of the darker line and extend them, so that i will know where to trim when I extend the 4 lines

 

please ask more, if still not clear... thank you so much for taking the time.

 

sir how about just the trimming of all excess lines and polylines, is it possible?

I can manually add the line and extend them before trimming all the sides

tester2.dwg 32.15 kB · 2 downloads

 

I can't open the drawing tester2. It needs to be a dxf or AutoCAD 2010 or earlier.

 

Here is my effort based on the original dxf

 

You need to select all 4 polylines and only 4 polylines. The code does the rest. This could be looped.

 

(defun rh:ss2lst( ss opt / cnt lst)
  (cond ( (and ss (= (type ss) 'PICKSET)) 
          (repeat (setq cnt (sslength ss)) (setq lst (cons (ssname ss (setq cnt (1- cnt))) lst)))  
          (if opt (setq lst (mapcar 'vlax-ename->vla-object lst)))
        )
  );end_cond
);end_defun

(defun rh:223 (lst z / a) (setq a (reverse (cons z (reverse lst)))))

(defun rh:322 (lst / a) (setq a (reverse (cdr (reverse lst)))))

(defun rh:trp (pt1 pt2 obj / xobj ent v xpt)
  (setq xobj (vlax-invoke *c_spc* 'addxline pt1 pt2)
        ent (vlax-vla-object->ename obj)
        v (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent)))
        xpt (rh:322 (vlax-invoke xobj 'intersectwith obj acextendotherentity))
  );end_setq
  (if (> (distance xpt (car v)) (distance xpt (last v))) 
    (setq v (reverse (cons xpt (cdr (reverse v)))))
    (setq v (cons xpt (cdr v)))
  );end_if
  (vla-delete xobj)
  (vlax-put obj 'coordinates (apply 'append v))
);end_defun

(vl-load-com)

(defun c:xtr ( / ss lst flst xlst ele v1 v2 xobj obj ent v3 xpt nlst)

  (or *c_doc* (setq *c_doc* (vla-get-activedocument (vlax-get-acad-object))))
  (or *c_spc* (setq *c_spc* (vlax-get-property *c_doc* (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))))
  
  (while (or (not ss) (/= (sslength ss) 4))
    (setq ss (ssget '((0 . "LWPOLYLINE"))))
    (cond ( (not ss) (alert "Nothing Selected"))
          ( (/= (sslength ss) 4) (alert "Only Select 4 LWPolylines"))
    );end_cond
  );end_while
  
  (setq lst (rh:ss2lst ss t))
  (foreach x lst (if (= (vlax-get-property x 'color) 256) (setq flst (cons x flst)) (setq xlst (cons x xlst))))
  (setq lst (mapcar 'vlax-vla-object->ename xlst))
  (setq ele (cdr (assoc 38 (entget (car lst)))))
  (setq v1 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car lst)))))
  (setq v2 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (cadr lst)))))
  
  (if (> (distance (car v1) (car v2)) (distance (car v1) (last v2))) (setq v2 (reverse v2)))
  (rh:trp (rh:223 (car v1) ele) (rh:223 (car v2) ele) (car flst))
  (rh:trp (rh:223 (car v1) ele) (rh:223 (car v2) ele) (cadr flst))
  (rh:trp (rh:223 (last v1) ele) (rh:223 (last v2) ele) (car flst))
  (rh:trp (rh:223 (last v1) ele) (rh:223 (last v2) ele) (cadr flst))
  (foreach x xlst (vla-delete x))
  (setq lst (mapcar 'vlax-vla-object->ename flst))
  (setq v1 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car lst)))))
  (setq v2 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (cadr lst)))))
  (if (> (distance (car v1) (car v2)) (distance (car v1) (last v2)))
    (setq nlst (append v1 v2))
    (setq nlst (append v1 (reverse v2)))
  );end_if
  (vlax-put (car flst) 'coordinates (apply 'append nlst))
  (vlax-put-property (car flst) 'closed :vlax-true)
  (vla-delete (cadr flst))
  (princ)
);end_defun

 

Edited by dlanorh
sub function code altered
Posted (edited)

@dlanorh, your code runs an error on the below:

 

23 minutes ago, dlanorh said:

(rh:trp (rh:223 (car v1) ele) (rh:223 (car v2) ele) (car flst))

 

...saying "too few arguments". 

 

Below is my effort. Same like dlanorh, select only four polylines, and the code does the rest. The code will loop over and over until user doesn't select anything when prompted.

 

(defun c:extd ( / apcord bb dark cords dets dr ends ent extpt i newl p1 p2 p3 p4 pts scord ss starts wh white x y)
  (while
    (setq ss (ssget '((0 . "*POLYLINE"))))
    (cond
      ((/= (setq i (sslength ss)) 4) (princ "\nPlease select only four polylines"))
      ((progn
	 (repeat i
	   (if (assoc 62 (entget (setq ent (ssname ss (setq i (1- i))))))
	     (setq white (cons ent white))
	     (setq dark (cons ent dark))
	     )
	   )
	 (and (/= (length white) 2) (/= (length dark) 2))
	 )
       (princ "\nPlease select two white and dark polylines each")
       )
      (T
       (setq dets (apply 'append
			 (mapcar '(lambda (x y)
				    (list
				      (cons x (vlax-curve-getStartPoint x))
				      (cons x (vlax-curve-getEndPoint x))
				      (cons y (vlax-curve-getStartPoint y))
				      (cons y (vlax-curve-getEndPoint y))
				      )
				    )
				 white
				 dark
				 )
			 )
	     pts (mapcar 'cdr dets)
	     bb (LM:ssboundingbox ss)
	     pts (vl-sort pts '(lambda (x y)
				 (< (distance (car bb) x)
				    (distance (car bb) y)
				    )
				 )
			  )
	     starts (mapcar '(lambda (x)
			       (cons x
				     (vl-some
				       '(lambda (y)
					  (if
					    (or
					      (equal x (vlax-curve-getStartPoint (car y)) 1e-8)
					      (equal x (vlax-curve-getEndPoint (car y)) 1e-8)
					      )
					    (car y)
					    )
					  )
				       dets
				       )
				     )
			       )
			    (JH:list-x-to-y pts 0 3)
			    )
	     ends (mapcar '(lambda (x)
			       (cons x
				     (vl-some
				       '(lambda (y)
					  (if
					    (or
					      (equal x (vlax-curve-getStartPoint (car y)) 1e-8)
					      (equal x (vlax-curve-getEndPoint (car y)) 1e-8)
					      )
					    (car y)
					    )
					  )
				       dets
				       )
				     )
			       )
			    (JH:list-x-to-y pts 4 7)
			    )
	     )
       (foreach a '(starts ends)
	 (foreach x (eval a)
	   (if (assoc 62 (entget (cdr x)))
	     (setq dr (cons x dr))
	     (setq wh (cons x wh))
	     )
	   )
	 (setq wh (reverse wh)
	       dr (reverse dr)
	       p1 (caar dr)
	       p2 (caadr dr)
	       )
	 (foreach x wh
	   (setq p3 (car x)
		 p4 (polar (car x)
			   (angle '(0 0 0)
				  (vlax-curve-getFirstDeriv (cdr x)
				    (vlax-curve-getParamAtPoint (cdr x) (car x))
				    )
				  )
			   1
			   )
		 extpt (inters p1 p2 p3 p4 nil)
		 cords (mapcar 'cdr (vl-remove-if-not '(lambda (y) (eq (car y) 10)) (entget (cdr x))))
		 newl (cons extpt newl)
		 )
	   (if (equal p3 (vlax-curve-getStartPoint (cdr x)) 1e-8)
	     (setq cords (append (list (list (car extpt) (cadr extpt))) (cdr cords)))
	     (setq cords (append (reverse (cdr (reverse cords))) (list (list (car extpt) (cadr extpt)))))
	     )

	   (vla-put-Coordinates (vlax-ename->vla-object (cdr x))
	     (progn
	       (vlax-safearray-fill
		 (setq scord (vlax-make-safearray vlax-vbDouble
			       (cons 0 (1- (length (setq apcord (apply 'append cords)))))))
		 apcord
		 )
	       scord
	       )
	     )
	   )
	 (entmake
	   (list
	     '(0 . "LINE")
	     '(100 . "AcDbEntity")
	     '(100 . "AcDbLine")
	     ; '(8 . "0")  ; <--- Put your layer here
	     (cons 10 (car newl))
	     (cons 11 (cadr newl))
	     )
	   )
	 (foreach e '(dr wh newl white dark) (set e nil))
	 )
       )
      )
    )
  )


(defun JH:list-x-to-y (l x y) ; Returns a list between indices x and y inclusive
  (cond
    ((or (null l) (minusp y)) nil)
    ((zerop x) (cons (car l) (JH:list-x-to-y (cdr l) x (1- y))))
    (T (JH:list-x-to-y (cdr l) (1- x)(1- y)))
    )
  )


;; Selection Set Bounding Box  -  Lee Mac
;; Returns a list of the lower-left and upper-right WCS coordinates of a
;; rectangular frame bounding all objects in a supplied selection set.
;; sel - [sel] Selection set for which to return bounding box

(defun LM:ssboundingbox ( sel / idx llp ls1 ls2 obj urp )
    (repeat (setq idx (sslength sel))
        (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
        (if (and (vlax-method-applicable-p obj 'getboundingbox)
                 (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'llp 'urp))))
            )
            (setq ls1 (cons (vlax-safearray->list llp) ls1)
                  ls2 (cons (vlax-safearray->list urp) ls2)
            )
        )
    )
    (if (and ls1 ls2)
        (mapcar '(lambda ( a b ) (apply 'mapcar (cons a b))) '(min max) (list ls1 ls2))
    )
)

 

Edited by Jonathan Handojo
Posted
46 minutes ago, dlanorh said:

 

I can't open the drawing tester2. It needs to be a dxf or AutoCAD 2010 or earlier.

 

 

sir i change the DWG file now

Posted
28 minutes ago, Jonathan Handojo said:

@dlanorh, your code runs an error on the below:

 

 

...saying "too few arguments". 

 

Below is my effort. Same like dlanorh, select only four polylines, and the code does the rest. The code will loop over and over until user doesn't select anything when prompted.

 


(defun c:extd ( / apcord bb dark cords dets dr ends ent extpt i newl p1 p2 p3 p4 pts scord ss starts wh white x y)
  (while
    (setq ss (ssget '((0 . "*POLYLINE"))))
    (cond
      ((/= (setq i (sslength ss)) 4) (princ "\nPlease select only four polylines"))
      ((progn
	 (repeat i
	   (if (assoc 62 (entget (setq ent (ssname ss (setq i (1- i))))))
	     (setq white (cons ent white))
	     (setq dark (cons ent dark))
	     )
	   )
	 (and (/= (length white) 2) (/= (length dark) 2))
	 )
       (princ "\nPlease select two white and dark polylines each")
       )
      (T
       (setq dets (apply 'append
			 (mapcar '(lambda (x y)
				    (list
				      (cons x (vlax-curve-getStartPoint x))
				      (cons x (vlax-curve-getEndPoint x))
				      (cons y (vlax-curve-getStartPoint y))
				      (cons y (vlax-curve-getEndPoint y))
				      )
				    )
				 white
				 dark
				 )
			 )
	     pts (mapcar 'cdr dets)
	     bb (LM:ssboundingbox ss)
	     pts (vl-sort pts '(lambda (x y)
				 (< (distance (car bb) x)
				    (distance (car bb) y)
				    )
				 )
			  )
	     starts (mapcar '(lambda (x)
			       (cons x
				     (vl-some
				       '(lambda (y)
					  (if
					    (or
					      (equal x (vlax-curve-getStartPoint (car y)) 1e-8)
					      (equal x (vlax-curve-getEndPoint (car y)) 1e-8)
					      )
					    (car y)
					    )
					  )
				       dets
				       )
				     )
			       )
			    (JH:list-x-to-y pts 0 3)
			    )
	     ends (mapcar '(lambda (x)
			       (cons x
				     (vl-some
				       '(lambda (y)
					  (if
					    (or
					      (equal x (vlax-curve-getStartPoint (car y)) 1e-8)
					      (equal x (vlax-curve-getEndPoint (car y)) 1e-8)
					      )
					    (car y)
					    )
					  )
				       dets
				       )
				     )
			       )
			    (JH:list-x-to-y pts 4 7)
			    )
	     )
       (foreach a '(starts ends)
	 (foreach x (eval a)
	   (if (assoc 62 (entget (cdr x)))
	     (setq dr (cons x dr))
	     (setq wh (cons x wh))
	     )
	   )
	 (setq wh (reverse wh)
	       dr (reverse dr)
	       p1 (caar dr)
	       p2 (caadr dr)
	       )
	 (foreach x wh
	   (setq p3 (car x)
		 p4 (polar (car x)
			   (angle '(0 0 0)
				  (vlax-curve-getFirstDeriv (cdr x)
				    (vlax-curve-getParamAtPoint (cdr x) (car x))
				    )
				  )
			   1
			   )
		 extpt (inters p1 p2 p3 p4 nil)
		 cords (mapcar 'cdr (vl-remove-if-not '(lambda (y) (eq (car y) 10)) (entget (cdr x))))
		 newl (cons extpt newl)
		 )
	   (if (equal p3 (vlax-curve-getStartPoint (cdr x)) 1e-8)
	     (setq cords (append (list (list (car extpt) (cadr extpt))) (cdr cords)))
	     (setq cords (append (reverse (cdr (reverse cords))) (list (list (car extpt) (cadr extpt)))))
	     )

	   (vla-put-Coordinates (vlax-ename->vla-object (cdr x))
	     (progn
	       (vlax-safearray-fill
		 (setq scord (vlax-make-safearray vlax-vbDouble
			       (cons 0 (1- (length (setq apcord (apply 'append cords)))))))
		 apcord
		 )
	       scord
	       )
	     )
	   )
	 (entmake
	   (list
	     '(0 . "LINE")
	     '(100 . "AcDbEntity")
	     '(100 . "AcDbLine")
	     ; '(8 . "0")  ; <--- Put your layer here
	     (cons 10 (car newl))
	     (cons 11 (cadr newl))
	     )
	   )
	 (foreach e '(dr wh newl white dark) (set e nil))
	 )
       )
      )
    )
  )


(defun JH:list-x-to-y (l x y) ; Returns a list between indices x and y inclusive
  (cond
    ((or (null l) (minusp y)) nil)
    ((zerop x) (cons (car l) (JH:list-x-to-y (cdr l) x (1- y))))
    (T (JH:list-x-to-y (cdr l) (1- x)(1- y)))
    )
  )


;; Selection Set Bounding Box  -  Lee Mac
;; Returns a list of the lower-left and upper-right WCS coordinates of a
;; rectangular frame bounding all objects in a supplied selection set.
;; sel - [sel] Selection set for which to return bounding box

(defun LM:ssboundingbox ( sel / idx llp ls1 ls2 obj urp )
    (repeat (setq idx (sslength sel))
        (setq obj (vlax-ename->vla-object (ssname sel (setq idx (1- idx)))))
        (if (and (vlax-method-applicable-p obj 'getboundingbox)
                 (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-getboundingbox (list obj 'llp 'urp))))
            )
            (setq ls1 (cons (vlax-safearray->list llp) ls1)
                  ls2 (cons (vlax-safearray->list urp) ls2)
            )
        )
    )
    (if (and ls1 ls2)
        (mapcar '(lambda ( a b ) (apply 'mapcar (cons a b))) '(min max) (list ls1 ls2))
    )
)

 

 

Sorry. I updated the code after I first posted it. One of the sub funtions had too many arguments. You probably downloaded it before I updated it.

Posted (edited)
7 minutes ago, dlanorh said:

 

Sorry. I updated the code after I first posted it. One of the sub funtions had too many arguments. You probably downloaded it before I updated it.

 

All good. It works fine, although it deleted the colored lines. And perhaps better and simpler than mine. You used an xline and intersectwith while I used (inters p1 p2 p3 p4 nil) since I never like the idea of drawing something and then deleting it in a command. All in all, as long as it works fine, I have no right to criticise anything.

Edited by Jonathan Handojo
Posted
3 minutes ago, Jonathan Handojo said:

 

All good. It works fine, although it deleted the colored lines. And perhaps better and simpler than mine.

 

The final outcome had no colored lines so the I assumed they were deleted. Just a foreach removal or commenting will sort it if they are required. Tester2 seems to have moved the goal posts though.

Posted (edited)

thank you so much! I needed this!

sir @BIGAL @dlanorh @Jonathan Handojo

now i have 3. lol IDK what to use. I'm gonna keep this..

maybe i will use the one that join all the line to make a closed polyline

Edited by ScoRm
Posted
On 3/28/2020 at 12:51 AM, ScoRm said:

I need help  on a routine to do the attached DXF

because my productivity is very low when i manually change it...

or atleast automate some parts and ill do the rest. please... i still have 46 files, and most file have a thousand layers to be manually change...

After drawing the first two lines instead of all the lengthening, trimming, and joining you could have just filletted them reducing the steps to less than half.

Lisp solutions are better, just something to think of in the future since you're working on your productivity.

Posted
7 hours ago, tombu said:

After drawing the first two lines instead of all the lengthening, trimming, and joining you could have just filletted them reducing the steps to less than half.

Lisp solutions are better, just something to think of in the future since you're working on your productivity.

 

(command) and (vl-cmdf) are last resorts that I'll use in AutoLISP. Based on my experience, running (command) is a lot slower, although it may practically be helpful in this case because we're only dealing with four lines. I guess it's a habit of mine.

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