Jump to content

I want to convert many straight lines into one arc.


BEAR

Recommended Posts

On 2/16/2024 at 7:19 AM, Steven P said:

I think MHUPPS idea is more a proof that his idea works - if the basics work add a little more info and I am sure he will be along as and when he gets chance to update and improve the code.

 

unfortunately I have moved on from CAD :( and am now using exclusively solidworks at my job. so i don't get to dabble in lisp as much as i use to.

 

 

Here is another manual proof.

  • Make a 3 point arc
  • use newly created entity's  bounding box
  • delete lines that are selected with the lower left and upper right points.

 

;;----------------------------------------------------------------------------;;
;; Lines to Arc
;; https://www.cadtutor.net/forum/topic/80056-i-want-to-convert-many-straight-lines-into-one-arc/
(defun c:MSLIOA (/ LL UR) ;Many Stright Lines Into One Arc
  (command "Arc" pause pause pause) ;wait for user to pick points.
  (vla-getboundingbox (vlax-ename->vla-object (entlast)) 'minpt 'maxpt)
  (setq LL (vlax-safearray->list minpt) UR (vlax-safearray->list maxpt))
  (command "_.Erase" (ssget "_W" LL UR '((0 . "LINE"))) "")
)

 

  • Like 2
Link to comment
Share on other sites

13 hours ago, BIGAL said:

Maybe just look at lines that are short and look at next point a none short would be start of a line to be kept. Then work out the radius. Will think about it.

 

 

That's what I reckoned, make a selection set from touching lines of similar length (I reckon the end segment could be shorter than the others if the arc is made from even length segments, with one shorter end one to make up the rest)

Link to comment
Share on other sites

A better idea is to work out by calculating the perpendicular bisectors of the line segments. Take 3 consecutive lines and calculate the point where the perpendicular bisector intersects. The point where the perpendicular bisectors meet is the centre of the arc, so if they are within close proximity (to a certain tolerance), then this entails an arc segment. Otherwise, it's not.

Edited by Jonathan Handojo
  • Like 2
Link to comment
Share on other sites

I think this is the next step, it isn't pretty though but I need to go to the supermarket.

 

Select 1 segment in the arc. Might fail if the arc doesn't have a straight line either side of it and a few other errors. not tested fully and needs be tidied up with some notes added.

 

Try it and see.

 

Step after this is to do this for all the drawing and not one arc at a time

 

(defun c:ConnectedLines ( / StopLoop MySS MyList MyLines acount pt pt1 pt2 pt3 pt4 LineSS ConnectedLines)
;;Sub Functions
  (defun onlyunique ( MyList / returnList )
    (setq ReturnList (list))                           ; blank list for result
    (foreach n MyList                                  ; loop through supplied list
      (if ( = (member n (cdr (member n MyList))) nil)  ; if list item occurs only once
        (setq ReturnList (append ReturnList (list n))) ; add to list
      )
    ) ; end foreach
    ReturnList
  )
  (defun uniquepoints ( MySS / MyList acount)
    (princ "Select Lines")
    (setq MyList (list))                                 ; Blank list for line coordinates
    (setq acount 0)
    (while (< acount (sslength MySS))                    ; loop each line
      (setq MyEnt (entget (ssname MySS acount)))
      (setq MyList (append MyList (list (cdr (assoc 10 MyEnt))))) ; add end A to list
      (setq MyList (append MyList (list (cdr (assoc 11 MyEnt))))) ; add end B to list
      (setq acount (+ acount 1))
    )
    (list (onlyunique MyList) MyList)                     ; list: Unique Items, All Items
  )

  ;; 3-Point Circle  -  Lee Mac
  ;; Returns the center (UCS) and radius of the circle defined by three supplied points (UCS).
  ;; Modified to return only radius
  (defun 3PR (pt1 pt2 pt3 / cen md1 md2 vc1 vc2)
    (if (setq md1 (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) pt1 pt2)
              md2 (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) pt2 pt3)
              vc1 (mapcar '- pt2 pt1)
              vc2 (mapcar '- pt3 pt2)
              cen (inters md1 (mapcar '+ md1 (list (- (cadr vc1)) (car vc1) 0))
                          md2 (mapcar '+ md2 (list (- (cadr vc2)) (car vc2) 0))
                          nil
                  )
        )
        (distance cen pt1)
    )
  )                    

  (defun mid-pt ( p1 p2 / ) (polar p1 (angle p1 p2) (/ (distance p1 p2) 2.) ) )
  (defun LM:intersections ( ob1 ob2 mod / lst rtn )
    (if (and (vlax-method-applicable-p ob1 'intersectwith)
             (vlax-method-applicable-p ob2 'intersectwith)
             (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
        )
        (repeat (/ (length lst) 3)
            (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
                  lst (cdddr lst)
            )
        )
    )
    (reverse rtn)
  )
  (defun DrawLine (pt1 pt2) (entmakex (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2) )))

  ;;End sub functions

  (setq MyEnt (car (entsel "Select a line"))) ; A selected line
  (setq ConnectedLines (ssadd MyEnt))         ; List for lines connected to selected
  (setq MyList (ssadd MyEnt))                 ; List for used lines ; Later: for selection set selections
  (setq Pt (cdr (assoc 10 (entget MyEnt))))   ; End A point
  (setq Pt2 (cdr (assoc 11 (entget MyEnt))))  ; End A point
  (setq AnEnt MyEnt)                          ; Starting Entity

;;Get initial intersection
  (setq LineSS (ssadd))                       ; Empty Selection Set
  (setq MidPt (mid-pt Pt Pt2))
  (setq MyAng (angle Pt Pt2))
  (setq Pt3 (polar MidPt (- MyAng (/ pi 2)) 1000))
  (setq LineSS (ssadd (DrawLine MidPt Pt3) LineSS ))

  (setq Pt1 (mapcar '+ '(-0.0001 -0.0001) Pt)); Small area around end of line
  (setq Pt3 (mapcar '+ '( 0.0001  0.0001) Pt)); Other corner
  (setq MySS (ssget "_C" Pt1 Pt3 '((0 . "LINE"))) ) ; select joining lines within 0.0001
  (if (= (sslength MySS) 1)                   ; If only 1 joining lines
    (progn
      (setq Pt1 (mapcar '+ '(-0.0001 -0.0001) Pt2)); Small area around end of line
      (setq Pt3 (mapcar '+ '( 0.0001  0.0001) Pt2)); Other corner
      (setq MySS (ssget "_C" Pt1 Pt3 '((0 . "LINE"))) ) ; select joining lines within 0.0001
    )
  )
  (if (= (sslength MySS) 2)                   ; If 2 joining lines
    (progn
      (setq AnEnt (ssname (ssdel AnEnt MySS) 0))
      (setq APtA (cdr (assoc 10 (entget AnEnt)))) ; next line end points
      (setq APtB (cdr (assoc 11 (entget AnEnt))))
      (setq MidPt (mid-pt APtA APtB))
      (setq MyAng (angle APtA APtB))
      (setq Pt3 (polar MidPt (- MyAng (/ pi 2)) 1000))
      (setq LineSS (ssadd (DrawLine MidPt Pt3) LineSS ))
    )
  )
  (setq Int1 (LM:intersections (vlax-ename->vla-object (ssname LineSS 0)) (vlax-ename->vla-object (ssname LineSS 1)) acextendboth))

  (setq MyRadius (distance (car Int1) APtA))

;;Reset points
  (setq Pt (cdr (assoc 10 (entget MyEnt))))   ; End A point
  (setq Pt2 (cdr (assoc 11 (entget MyEnt))))  ; End B point
  (setq AnEnt MyEnt)                          ; Starting Entity


  (setq EndLines (ssadd))
  (repeat 2                                   ; Repeat2 - both directions
    (setq StopLoop "No")                      ; Marker to stop looping
    (while (= StopLoop "No")
      (setq Pt1 (mapcar '+ '(-0.0001 -0.0001) Pt)); Small area around end of line
      (setq Pt3 (mapcar '+ '( 0.0001  0.0001) Pt)); Other corner
      (setq MySS (ssget "_C" Pt1 Pt3 '((0 . "LINE"))) ) ; select joining lines within 0.0001
      (if (= (sslength MySS) 2)               ; If only 2 joining lines
        (progn
          (setq MySS (ssdel AnEnt MySS))      ; Next line
          (setq AnEnt (ssname MySS 0))        ; next line entity name
          (setq APtA (cdr (assoc 10 (entget AnEnt)))) ; next line end points
          (setq APtB (cdr (assoc 11 (entget AnEnt))))
          (if (ssmemb AnEnt MyList)
            (progn
              (princ "Repeating Selection")
              (setq StopLoop "Yes")
            )
            (progn
              (setq MyList (ssadd MyEnt))         ; List for used lines ; Later: for selection set selections
;;get intersection
  (setq MidPt (mid-pt APtA APtB))
  (setq MyAng (angle APtA APtB))
  (setq Pt3 (polar MidPt (- MyAng (/ pi 2)) 1000))
  (setq LineSS (ssadd (setq TempLine (DrawLine MidPt Pt3)) LineSS ))
  (setq Int2 (LM:intersections (vlax-ename->vla-object (ssname LineSS 0)) (vlax-ename->vla-object TempLine) acextendboth))
  
  (if (equal Int1 Int2 0.01) ; intersection point the same
    (progn
              (setq ConnectedLines (ssadd AnEnt ConnectedLines)) ; add next line to list of connected lines
    )
    (progn
      (setq EndLines (ssadd AnEnt EndLines))
      (setq StopLoop "Yes")
    )
  )
              (if (equal APtA Pt 0.0001)
                (setq Pt APtB)(setq Pt APtA)      ; work out if next line connected at end A or B
              )
            )
          )
        ) ; end progn
        (progn
          (setq StopLoop "Yes")
        ) ; end progn
      ) ; end if SSlength = 2
    ) ; end while stoploop

    (setq Pt (cdr (assoc 11 (entget MyEnt))))
    (setq AnEnt MyEnt)
  ) ; end repeat


  (command "erase" LineSS "") ; delete temporary lines
  (if (< 2 (sslength ConnectedLines))
    (progn

      (setq MyList (uniquepoints ConnectedLines));; SP ADDED
      (setq p1 (car (car MyList)));; SP ADDED
      (setq p2 (nth (/ (length (cadr MyList)) 2) (cadr MyList)));; SP ADDED
      (setq p3 (cadr (car MyList)));; SP ADDED

;;Do something here error checking or so no fillet needed: Lee Mac 3 point Arcs
(setq line1 (ssname EndLines 0))
(setq line2 (ssname EndLines 1))

;      (setq line1 (car (entsel "Select line")))
;      (setq line2 (car (entsel "Select line")))
      
      (setq FilletRad_Old (getvar 'filletrad))
      (setvar 'filletrad MyRadius)
      (setvar 'filletrad (3PR p1 p2 p3))
      (command "fillet" line1 line2)
      (setvar 'filletrad FilletRad_OLd)

      (command "erase" ConnectedLines "")
    ) ; end progn
  ) ; end if

;  (ssdel ConnectedLines)
)

 

  • Like 2
Link to comment
Share on other sites

This took a bit longer than I hoped - but an interesting puzzle (though of course, it is obvious what to do now)

 

It should find lines that connect together to make an arc. If 3 or more lines have a perpendicular line that intersect at nearly the same point this assumes they are straight segments to form an arc. Straight lines are deleted, arc takes their place.

 

Command: foo

 

--EDIT-- will get up set if 2 consecutive lines are colinear.. I'll think about that

 

(defun ConnectedArc ( MyEnt / Int1 Int2 MySS MyList MyLines acount pt pt1 pt2 pt3 pt4 ConnectedLines LineSS)
;;returns selection set of lines sharing a common perpendicular line intersection point
;;sort of, includes fuzz factor

;;Sub functions
  (defun DrawLine (pt1 pt2) (entmakex (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2) ))) ; draws a line
  (defun mid-pt ( p1 p2 / ) (polar p1 (angle p1 p2) (/ (distance p1 p2) 2.) ) )           ; mid point p1 to p2
  (defun LM:intersections ( ob1 ob2 mod / lst rtn ) ; Intersection between 2 lines
    (if (and (vlax-method-applicable-p ob1 'intersectwith)
             (vlax-method-applicable-p ob2 'intersectwith)
             (setq lst (vlax-invoke ob1 'intersectwith ob2 mod))
        )
        (repeat (/ (length lst) 3)
            (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn)
                  lst (cdddr lst)
            )
        )
    )
    (reverse rtn)
  )
;;End Sub functions

  (setq FF 0.001)                               ; Fuzz factor 0.1%. Proportion of the lengths
  (setq LineSS (ssadd))                         ; Blank selection set
  (setq ConnectedLines (ssadd MyEnt))           ; List for lines connected to selected
  (setq MyList (ssadd MyEnt))                   ; List of lines
  (setq Pt (cdr (assoc 10 (entget MyEnt))))     ; End A point
  (setq AnEnt MyEnt)                            ; Starting Entity

  (setq Pt1 (cdr (assoc 10 (entget MyEnt))))    ; End A point
  (setq Pt2 (cdr (assoc 11 (entget MyEnt))))    ; End B point
  (setq MyEntLen (distance Pt1 Pt2))            ; Distance for fuzz factor
  (setq PtA (mapcar '+ (list (* FF MyEntLEn -1) (* FF MyEntLEn -1)) Pt1)) ; Small area around end of line
  (setq PtB (mapcar '+ (list (* FF MyEntLEn) (* FF MyEntLEn)) Pt1)) ; Other small area around end of line

  (setq MySS (ssget "_C" PtA PtB '((0 . "LINE"))) ) ; select joining lines within 0.0001
  (if (= (sslength MySS) 1)                         ; If only 1 joining lines, try other end
    (progn
  (setq PtA (mapcar '+ (list (* FF MyEntLEn -1) (* FF MyEntLEn -1)) Pt2)) ; Small area around end of line
  (setq PtB (mapcar '+ (list (* FF MyEntLEn) (* FF MyEntLEn)) Pt2)) ; Other small area around end of line
      (setq MySS (ssget "_C" Pt1A Pt1B '((0 . "LINE")))) ; select joining lines within 0.0001
    )
  )
  (if (= (sslength MySS) 2) ; Find one adjacent intersection point
    (progn
      (setq acount 0)
      (repeat 2
        (setq IntEnt (ssname MySS acount))
        (setq PtA (cdr (assoc 10 (entget IntEnt)))) ; next line end points
        (setq PtB (cdr (assoc 11 (entget IntEnt))))
        (setq MidPt (mid-pt PtA PtB))
        (setq MyAng (angle PtA PtB))
        (setq PtC (polar MidPt (- MyAng (/ pi 2)) 1000))
        (setq LineSS (ssadd (DrawLine MidPt PtC) LineSS ))
        (setq acount 1)
      ) ; end repeat
      (setq Int1 (LM:intersections                 ; Intersection / origin of arc; car: Only 1 intersection
        (vlax-ename->vla-object (ssname LineSS 0))
        (vlax-ename->vla-object (ssname LineSS 1))
      acextendboth))
      (setq MyRadius (distance (car Int1) Pt1))   ; Radius of arc
    )
  )

  (repeat 2                                   ; Repeat2 - both directions
    (setq StopLoop "No")                      ; Marker to stop looping
    (while (= StopLoop "No")
      (setq Pt1 (mapcar '+ (list (* FF MyEntLEn -1) (* FF MyEntLEn -1)) Pt)); Small area around end of line
      (setq Pt3 (mapcar '+ (list (* FF MyEntLEn) (* FF MyEntLEn)) Pt)); Other corner
      (setq MySS (ssget "_C" Pt1 Pt3 '((0 . "LINE"))) ) ; select joining lines within 0.0001
      (if (= (sslength MySS) 2)               ; If only 2 joining lines
        (progn
          (setq MySS (ssdel AnEnt MySS))      ; Next line
          (setq AnEnt (ssname MySS 0))        ; next line entity name
          (if (ssmemb AnEnt ConnectedLines)
            (progn
              (princ "Repeating Selection")
              (setq StopLoop "Yes")
            )
            (progn
              (setq APtA (cdr (assoc 10 (entget AnEnt)))) ; next line end points
              (setq APtB (cdr (assoc 11 (entget AnEnt)))) ; next line end points

              (setq MidPt (mid-pt APtA APtB))
              (setq MyAng (angle APtA APtB))
              (setq PtC (polar MidPt (- MyAng (/ pi 2)) 1000))
              (setq LineSS (ssadd (setq NewLine (DrawLine MidPt PtC)) LineSS ))
              (setq Int2 (LM:intersections          ; Intersection / origin of arc
                (vlax-ename->vla-object (ssname LineSS 0))
                (vlax-ename->vla-object NewLine)
              acextendboth))

              (if (equal (car Int1) (car Int2) (* FF MyRadius))
                (progn
                  (setq ConnectedLines (ssadd AnEnt ConnectedLines)) ; add next line to list
                ) ; end progn
                  (progn
                  (setq StopLoop "Yes")
                ) ; end progn
              ) ; end if intersection match

              (if (equal APtA Pt (* FF MyEntLEn))
                (setq Pt APtB)(setq Pt APtA)  ; work out if next line connected at end A or B
              ) ; end if
            ) ; end progn
          ) ; end if in connected lines list
        ) ; end progn
        (progn
          (setq StopLoop "Yes")
        ) ; end progn
      ) ; end if SSlength = 2
    ) ; end while stoploop

    (setq Pt (cdr (assoc 11 (entget MyEnt))))

    (setq AnEnt MyEnt)
  ) ; end repeat

  (setq acount 0)
  (repeat (sslength LineSS) ; delete temporary lines. Use entdel to keep command line quiet
    (entdel (ssname LineSS acount))
    (setq acount (+ acount 1))
  )

;  (princ "\n")(princ (sslength ConnectedLines))(princ " Connected Lines Found")
  (list ConnectedLines (car Int1) MyRadius) ; Return Connected Lines
)





(defun c:foo (/ thisdrawing ArcSS i MyEnt MyArc MySS MyList p1 p2 p3)
;;sub functions
  (defun onlyunique ( MyList / returnList )
    (setq ReturnList (list))                           ; blank list for result
    (foreach n MyList                                  ; loop through supplied list
      (if ( = (member n (cdr (member n MyList))) nil)  ; if list item occurs only once
        (setq ReturnList (append ReturnList (list n))) ; add to list
      )
    ) ; end foreach
    ReturnList
  )
  (defun uniquepoints ( MySS / MyList acount)
    (princ "Select Lines")
    (setq MyList (list))                                 ; Blank list for line coordinates
    (setq acount 0)
    (while (< acount (sslength MySS))                    ; loop each line
      (setq MyEnt (entget (ssname MySS acount)))
      (setq MyList (append MyList (list (cdr (assoc 10 MyEnt))))) ; add end A to list
      (setq MyList (append MyList (list (cdr (assoc 11 MyEnt))))) ; add end B to list
      (setq acount (+ acount 1))
    )
    (list (onlyunique MyList) MyList)                     ; list: Unique Items, All Items
  )
  (defun LM:3pcircle ( pt1 pt2 pt3 / cen md1 md2 vc1 vc2 )
    (if (setq md1 (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) pt1 pt2)
              md2 (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) pt2 pt3)
              vc1 (mapcar '- pt2 pt1)
              vc2 (mapcar '- pt3 pt2)
              cen (inters md1 (mapcar '+ md1 (list (- (cadr vc1)) (car vc1) 0))
                          md2 (mapcar '+ md2 (list (- (cadr vc2)) (car vc2) 0))
                          nil
                  )
        )
        (list cen (distance cen pt1))
    )
  )
  (defun 3parc ( pt1 pt2 pt3 / lst ocs pt1 pt2 pt3 ) ; Lee Mac
    (if (setq ocs (trans '(0 0 1) 1 0 t))
        (if (setq lst (LM:3pcircle pt1 pt2 pt3))
            (progn
                (if (minusp (sin (- (angle pt1 pt3) (angle pt1 pt2))))
                    (mapcar 'set '(pt1 pt3) (list pt3 pt1))
                )
                (entmakex
                    (list
                       '(000 . "ARC")
                        (cons 010 (trans (car lst) 1 ocs))
                        (cons 040 (cadr lst))
                        (cons 050 (angle (trans (car lst) 1 ocs) (trans pt1 1 ocs)))
                        (cons 051 (angle (trans (car lst) 1 ocs) (trans pt3 1 ocs)))
                        (cons 210 ocs)
                    )
                )
            )
            (princ "\nPoints are collinear.")
        )
    )
    (princ)
  )
  (defun LM:ss-union ( lst / out )
    (setq lst (vl-sort lst '(lambda ( a b ) (> (sslength a) (sslength b))))
          out (car lst)
    )
    (foreach ss (cdr lst)
      (repeat (setq i (sslength ss))
        (ssadd (ssname ss (setq i (1- i))) out)
      )
    )
    out
  )
;;end sub functions

;;'Main' stuff apart from the functions above
  (setq thisdrawing (vla-get-activedocument (vlax-get-acad-object)))
  (vla-startundomark thisdrawing)         ; Start Undo
  (setq ArcSS (ssget '((0 . "LINE"))))    ; Selection Set
  (setq ArcLines (ssadd))                 ; List for lines contained in an arc

  (setq ArcSSCount 0)                     ; A counter
  (while (< ArcSSCount (sslength ArcSS))  ; while loop
    (setq MyEnt (ssname ArcSS ArcSSCount)); Next entity in loop
    (if (ssmemb MyEnt ArcLines)           ; If entity is in an arc....
      (progn                              ; do nothing
      )
      (progn
        (setq MyArc (ConnectedArc MyEnt)) ; Find all lines connected that are in an arc
        (setq MySS (car MyArc))           ; Entities that make arc
        (if (< 3 (sslength MySS))         ; If more than 3 entities its an arc. Can change 3 to suit
          (progn
            (setq MyList (uniquepoints MySS)) ; car: unique points, cadr: points list
            (setq ArcLines (LM:ss-union (list ArcLines MySS))) ; add entities to ignore list
            (setq p1 (car (car MyList)))  ; first unique point
            (setq p2 (nth (/ (length (cadr MyList)) 2) (cadr MyList))) ; point within the arc
            (setq p3 (cadr (car MyList))) ; second unique point
            (3parc p1 p2 p3)              ; draw arc
          ) ; end progn
        )   ; end if arc returned
       ) ; end progn
     )   ; end if entity in an arc
    (setq ArcSSCount (+ ArcSSCount 1) )   ; Increase count
  ) ; end while

  (setq acount 0)
  (repeat (sslength ArcLines) ; delete arc lines. Use entdel to keep command line quiet
    (entdel (ssname ArcLines acount))
    (setq acount (+ acount 1))
  )

  (vla-endundomark thisdrawing)      ; end undo
  (princ)
)

 

 

 

Happy for you all to break it, improve it, pull it to pieces - it can be improved I think. There was a question a while ago very similar problem with a polyline converted from a spline. I think the collective we removed the points of the straight segments but each point along any curves were left as short points from the spline. I think this can be changed to convert old spline line segments in to single arcs and then onto remake as a polyline. Worth doing this because the polyline thing would be handy.

 

Edited by Steven P
  • Like 1
Link to comment
Share on other sites

Maybe 1 big pline and walk along, or just pline the short segments, that would be my 1st go. 

 

Try this, pick a square around the arc when asked it does 1 arc at a time, reasonably fast.

 

(defun c:wow ( / pt1 pt2 pt3 ss num )
(while (setq pt1 (getpoint "\nPick 1st corner point of short lines Enter to exit"))
(setq pt2 (getcorner pt1 "\Pick other corner of short lines "))
(setq ss (ssget "WP" (list pt1 pt2) '((0 . "LINE"))))
(setq num (/ (sslength ss) 2))
(command "pedit" (ssname ss num) "Y" "JOIN" ss "" "")
(setq arcpl (entlast))
(setq co-ords (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget arcpl))))
(setq num (/ (length co-ords) 2))
(setq pt1 (car co-ords))
(setq pt2 (nth num co-ords))
(setq pt3 (last co-ords))
(command "arc" pt1 pt2 pt3)
(command "erase" arcpl "")
)
(princ)
)
(c:wow)

 

 

Big NOTE, when picking the double curve make a box that does not cross the second arc it will make 2 arcs delete the lines in the gap and do fillet r 0 or use the radius. I may add that as a separate function. As we now know the radius.

image.png.aea02d84d0977870c6e9c9164fb3101d.png

 

 

 

Edited by BIGAL
  • Like 1
Link to comment
Share on other sites

First of all, I would like to say thank you to those who really help me.

In this section, the Lisp I am currently using also does not work correctly.

In the case of that section, I am working on it after deleting one short line in the middle. (Delete the short straight lines between arcs)
After work, the work of reconnecting it into a straight line is done manually.

I'm sorry for not being able to tell you about this issue in advance.

 

Once again, we would like to express our gratitude to those who are helping us.

 

image.thumb.png.fed2a66727dfaaeb52fbf33bd22ae943.png

 

Link to comment
Share on other sites

In your sample drawing the lines in this area are 2 arcs, the short joining line is a continuation of arc, see below. Drawing a line perpendicular to the segments and from their mid points, if end 'B' intersects with the others then this forms the arc. My LISP above draws it like this - 2 arcs, no short line

image.png.a322c876dbd0fec079365214d4b6394a.png

 

 

If the short line is extended for example then the perpendicular line doesn't intersect at (nearly) the same point as the others, it isn't a part of the arc and so is by-passed in arc creation. Not sure how to program that if there are 2 consecutive arcs and which line to use as the joining line

 

image.thumb.png.a923597febb5baf5618744864b17d89f.png

So in the case of the arcs joining you might need to manually remove the line, create arcs and add it back in again? Or do a combination of the earlier LISPs for joined arcs and the one above for all the rest?

 

 

  • Like 1
Link to comment
Share on other sites

In the case of this point, Lisp was usually used to delete straight lines arbitrarily.
Then, I work by drawing straight lines again in the empty spaces to connect them.

And I tried to use ConnectedArc Lisp above, but it didn't work.
I probably made a mistake, but I'll try it on another computer.

Link to comment
Share on other sites


@BIGAL, Thanks for this it works like a charm in Bricscad V24.

 

This is something that I have wanted for years as lots of imported PDF's are made up of these short lines on fillets and when you try to cut them with a laser you get a lot of juddering, so the curve ends up very jagged.

 

Thanks for your efforts.

Link to comment
Share on other sites

I have a question for BIGAL.
When using Lisp
I get the same error: Pick 1st corner point of short lines Enter to exitPick other corner of short lines
Error: bad argument type: lselsetp nilAutoCAD variable setting rejected: "pickbox" nil

 

If there is any mistake I made, please tell me.

 

Link to comment
Share on other sites

8 hours ago, BEAR said:

And I tried to use ConnectedArc Lisp above, but it didn't work.
 

 

The command to try is foo - ConnectedArc is used by foo as a part of the calculations

 

(Foo is the second code in mine above but you need it all for it to work)

 

 

If that doesn't work let me know any error messages it returns, thanks (not sure if this LISP is completely error free just now)

  • Like 1
Link to comment
Share on other sites

Thank you so much...!!!

 

I did what you said and the command works normally.

 

Lisp is exactly what I was looking for... Thank you so much.!!

Link to comment
Share on other sites

I will share with you the types of problems that occurred during my testing.

First of all, it was impossible to change all the lines to arcs at once.
Sometimes it works if you do it one by one, and sometimes it doesn't.

 

I am grateful for the progress made so far, but it would be great if I could get help with the problematic areas as well.

NG sample.dxf

Link to comment
Share on other sites

I noticed that yesterday but didn't have time to look into what wasn't working quite right - one of those frustrating intermittent things I think - I'll see if I can get chance to look again and see what I did wrong. Nearly there though for what I want it to be

  • Like 1
Link to comment
Share on other sites

The wow works with your latest dwg, ok for the dbl reverse curves select not quite a full 90 degree of lines for both arcs, then draw a line using osnap Center then extend the arcs to that line, you want to zoom in where the 2 arcs join I did find a tiny error so moved 1 arc end point. The other thing I noticed is for the dbl in some cases where the 2 radius where maybe meant to be the same I get a slight variation in the 2 arc radius.

 

image.png.500dadcc2a7544865ba9e0bac1c424c5.png

 

 

  • Like 1
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...