Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/18/2024 in all areas

  1. 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"))) "") )
    1 point
  2. 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.
    1 point
  3. wahoo! It's the weekend and so CAD is going to sleep. Going to leave this one here for now though it doesn't complete your problem, it is a stepping stone till next time. Running this LISP, select a single line and it will grab all the lines connected to it and return this as a selection set. Just to remind me for later, the next steps here are: - Split the output of this up into 'long lines' and each segmented arc - the segmented arcs can then run the above codes - Repeat this over a full drawing Part way there. (defun c:ConnectedLines ( / MySS MyList MyLines acount pt pt1 pt2 pt3 pt4) (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 AnEnt MyEnt) ; Starting Entity (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 (setq ConnectedLines (ssadd AnEnt ConnectedLines)) ; add next line to list of connected lines (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 (princ "\n")(princ (sslength ConnectedLines))(princ " Connected Lines Found") ConnectedLines ; Return Connected Lines )
    1 point
×
×
  • Create New...